Dumb Term

This was a little javascript doohickey I made a few years ago. I’m still pretty proud of it.

terminal simulator

What’s cool is that this was written to support Netscape and IE 4.0 and it still works in Firefox! The problem is that modern browsers have put a bunch of blocks on Javascript opening new windows, so it loses some of it’s cool factor since it can’t open windows on demand.

Technical blurb:
This terminal simulator doesn’t use any flash or server side logic. It creates a 40×15 array of images and flips the based on control scripts. The “script” for the intro page looks like this:

var script = new Array(
"FOCUS[]"
,"SETCOOKIE[\"textcolor\",\"CCFFFF\"]"
,"KEYS[\"on\"]"
,"EVENT[\"KEY\",\"\",\"cl0,cl6,skip\"]"
,"EVENT[\"CLICK\",-1,\"cl0,cl6,skip\"]"
,"CURSORTO[0,0]"
,"ECHO[\"booting...\"]"
,"WAIT[1000]"
,"CLLINE[0]"
,"FOCUS[]"
,"WINDOWTO[400,300,0,0]"
,"CURSORTO[20,6]"
,"WAIT[3000]"
,"CENTER[\"shall we play a game?\",1]"
,"WAIT[2000]"
,"CLLINE[6]"
,"CENTER[\"Let's play Global Thermonuclear War.\",1]"
,"WAIT[2000]"
,"CLLINE[6]"
,"CENTER[\"fine.\",1]"
,"WAIT[2000]"
,"CLLINE[6]"
,"COLOR[\"FF0000\"]"
,"SETCOOKIE[\"textcolor\",\"FF0000\"]"
,"LOADSCRIPT[\"scripts/menu.html\",1]"
);

This array is loaded by a parser and execute from the top down. Scripts can also do stuff like insert additional lines into the array, like the ECHO command actually inserts a bunch of single character prints. CENTER actually inserts a cursor move command to get the string centered.

All in all this is one of the coolest things I ever wrote.