12 posts
Posted 20 January 2015 - 07:06 PM
Hey guys,
I try to close a program but when i use term.clear() and shell.exit() the terminal went to the last used Background color and i can´t enter a new command.
I try os.reboot but it is not what i want.
So, how can i close the program, set the terminal back to black and let it wait in the first line for a comand.
Edited on 20 January 2015 - 06:07 PM
3057 posts
Location
United States of America
Posted 20 January 2015 - 07:32 PM
term.setBackgroundColor( colors.black )
term.setCursorPos( 1, 1 )
12 posts
Posted 20 January 2015 - 08:16 PM
I already tried to use:
term.setBackgroundColor(32768)
term.setCursorPos(1,1)
term.clear()
shell.exit()
but then it is not possible to use commands and the ">" symbol isn't present.
355 posts
Location
Germany
Posted 20 January 2015 - 08:18 PM
but then it is not possible to use commands and the ">" symbol isn't present.
Thats rather odd I must say. Are you sure it exits the shell and continues to the shell?
12 posts
Posted 20 January 2015 - 08:25 PM
the monitor is cleared and black
no ">"
the program i write draw pixels over the complete monitor.
And when i use strg + t it says Goodbye and shut down, so yes: the program is closed!
Edited on 20 January 2015 - 07:32 PM
355 posts
Location
Germany
Posted 20 January 2015 - 08:33 PM
You may be crashing the computer in a way that it performs a panic shutdown. how does the texture look like, when you escape from the terminal gui?
12 posts
Posted 20 January 2015 - 08:35 PM
computerFrontOnAdvanced.png
(working texture)
355 posts
Location
Germany
Posted 20 January 2015 - 08:55 PM
And are you able to Ctrl-T (terminate) layers of applications underlying your program?
12 posts
Posted 20 January 2015 - 09:01 PM
seems that i found the reason: sell.exit doesn't close the infinite loop.
i replace the
term.setBackgroundColor(32768)
term.setCursorPos(1,1)
term.clear()
shell.exit()
with
break
and write
term.setBackgroundColor(32768)
term.setCursorPos(1,1)
term.clear()
at the end of the code.
Now it works.
Anyone know why shell.exit() don't close this?
Edited on 20 January 2015 - 08:02 PM
1426 posts
Location
Does anyone put something serious here?
Posted 20 January 2015 - 10:04 PM
I don't think Shell.exit doesn't exit your program, it exits the current shell. So when you exit your program, you've already quit the shell, so the computer shuts down.
7083 posts
Location
Tasmania (AU)
Posted 21 January 2015 - 01:24 AM
That's always been my understanding. Odd that
the wiki reckons it should only terminate the shell if the shell is the only thing running - how, in that instance, would you get the shell to
perform that call?
I think someone confused it with the exit() function available to the Lua command prompt. Hmm, does that one work within other scripts? I can't remember if I'd tested it… Surely I would've done. Only way I've found to make a script end at a specific point is to call error().
I'll play around with it a bit later.
Edit: Yeah the wiki was just plain wrong.
Fixed now.
And exit() is indeed only available to the Lua prompt. So the only way I'm aware of to terminate a script at a specific line remains as being to call error() (which, so long as you don't pass it any parameters, won't actually generate an on-screen error message - it'll just kill your script).
Edited on 22 January 2015 - 01:00 AM