Posted 29 March 2013 - 01:45 PM
This is a function to make the turtle select a slot using the arrows / wasd keys. At one point I had every button as a separate elseif, earlier today I made all the buttons that did the same thing into the same elseif. Now, with this code, every button (even the ones that aren't defined) make the slot move up one….
the elseif to or change I did was with the last one, and I got that to work. but after I moved the rest to that system, everything did the same thing. it's probably pretty obvious what is the problem, but, let's just say I need some sleep lol.
(i don't know how to do spoiler so the following spoiler attempt is a guess :)/> )
movementdisplay() just shows a display, they shouldn't really effect my problem.
Thanks! :D/>
the elseif to or change I did was with the last one, and I got that to work. but after I moved the rest to that system, everything did the same thing. it's probably pretty obvious what is the problem, but, let's just say I need some sleep lol.
(i don't know how to do spoiler so the following spoiler attempt is a guess :)/> )
Spoiler
infoget and lastbutton you can think of as print()movementdisplay() just shows a display, they shouldn't really effect my problem.
local function slotselection()
infoget = "Select a slot with arrows"
movementdisplay()
x = 1
turtle.select(x)
while true do
event, pl = os.pullEvent("key")
if pl == 200 or 17 then
x=x-4
if x<1 then
x=x+16
end
lastbutton = "am selecting slot "..x
movementdisplay()
turtle.select(x)
elseif pl == 203 or 30 then
x=x-1
if x<1 then
x=x+16
end
lastbutton = "am selecting slot "..x
movementdisplay()
turtle.select(x)
elseif pl == 208 or 31 then
x=x+4
if x>16 then
x=x-16
end
lastbutton = "am selecting slot "..x
movementdisplay()
turtle.select(x)
elseif pl == 205 or 32 then
x=x+1
if x>16 then
x=x-16
end
lastbutton = "am selecting slot "..x
movementdisplay()
turtle.select(x)
elseif pl == 28 or 13 then
lastbutton = "selected slot "..x
movementdisplay()
sleep(.01)
shell.dir()
break
end
end
end
Thanks! :D/>