Join us on Discord!
You can help CodeWalrus stay online by donating here.

TI-BASIC terminal

Started by JWinslow23, November 11, 2016, 10:24:35 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JWinslow23

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:
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.

xMarminq_

  • Calculators owned: Ti-84 Plus CE, Ti-84 Plus (can be borrowed from my school)
I don't associate with associations

p2

there's a Axe command to "move" the screen content upwards (what's off the upper border is shown on the buttom) which is affecting the entire calc (not just the graphics screen).
it should be possible in HEx, too, o you could implement it.
I think it sohould be faster than your current scrolling :)

But I'm really surprised how well your program works :)  :thumbsup:
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CAS, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

JWinslow23

Quote from: p2 on November 14, 2016, 10:17:23 AM
there's a Axe command to "move" the screen content upwards (what's off the upper border is shown on the buttom) which is affecting the entire calc (not just the graphics screen).
it should be possible in HEx, too, o you could implement it.
I think it sohould be faster than your current scrolling :)

But I'm really surprised how well your program works :)  :thumbsup:
This is a TI-BASIC proof of concept; obviously Asm/Axe would be more capable ;) (I think the command you're referencing would be ZInterval? Not quite what I'd want, but good to know) . In fact, if this were entirely in Axe, all the better! The one problem is that string processing would be a bit more involved, because the language is low-level when it comes to any data processing. Who knows, though? If that's code-able, you could see CALSPEAK grace a full-fledged Asm program!

Thank you, by the way. I appreciate it!

Dream of Omnimaga

So this is kinda like a chat bot? I kinda like it so far considering it's TI-BASIC. It looks nice too.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Snektron

Looks pretty cool :) nice work

Quote from: JWinslow23 on November 14, 2016, 11:02:11 PM
Quote from: p2 on November 14, 2016, 10:17:23 AM
there's a Axe command to "move" the screen content upwards (what's off the upper border is shown on the buttom) which is affecting the entire calc (not just the graphics screen).
it should be possible in HEx, too, o you could implement it.
I think it sohould be faster than your current scrolling :)

But I'm really surprised how well your program works :)  :thumbsup:
This is a TI-BASIC proof of concept; obviously Asm/Axe would be more capable ;) (I think the command you're referencing would be ZInterval? Not quite what I'd want, but good to know) . In fact, if this were entirely in Axe, all the better! The one problem is that string processing would be a bit more involved, because the language is low-level when it comes to any data processing. Who knows, though? If that's code-able, you could see CALSPEAK grace a full-fledged Asm program!

Thank you, by the way. I appreciate it!
String processing is definitely capable in assembly, but it does require some work. Most functions are pretty trivial though (you could for examples take a look at KnightOS's string functions ;))
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


JWinslow23

#6
Oh right, forgot to upload my latest version.

Latest version up there. It demonstrates the capabilities of this engine with a chatbot named "CALSpeak".
Basically, CALSpeak is a chabot using the Terminal engine that has answers to a few select phrases (and I'll update it to have some more, too). As it stands, it can give you a greeting, tell you what's up, tell you how it is, tell you its name, tell you its gender, tell you its intelligence, and reflect on its state of reality.

I have a screenshot right here.


Perhaps someone can use this for a text adventure? That would certainly be welcome.

Dream of Omnimaga

Cool, I'm definitively giving it a try when I get a chance. Is it me, though, or is text typing slow? I have the feeling that that part could probably be improved, but I'm unsure.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Powered by EzPortal