24 posts
Posted 14 July 2012 - 03:07 AM
So I have a ifelse statement. What I want is at the end of all the code for the text to blink and say press and button to return and it will return to the menu. Any simple ways to do this?
Also off topic, how would I make a function that overrides what I was doing?
1604 posts
Posted 14 July 2012 - 03:13 AM
Any more details? What's your current code?
I don't really understand what you want.
24 posts
Posted 14 July 2012 - 03:16 AM
Yeah, that was written rather quickly. Let me paste some code.
if p == "1" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Loading Mainframes...")
sleep(3)
print()
textutils.slowPrint("Loading Subsystems...")
sleep(2)
print()
textutils.slowPrint("Starting Cooling Systems...")
sleep(2)
bOut = colors.combine(bOut, colors.brown)
rs.setBundledOutput("bottom", bOut)
sleep(2)
print()
textutils.slowPrint("Starting Reactor...")
sleep(2)
bOut = colors.combine(bOut, colors.lightBlue)
rs.setBundledOutput("bottom", bOut)
sleep(2)
print()
textutils.slowPrint("Reactor Successfully Started")
return
So this is one of my if statements. What I want is for at the end where return is. I want it to say "Press Any Button To Return". If theres a simple way to make it blink that would be cool to but not required. So that will appear and when any button is pressed it will return to the menu just as the normal return would.
864 posts
Location
Sometime.
Posted 14 July 2012 - 06:30 AM
if p == "1" then
term.clear()
term.setCursorPos(1,1)
textutils.slowPrint("Loading Mainframes...")
sleep(3)
print()
textutils.slowPrint("Loading Subsystems...")
sleep(2)
print()
textutils.slowPrint("Starting Cooling Systems...")
sleep(2)
bOut = colors.combine(bOut, colors.brown)
rs.setBundledOutput("bottom", bOut)
sleep(2)
print()
textutils.slowPrint("Starting Reactor...")
sleep(2)
bOut = colors.combine(bOut, colors.lightBlue)
rs.setBundledOutput("bottom", bOut)
sleep(2)
print()
textutils.slowPrint("Reactor Successfully Started")
textutils.slowPrint("Press and button to return")
event, key = os.pullEvent(10) -- Timeout
if event == "key" then
return()
else
-- WHATEVER YOU WANT HERE TO DO IF TIMEOUT SUCCEEDS
end
end
That's the basic
Where it has return()
Make a function called return
Then have it go back to where it was.
If it was a loop to go back to beginning then just (simple way) put all your code in a function and make the return() that function (
return() main())
1604 posts
Posted 14 July 2012 - 07:08 PM
Ok, now some code that will actually work:
local function someMenu()
-- some menu code here
if someCondition then
print("Press any key to continue")
os.pullEvent("key")
return
end
end