This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
CrazyTech13's profile picture

Slideshow API

Started by CrazyTech13, 16 November 2014 - 10:00 AM
CrazyTech13 #1
Posted 16 November 2014 - 11:00 AM
Hello everyone and welcome to the introduction of my first released API!

The Slideshow API allows you to easily create a slideshow/PowerPoint presentation and control it from a distance (Remote control).

Example uses:

- A slideshow of paintings
- A PowerPoint presentation
- A resume
- An application form
- Whatever you can think of!

To download it onto your ComputerCraft terminal, type in the command: "pastebin get tGTb5Hms slideshow".

—————————————————————————————————————————————————————————–
Setting Up

You will need two computers, two wireless modems, and a monitor.

Have one computer hooked up to the monitor (display computer) and the other (controller) anywhere you want. Next place the wireless modems on the computers.

Download the API onto the computer connected to the monitor and type into your other computer: "pastebin get PL2r5QbV controller".

Set the value of the display monitor (slideCom) in the controller program to the id of the display computer

Now to create the program that uses the API.

This is how your program should look:

local totalSlides = 3 -- set this to the amount of slides you have

os.loadAPI("slideshow") -- load our API
slideshow.setRNSide("top") -- modem side of display computer
slideshow.setCtrlCom(6) -- controller id
slideshow.setTotalSlides(totalSlides) -- set functions give information to the API

local slide = 1
local mon = peripheral.wrap("back") -- monitor side; change if necessary

local function slide1()
  mon.setBackgroundColor(colors.lime)
  mon.clear()
end

local function slide2()
  mon.setBackgroundColor(colors.pink)
  mon.clear()
end

local function slide3()
  mon.setBackgroundColor(colors.orange)
  mon.clear()
end

-- slide() functions are your slides which can be paintings, words, etc.

local function display() -- chooses which slide to display

  if slide == 1 then
	slide1()
  
  elseif slide == 2 then
	slide2()
  
  elseif slide == 3 then
	slide3()
  
  end

end

mon.setBackgroundColor(colors.black) -- clears the monitor before the slideshow starts
mon.clear()

slideshow.slideShowStartup()

while slide <= totalSlides do -- while current slide is not over total slides

  slide = slideshow.getSlide()
  display()

  slide = slideshow.remoteControl()

end

mon.setBackgroundColor(colors.black) -- clears the monitor after the slideshow ends
mon.clear()

You will need the load API function, set functions, start up function and while loop. The slides are what you make them to be.

Now to start the slideshow, run the display computer's program, and then the controller's. You can select slides with the arrow keys inside of the controller.

Have fun! :D/>
Edited on 16 November 2014 - 10:11 AM
Creator #2
Posted 20 February 2015 - 09:56 PM
screenshots please