Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: V1mes on December 14, 2012, 11:49:05 am

Title: Text
Post by: V1mes on December 14, 2012, 11:49:05 am
Hi!

For AxeRL I'd like to make a log, that is, hit messages and level feeling messages etc. are all stored to a buffer so the player can go back and re-read them....
I'd like to be able to add strings and so on... and also to put text into a temp buffer to display in-game too.
Any advice?
Title: Re: Text
Post by: Xeda112358 on December 14, 2012, 11:54:31 am
I would try to store the message in such a way that a number corresponds to a certain word or expression so that the save file size is much smaller. This will also help with concatenation of strings, too. For example, if Str1 points to a list of pointers of words/expressions, to concatenate "the" and "game" you would just need to put the two numbers next to each other in the text file.

I am not sure of a good method in Axe to resize buffers or variables, though.
Title: Re: Text
Post by: V1mes on December 14, 2012, 12:03:20 pm
Hmmm the log would never be saved, it would get too large!  ;D
Do you mean like
Code: [Select]
"The"[00]->Str1
"game"[00]
etc...
Title: Re: Text
Post by: Xeda112358 on December 14, 2012, 12:17:32 pm
Yes, that is what I mean :)
Code: [Select]
"The"→Str1
"game"→Str2
"is"→Str3
"lost"→Str4
...
Data(Str1^r,Str2^r,Str3^r,Str4^r,...→GDB1
Then, if your log looked like 0102030400 (to end the message, I am using 00) and was stored in L3:
Code: [Select]
L3→A
Text(0
While {A++}
Text {*2+GDB1-2}ʳ,' '▸Char
End
Text '.'▸Char
That will display the string at (0,0).

EDIT: Edited some syntax as per Jacobly insistence XD
EDIT2: I didn't know that 'Text ' is different from Text( >.>
Title: Re: Text
Post by: Matrefeytontias on December 14, 2012, 12:59:07 pm
You can also use the StdDev(pointer_to_zero_terminated_strings, offset) command with that. It'll work fine.
Title: Re: Text
Post by: V1mes on December 14, 2012, 01:01:46 pm
? Never seen that command before... Whoops! ;D
Title: Re: Text
Post by: DrDnar on December 14, 2012, 01:51:43 pm
It's a wonderful way to handle strings, as long as you have fewer than 256 of them. The assembly code for returning the string given its index is beautifully simple.
Title: Re: Text
Post by: V1mes on December 14, 2012, 01:54:02 pm
And it is...