5 posts
Posted 12 September 2015 - 09:33 PM
Ive created server that writes logs and i cant scroll up or down
how can i make a code that allows me to scroll though print()'s?
like term.scroll() but without erase print() texts
Edited on 13 September 2015 - 10:06 AM
3057 posts
Location
United States of America
Posted 13 September 2015 - 12:21 AM
Just put it in a file and use the default 'edit' program. It's easier than (essentially) rewriting the edit program.
5 posts
Posted 13 September 2015 - 12:06 PM
Just put it in a file and use the default 'edit' program. It's easier than (essentially) rewriting the edit program.
I want to able to scroll up/down though print() inside script
I tryed to place edit's scroll up/down and its not working.
How can i term.scroll() without delete print()'s.
779 posts
Location
Kerbin
Posted 20 September 2015 - 08:06 AM
Just put it in a file and use the default 'edit' program. It's easier than (essentially) rewriting the edit program.
I want to able to scroll up/down though print() inside script
I tryed to place edit's scroll up/down and its not working.
How can i term.scroll() without delete print()'s.
Instead of printing logs save them in a table. If you want to draw the contents:
for i=scroll, scroll+height do
print(tbl[i])
end
Where height is the term's height, scroll is a number which is changed while scrolling and tbl is the table containing lines.
599 posts
Location
LeLua
Posted 20 September 2015 - 09:11 AM
And the print function is not the case:
for i=1, #textTable do
term.setTextColor(colors.orange)
term.setCursorPos(1, i+scrollPoint-1)
term.write(textTable[i])
end
779 posts
Location
Kerbin
Posted 20 September 2015 - 03:30 PM
And the print function is not the case:
for i=1, #textTable do
term.setTextColor(colors.orange)
term.setCursorPos(1, i+scrollPoint-1)
term.write(textTable[i])
end
Your code will work too, but mine will only show from scroll to scroll+height -> only displaying 19 lines on computers, while yours is drawing everything, which is slower and it will cause flickering. (Mine will probably flicker too, i didnt tested it)
599 posts
Location
LeLua
Posted 20 September 2015 - 03:36 PM
Well if you wan't to display only on the screen, use the code below:
scrollPoint=scrollPoint-event[2]
if scrollPoint>#text-1 then
scrollPoint=#text
end
if scrollPoint>1 then
scrollPoint=1
end
if scrollPoint+#text<19 then
scrollPoint=scrollPoint+1
end
EDIT: And "print" has its own string history and it will do weird stuff if you use it.
Edited on 20 September 2015 - 01:38 PM