home *** CD-ROM | disk | FTP | other *** search
- \\ Sample script to turn BOYAN into an Etch-a-Sketch!
-
- \\ This script is fairly advanced, demonstrating the following techniques:
- \\ 1. Cursor movement and screen control
- \\ 2. Saving the beeps & bells toggle for later restoring
- \\ 3. Reading and testing user input
- \\ 4. Separating a script into blocks: START, DRAW, and *WRAPUP
-
- |START
- \GL- \\ switch into 25-line mode (if now in 43-line mode)
- \KS \\ keep (store) the current screen contents
- \ST[ Welcome to BOYAN Etch-A-Sketch! ] \\ status message
- \SV3[%BB] \\ save current beeps&bells value in variable 3
- \BB- \\ turn beeps&bells off
- \KO[60] \\ set keyboard timeout to 60 seconds
- \GX[40] \GY[12] \\ start in the middle of the screen (40,12)
- \DM%XP,%YP[▒] \\ display a shaded block at cursor position
-
- |DRAW
- \DM1,24[<I>=up │ <J>=left │ <K>=right │ <M>=down │ <Esc>=exit ]
- \DM24[│ X-pos=%XP │ Y-pos=%YP ] \\ display status on line 1
- \KV1_[Your Etch-a-sketch command? ] \\ get char input from keybd
- \DM%XP,%YP[ ] \\ display a space at current x,y cursor posn
- \IV1+I[\RY[-1]] \\ move up if input="I"
- \IV1+J[\RX[-1]] \\ move left if input="J"
- \IV1+K[\RX[1]] \\ move right if input="K"
- \IV1+M[\RY[1]] \\ move down if input="M"
- \DM%XP,%YP[▒] \\ display a shaded block at cursor position
- \GB[DRAW] \\ loop back for more input!
-
- |*WRAPUP
- \RS \\ restore previous screen contents
- \IE+%V3,ON[\BB+] \\ turn beeps&bells back on if they were on before
- \ST[Etch-a-sketch completed!] \\ Status message