8 posts
Posted 29 March 2013 - 08:58 AM
ok so i need help i am treing to make it so when i type some thing like a password it can have many options like one to exit one to shutdown and so on how would i do that?
1688 posts
Location
'MURICA
Posted 29 March 2013 - 09:13 AM
Seems pretty simple. You would just need to ask for the password first, while continually checking if it's correct.
local pass = "an amazing password"
local input
while input ~= pass do
input = read()
if input ~= pass then
print 'Access denied.'
end
end
Then print your options, and wait for a keypress.
print [[
What would you like to do?
1. Exit
2. Shutdown
]]
while true do
local _, key = os.pullEvent('key')
if key == '1' then
break
elseif key == '2' then
os.shutdown()
end
end
8 posts
Posted 29 March 2013 - 11:07 AM
ok thanks and i meant more like type commands.
1522 posts
Location
The Netherlands
Posted 29 March 2013 - 11:15 AM
For type commands you would do something like this:
write('write command: ')
local reader = read()
if reader == 'command' then
--do stuff
elseif reader == 'notetgequotes' then
-- do stuff
end
you can expand the amount of elseifs.
8 posts
Posted 29 March 2013 - 11:37 AM
oh ok so you can put else and if next to each other thanks evern more
8 posts
Posted 29 March 2013 - 03:01 PM
hey one more thing im trying to get a image to draw on a monitor using the wires how would i do that?
im doing this
mon0 = peripheral.wrap("monitor_0")
but i dont know how to draw it on it i have ben trying for 2 hours now
1688 posts
Location
'MURICA
Posted 29 March 2013 - 04:51 PM
mon0.write('Some wonderful text!')
And everything else on this page. In your case, replace "term" with "mon0".