I made a TI-BASIC terminal-style scheme for input and input processing.
![](http://i.imgur.com/ekfmqhl.gif)
The input is already all taken care of. You can input letters, spaces, and numbers (I might revamp this, because on hindsight, I might not need numbers except for special cases). What I think is innovative about this is the scrolling and input processing.
The scrolling works like this: Str9 contains each line, with a boxplot character at the end (basically, any character I'm sure won't appear in the string), and L1 contains the x-positions of the text. Each are shifted as a new line is added, and the screen is redrawn.
The input processing is a little more clever: Str1 is stripped of extraneous spaces, and separated by keyword. If a keyword is found, a code (unique for each keyword) is added to Str2. Then, Str2 is searched for each combination of keywords that do commands, and then that command is done.
To add a keyword:
In CPROCESS, there are lines that go like this:
sub(Str1,A,Ans-A
{Ans="QUIT" or Ans="EXIT" or Ans="DONE" or Ans="BYE" or Ans="GOODBYE" or Ans="CYA",Ans="TEST" or Ans="TESTING",Ans="HI" or Ans="HELLO" or Ans="HEY" or Ans="HEYA" or Ans="HIYA" or Ans="YO",Ans="WHAT" or Ans="WHATS" or Ans="WHATZ" or Ans="WTF" or Ans="WOT" or Ans="WOTS" or Ans="WOTZ" or Ans="WAT" or Ans="WATS" or Ans="WATZ" or Ans="WUT" or Ans="WUTS" or Ans="WUTZ",Ans="UP",Ans="WASSUP" or Ans="WAZZUP" or Ans="SUP",Ans="HOW",Ans="ARE" or Ans="R",Ans="YOU" or Ans="YA" or Ans="U",Ans="WHO",Ans="YOUR" or Ans="UR" or Ans="YUR",Ans="NAME" or Ans="NAEM",Ans="CALLED" or Ans="CALLD",Ans="SMART",Ans="REAL",Ans="MALE" or Ans="MAN" or Ans="BOY" or Ans="DUDE",Ans="FEMALE" or Ans="WOMAN" or Ans="GIRL" or Ans="LADY",Ans="GENDER" or Ans="SEX",Ans="STUPID" or Ans="DUMB" or Ans="IDIOT" or Ans="MORON"
If max(Ans
Str2+sub("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZθ",1+sum(not(cumSum(Ans))),1âStr2
First, make sure there are enough characters in the giant string in the bottom. Add some if necessary.
In the expression in the second line, add a piecewise expression with the number of the keyword and the keyword itself like this:
Ans="KEYWORD",
The Nth character in that giant string in the bottom is the corresponding character for your keyword, so remember it.
Note: multiple words can be assigned to one code, but one code cannot match more than one word.
To add a command:
Commands are strings of keyword codes. For example, in the example program, "398C" represents "WHAT ARE YOU CALLED".
In CCOMMAND, add a section like this:
If inString(Str2,"command
Then
command code goes here
Goto E
End
To output a line of text, do this:
"OUTPUTâStr1
XPOSâLâ(9:IS_NEWLINEâLâ(10
prgmCSCROLL
OUTPUT is your output line, XPOS is the X-position of the line, and IS_NEWLINE is 0 if this line overwrites the last line, and 1 if it scrolls up.
Questions? Ask me, and I'll try to clarify. Keep in mind, however, this may not be bug-free or optimized fully. If anyone is willing to help, that would be swell.
Download attached.