#### ## ## ## ============================================================= ## ### E N E R A T I N G ' S M A R T ' C O D E ## ## =============================================================== ## ## ##### Often in generating long ANSI screens with many colour changes, it is important to consider the time that the screen will take to display over the modem (especially at 2400 baud.) Programmes like BBS-DRAW will automatically generate 'smart' ANSI code which transmits in the least amount of time possible, but generating such code by hand takes a little bit of ingenuity on the part of the BBS artist. The first thing to bear in mind when generating 'smart' code is that any two (or more) ANSI codes which have the same command terminator may be combined into a single command. Example: To set the text to bright cyan and the background to violet on an ANSI screen, either enter ESC [ 1 m then ESC [ 36 m then ESC [ 45 m or enter ESC [ 1; 36 ; 45 m where the ; is the division character in the combined command, and the "m" is the common terminator of the three combined commands. As you can see, the second, 'optimised,' code contains four fewer characters than the first (those characters can add up after a while.) Another thing to consider in optimising your code is that colour, background, and text F/X changes remain in effect until they are removed in some way (by another change or by resetting to defaults.) So, if you wanted a whole passage of text to have a bright purple foreground but wanted to change backgrounds in the middle, it would only be necessary to enter something such as: ESC [ 1 ; 35 ; 43 m This is a test of the ESC [ 44 m Emergency Broadcast System. instead of entering ESC [ 1 ; 35 ; 43 m This is a test of the ESC [ 1 ; 35 ; 44 m Emergency Broadcast System However, if for some reason you wanted the text of "Emergency Broadcast System" to appear in dark purple instead of bright purple, you would need to specify a longer command: ESC [ 1 ; 35 ; 43 m This is a test of the ESC [ 0 ; 35 ; 44 m Emergency Broadcast System This is necessary since ESC [ 0 m not only turns off brightness but resets the colour and background as well. COMPLEX DICE ============ OK, let's take a quantum leap here. Let's say you wanted to clear the screen, jump down 14 lines, jump over 43 columns, change the text colour to dark red, change the background colour to yellow, and then make your machine quote Monty Python. CTRL-L clears the display ESC [ 14 B jumps down 14 lines ESC [ 43 C jumps over 43 lines ESC [ 7 ; 1 ; 33 ; 41 m the only way to use a bright colour as a background is through Reverse Mode type "I didn't expect a kind of Spanish Inquisition!" Next Section Table of Contents