Page 1 of 1

clear the screen

Posted: Thu Apr 30, 2015 7:28 pm
by RayB
1 - Is there any way to clear the preview screen using script as opposed to the CLR button once you have printed to it with the 'print()' command?

Re: clear the screen

Posted: Thu Apr 30, 2015 8:52 pm
by minmay
Just type

Code: Select all

clear
in the console and press enter.

Re: clear the screen

Posted: Sun May 03, 2015 2:30 am
by RayB
Thank you but I was referring to the script itself. If I am in the dungeon maker I don't have the council unless I press F12 and then type clear and then press F12 again to get rid of the council input. If I am going to do all that I might just as well press the CLR button. What I am trying to do is clear the screen with a line of script in my code. I have created a small section of tiles and code on Level 1. I can place an item in a particular tile (I use 0,0), place my start position arrow in another (non-game) area of 3 tiles with buttons on the wall and then hit run. When one of the buttons is pressed the code will look at the item in 0,0 then look at all the levels in the dungeon and tell me how many of that item I have on each level. Another of the buttons will allow me to select a particular level and the third button will tell me what tiles contain the items on that level (ie. 1 at 5,19 - 2 at 6,24 etc.). In cases where there are a lot of items it would be nice to be able to clear the screen with the code at certain intervals because of the 15 lines of print limitation.

Re: clear the screen

Posted: Sun May 03, 2015 3:44 am
by minmay
Well, you can't actually clear the console from within a script that I know of, but you can get rid of existing lines with

Code: Select all

for i=1,20 do print("") end

Re: clear the screen

Posted: Sun May 03, 2015 6:42 am
by Isaac
You could add that to a general utility script as a function, and call it from any other script_entity.

Ut.script:cls()

Re: clear the screen

Posted: Wed May 06, 2015 5:23 pm
by RayB
Thanks but I was already aware of that method. On my system, after 15 lines, the screen scrolls so line 16 is printed on line 15 and line 1 disappears. After using the loop the screen does clear but all succeeding lines are printed on line 15 rather then starting at the top.

Re: clear the screen

Posted: Wed May 06, 2015 10:12 pm
by Isaac
RayB wrote:Thanks but I was already aware of that method. On my system, after 15 lines, the screen scrolls so line 16 is printed on line 15 and line 1 disappears. After using the loop the screen does clear but all succeeding lines are printed on line 15 rather then starting at the top.
Clear screen relies on the os.execute(), and it's not present in LoG2; aside from that it obviously works via the button. So Petri would have to either mention his secret to this, or add a clear() function.

Re: clear the screen

Posted: Wed May 06, 2015 10:31 pm
by minmay
Well, clearing an ingame monitor doesn't necessarily require os.execute(), since it's totally contained within the game, and I assume it's what the OP wanted. There's no way to do it in Grimrock as a user other than typing "clear" though.

Re: clear the screen

Posted: Wed May 06, 2015 10:46 pm
by Isaac
*I would bet that there is some printed escape sequence that will clear the screen, but I haven't found it yet.

Re: clear the screen

Posted: Thu May 07, 2015 1:22 am
by minmay
Nope, just tried with all 256 characters. None clear the screen.