Posted 05 July 2012 - 09:15 PM
Hi all,
I've been messing around with keystrokes and cant figure a problem out.
What i wanna do is have a program standardly print out:
>YES<NO
and when the enter is pressed it executes a step or if the user right arrow button is pressed it changes to:
YES>NO<
and if enter is pressed at that stage the program is ended/cancelled
My code is:
a = >YES<NO
b = YES>NO<
local sEvent, param = os.pullEvent("key")
if (sEvent == "key") then
if(param == 205) then
print( b )
if (sEvent == "key") then
if(param == 28) then
shell.run("startup")
else
if (sEvent == "key") then
if(param == 203) then
print(a)
then
if (sEvent == "key") then
if(param == 28) then
function frame()
end
end
end
end
So thats it. I wanna make it so that the program wont effectively end and it can change between the Variable A or B until enter is pressed. Would a loop work? If so how? and then how would i have it so that Variable A is shown standardly and the print for variable will change in the same position where the previous text was if a key stroke is pressed?
Any help is most appreciated:P
Thanks!
I've been messing around with keystrokes and cant figure a problem out.
What i wanna do is have a program standardly print out:
>YES<NO
and when the enter is pressed it executes a step or if the user right arrow button is pressed it changes to:
YES>NO<
and if enter is pressed at that stage the program is ended/cancelled
My code is:
a = >YES<NO
b = YES>NO<
local sEvent, param = os.pullEvent("key")
if (sEvent == "key") then
if(param == 205) then
print( b )
if (sEvent == "key") then
if(param == 28) then
shell.run("startup")
else
if (sEvent == "key") then
if(param == 203) then
print(a)
then
if (sEvent == "key") then
if(param == 28) then
function frame()
end
end
end
end
So thats it. I wanna make it so that the program wont effectively end and it can change between the Variable A or B until enter is pressed. Would a loop work? If so how? and then how would i have it so that Variable A is shown standardly and the print for variable will change in the same position where the previous text was if a key stroke is pressed?
Any help is most appreciated:P
Thanks!