Title: Timer Problems with key presses
Hello There pro's!
I've been working on this code this evening, and it seems to work, tho there is this small Problem
pastebin: http://pastebin.com/e9gH8QeV
Code:
local tid = 1 local delay = tonumber(tid) function speed() term.clear() term.setCursorPos(1,1) print("Delay is now: ".. delay) local event, key = os.pullEvent("key") if key == keys.up then tid = tid+1 elseif key == 208 then tid = tid-1 end end function timer() speed() rs.setOutput("back", true) sleep(0.3) rs.setOutput("back", false) sleep(delay) end repeat timer() until rs.getInput("left") return
What im seaching it for to do, is when ever arrow Up is pressed, it increases the delay, and when arrow down is pressed it shortens the delay, i've been looking around trying some fixes, but does't seem to help..
Any suggestion on what im doing wrong?
Regards Plazter
EDIT: This has been solved heres the link, if some one wants to use it
http://pastebin.com/1fuAu4wf
Thanks everyone who helped me OR tryed to help aswell
Thanks alot appreciate it!