I made a TI-BASIC terminal-style scheme for input and input processing.



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:

Code:
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:
[tt]Ans="KEYWORD",[/tt]
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:

Code:
If inString(Str2,"command
Then
command code goes here
Goto E
End

To output a line of text, do this:

Code:
"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 here.
Dude, that's awesome! I might want to call to your attention that there is another major project going on who's primary program is named prgmCALCTALK though... Razz

I must say, the input and scrolling is very innovative. Nice job. Good Idea
Kydapoot wrote:
Dude, that's awesome! I might want to call to your attention that there is another major project going on who's primary program is named prgmCALCTALK though... Razz

I must say, the input and scrolling is very innovative. Nice job. Good Idea

This was that "84+ version" I was talking about, actually. In that same thread. I'll change the name to whatever, but the engine could be used for anything. Even a primitive text adventure. Even a Siri clone that only does the snarky jokes and easter eggs.
JWinslow23 wrote:
This was that "84+ version" I was talking about, actually. In that same thread.
Ahhhhhhh of course.

JWinslow23 wrote:
snarky jokes and easter eggs.
I would be glad to contribute a few snarky jokes! Very Happy Mine has a few itself already!
Cool thing you could do is have an asm subprogram that can modify the CPROCESS program, then make a command to add a command (aka creates the code, stores it to a string and inserts it where necessary in the right programs) That would be pretty meta, but would make adding commands really simple...
Also, why not use a list Razz

Code:
(Ans="TEST")+(Ans="TESTING")+2(Ans="PING")+3(Ans="MAKE")+4(Ans="SANDWICH")+5(Ans="SUDO")+6(Ans="FLIP")+7(Ans="COIN")

{Ans="TEST" or Ans="TESTING",Ans="PING",Ans="MAKE",Ans="SANDWICH",Ans="SUDO",Ans="FLIP",Ans="COIN
sum(Ans{cumsum(binomcdf(6,0

This isn't quite the same, but you get the idea...
EDIT: Like you said, some keywords have the same value, so you just replace the comma betweeen them with an "or" Wink I changed the code.
This project is awesome! I will be definitely be going through your code and look at how you created custom commands.
The only question I have is why you built scrolling and typing engines when the Homescreen does that automatically. The only real benefit to what you did that I can see is that you have more lines visible than what would be visible on the home screen. But I feel that you are sacrificing too much speed for that one benefit, unless there is something else I am missing.
mr womp womp wrote:
Cool thing you could do is have an asm subprogram that can modify the CPROCESS program, then make a command to add a command (aka creates the code, stores it to a string and inserts it where necessary in the right programs) That would be pretty meta, but would make adding commands really simple...

I suppose, if you did something like that with assembly, you wouldn't need this TI-BASIC program Razz . But yeah, it would be cool.

But remember, a keyword and command are different. A keyword is one word the parser sees as significant. Commands are groups of words. It probably would be hard to write code for new commands. However, what is important that the right values are stored before text is written to the output.

EDIT: Oh, perhaps the list thing would work. But remember, some "keywords" can be represented with more than one word. For example, "TEST" and "TESTING" all have the value of 1.
CHill wrote:
This project is awesome! I will be definitely be going through your code and look at how you created custom commands.
The only question I have is why you built scrolling and typing engines when the Homescreen does that automatically. The only real benefit to what you did that I can see is that you have more lines visible than what would be visible on the home screen. But I feel that you are sacrificing too much speed for that one benefit, unless there is something else I am missing.

I did that for a few reasons:

1. Because Input sucks as a way to actually input.
2. Because the graph screen allows for wider text and more lines, which in turn allows more to be displayed on the screen in general.
3. Because figuring out how to make scrolling text was a good exercise, even with this convenient layout. Plus, it allows for a top and bottom bar to be intact, so that's cool.
4. Because you can make the graph screen look like whatever kind of aesthetic you want, if you so choose. For example, reduce the number of displayed lines, or the width of the lines, and the extra space becomes a scene you could draw for a text adventure! The homescreen just looks like the homescreen.
5. Because I wanted to, okay? Razz

And the commands are basically keyword codes in order. Add some stuff to the keyword codes, and then add a corresponding command (arrangement of keyword codes), and code exactly what it does and outputs, and you've got yourself a new command in the terminal program.

In fact, if there is some simple text adventure I can find, I'll port it with this engine to demonstrate the capabilities.
JWinslow23 wrote:
1. Because Input sucks as a way to actually input.

Just curious, but why? You can type letters, numbers, symbols, and anything in the catalog and most of the menus.
Kydapoot wrote:
JWinslow23 wrote:
1. Because Input sucks as a way to actually input.

Just curious, but why? You can type letters, numbers, symbols, and anything in the catalog and most of the menus.

1. I just want letters, numbers, and spaces. No way to ensure this with Input.
2. Input is limited to the home screen. I wanted it on the graph screen.
3. If you press CLEAR during Input, the screen is cleared. That's bad behavior if you want to know what you have to input.
4. If you press 2ND+QUIT during Input, the program is immediately stopped at that point. Unless you have DCS, in which case sometimes it safeguards, and other times who knows what happens.

I have my reasons. Razz
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement