Be extremely careful when using os.pullEventRaw(). if you over-write the terminate event, miscode it, and it's a startup program, then you're not going to be able to use that computer again unless you have access to the actual files on the HDD.
I'm not sure touchpoint would be necessary. He only needs 2 buttons. But there are advantages to having it, so that's up to you. For the login part, I'm not sure you need a button on a monitor for that. Typing in your password would be something you do inside the computer anyway, and I'm assuming most people will only need to see the monitor, and only admins or VIPs will need the computer. I would keep the login inside the computer and the slideshow on the monitor. Which would make it only use 1 button.
We probably won't write the whole program for you, but we love giving pointers and teaching people how to code for themselves.
Lyqyd has a computer basics post in the forums and lots of other tutorials are found
hereSpoiler
Lyqyd Computer Basics Series
Computer Basics 1
Computer Basics 2
SurferPup's monitor button tutorial series
part 1
following parts linked in part 1
SerferPup's lua tutorial
lua basicsI'll give you a few pointers right here. I know there is a ton to learn and the links above have lots of info that you probably don't need with your specific program.
Spoiler
-- first you need to wrap the monitor as a peripheral.
mon = peripheral.wrap("top") -- replace top with the side it's on. "left", "right", "back", "front", "top", "bottom".
-- to write something to the computers GUI use this
print("hello") -- print() adds a [url="http://en.wikipedia.org/wiki/Carriage_return"]carriage return[/url]. simply put, makes a new line automatically
term.write("world") -- doesn't add a carriage return
-- to write it to the monitor, you need to use the variable you wrapped your monitor to, in our case, mon
mon.write("hello world") -- don't put in term.
-- remember mon takes terms place when using this monitor, always
-- to clear the entire screen type
term.clear()
-- to clear only 1 line you need to set the line first, then clear the line
term.setCursorPos(1,5) -- here x = 1, y = 5.
term.clearLine()
-- to set [url="http://computercraft.info/wiki/Colors_(API)"]colors [/url]you need an advanced monitor/computer
term.setTextColor(colors.red)
term.setBackgroundColor(colors.blue)
print("hello") -- monitors don't have a print function by default. just a mon.write()
that is most of what you'll need to write to a monitor. remember you need to clear your screen and set the cursor position to avoid clustered text and to make text start at the top.
I'll show you an easy function that will give you a good understanding of how functions work.
-- first you have to give the function a name.
-- local means it's native to this program. It's good practice.
-- then you have to say "function"
-- then what you want the function to be called, followed by ()
local function clear()
term.clear() -- clears the screen
term.setCursorPos(1, 1) -- sets position to the top left
end -- ends the function
--then you need to call it whenever you need it.
clear()
you could make a function for each slide by putting in term.write("line 1") then setting the cursor position down 1
then for line two use term.write("line2") as shown below.
to change slides automatically you need a loop. look for the function "slideshow()" in the below example
mon = peripheral.wrap("top")
local function clear()
mon.clear()
mon.setCursorPos(1, 1)
end
local function slide1()
clear() -- don't forget this
mon.write("this is line 1")
mon.setCursorPos(1, 2)
mon.write("this is line 2")
mon.setCursorPos(1, 3)
end
local function slide2()
clear()
mon.write("slide 2, line 1")
mon.setCursorPos(1, 2)
mon.write("slide 2, line2 ")
end
local function slideshow() -- functions can call other functions.
slide1() -- runs slide1()
sleep(5) -- waits for 5 seconds
slide2() -- runs slide2()
sleep(5)
end
slideshow() -- calls the slideshow() function
and so on. That is how you make the slideshow.
finally the os.pullEvent() is probably the trickiest, but easy once you get the hang of it. Test with this and make sure the program works perfectly before using os.pullEventRaw()
in the os.pullEvent() link, you will find loads of information of what each event does.
mon = peripheral.wrap("top")
w, h = mon.getSize() -- gets the size of the monitor
timer = os.startTimer(1) -- this will be useful for the
while true do -- infinite loop
mon.setCursorPos(5, h)
mon.setTextColor(colors.cyan)
mon.setBackgroundColor(colors.lightGray)
mon.write(" click me ")
mon.setTextColor(colors.white)
mon.setBackgroundColor(colors.black)
evt, p1, p2, p3 = os.pullEvent() -- os.pullEvent() waits for something to happen, then returns what happened
-- evt means the type of event.
-- p1 is the next thing that is returned in the event the rest are next in line.
if evt == "monitor_touch" then -- use == when comparing. use = when setting a variable
mon.setCursorPos(p2, p3) -- sets the pos to where you touched the monitor
mon.write(" ") -- makes a dot at that point
sleep(1) -- just to keep that point there for a sec
if p2 >= 5 and p2 <= 15 then
mon.clear()
mon.setCursorPos(1, 1)
mon.write("you did it!")
break
end
elseif evt == "timer" then
-- this is where your timer would be to change slides.
-- I recommend using this method over using the one in my earlier example.
timer = os.startTimer(1) -- make sure to make this how long you want the slide to be.
end
end
mon.setCursorPos(1, 2)
mon.write("if you didn't, click other places on the screen")
The password is easy enough. look at this.So without testing any of this, I believe it all should work, and give you a good idea of what to do.