at first i apologize me for my bad English.
I'm a PHP IT Student so i can Programming some awesome Stuff but now i need help in lua.
i got very angry Yesterday because of my Computercraft Ticket system.
I want the following :
There are 2 Options where you can go : Neuss and Duesseldorf.
I want that you can press the destination with the right mouse button and you have to take into a chest 2 gold bares. after this an item detector take a redstone signal out an the ticket will be printed.
that's the idea.
So this is my script until now. My Problem is that if i click on the monitor the ticket will imidently printed.
maybe you have some ideas?
shell.run("clear")
local mon = peripheral.wrap('monitor_3')
local station1 = "Neuss"
local station2 = "Duesseldorf"
local p = peripheral.wrap("back")
local choice = 0
function Rahmen()
term.setBackgroundColor(colors.blue)
term.setCursorPos(1,4)
mon.write ("Wohin solls gehen?")
term.setCursorPos(2,6)
mon.write ("Neuss")
term.setCursorPos(3,8)
mon.write("Duesseldorf")
end
function eingabe ()
while choice < 1 do
event,side,x,y =os.pullEvent()
if event == "monitor_touch" then
if x == 1 and y == 6 then
term.clear()
term.setCursorPos(1,1)
choice = choice + 1
mon.write("Bitte 2 Gold einwerfen")
while true do
os.pullEvent("redstone")
if rs.getInput("right") then
break
end
end
end
term.clear()
p.createTicket (station1)
mon.write ("Vielen Dank")
sleep(5)
term.clear()
end
if x == 1 and y == 8 then
choice = choice + 1
mon.write("Bitte 2 Gold einwerfen")
while true do
os.pullEvent("redstone")
if rs.getInput("right") then
break
end
end
term.clear()
p.createTicket (station2)
mon.write ("Vielen Dank")
sleep (5)
term.clear()
end
end
end
if choice == 1 then
choice = 0
end
while true do
Rahmen()
eingabe()
end