Autoscroll text-area for Print
Monkey Targets Forums/HTML5/Autoscroll text-area for Print
| ||
If you are like me and use the Print command as a debugging tool you might like to add this to your monkey lang.js:game_console.scrollTop = game_console.scrollHeight - game_console.clientHeight; So the print function now looks like this: modules/monkey/native/lang.js function print( str ){ if( game_console ){ game_console.value+=str+"\n"; game_console.scrollTop = game_console.scrollHeight - game_console.clientHeight; } if( window.console!=undefined ){ window.console.log( str ); } } Now when your have a lot of debug information, it will auto scroll the text area, so the last print statement is always visable. |
| ||
Ah! My saviour! I become mad scrolling manually the textarea to see what the hell happens! I miss a proper 'debug' file to check-out... Thank you very much! |
| ||
Wonderfully useful. Thanks. |
| ||
Yay thanks! Mark, could you add this officially please? :) |
| ||
Another option is you could just put the last print statement at the top of the text area so it doesnt have to scroll down:function print( str ){ if( game_console ){ game_console.value=str+"\n"+game_console.value; } if( window.console!=undefined ){ window.console.log( str ); } } But I think reading from top-to-bottom is more natural... |
| ||
thanks It took me a couple of minutes to find where to put it so Ill put the directory here: Monkey\modules\monkey\native |
| ||
lol - thats in the first post... maybe read the text as well as the code ;) So the print function now looks like this: modules/monkey/native/lang.js |
| ||
Yay thanks! Mark, could you add this officially please? :) Seconded, that's much better now! |
| ||
Hi, Added! |
| ||
thanks |
| ||
Added! Excellent! :) |
| ||
Cor!!!! Dabz |