Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: yunhua98 on January 01, 2011, 09:49:28 pm

Title: How do you store to and read from Appvars?
Post by: yunhua98 on January 01, 2011, 09:49:28 pm
I really never made a game that needed a lot of data, but I'm trying now.  I need some help on storing to an appvar and reading from it.  Can someone give me example code to store a series of 10 ones and zeros. To an appvar and then display the numbers?
Title: Re: How do you store to and read from Appvars?
Post by: Munchor on January 01, 2011, 09:56:19 pm
http://ourl.ca/84305 (http://ourl.ca/84305)

Examine that code, it loads/reads from appvar, but also stores.

I'll edit this post later with the *exact* code that does it, also '|' is the token 2ND + 8 in the calculator. 'appvar'
Title: Re: How do you store to and read from Appvars?
Post by: yunhua98 on January 01, 2011, 09:58:58 pm
Could you copy and paste that and put it in this topic without code tags?  I'm on my iPod now and code tags dontwork.
Edit: actually, I want to be able to store digits in it and read out the individual digits. Like storing numbers in basic to a list  and doing L1(C)
Title: Re: How do you store to and read from Appvars?
Post by: Michael_Lee on January 02, 2011, 02:23:14 am
Basically --

"appvMYDATA"->Str1
Unarchive Str1
!If GetCalc(Str1)
Getcalc(Str1,10)->A
End
1->{A}

Attempts to unarchive the appvar MYDATA, then if it doesn't appear to exist, creates a 10 byte long appvar.  The pointer for that appvar is stored to the variable A -- use it like L1 (except smaller).
Title: Re: How do you store to and read from Appvars?
Post by: Fast Crash on January 02, 2011, 10:09:31 am
"appvNAME"->Str1
Unarchive Str1
!If getcalc(Str1)->A
Getcalc(Str1,10)->A
For(B,0,9)
0->{A+B}
End
End
Title: Re: How do you store to and read from Appvars?
Post by: Deep Toaster on January 02, 2011, 10:11:25 am
Plus another End in there somewhere, but that's pretty much it. Also nice job on the optimizing :)

EDIT: Fill(?

EDIT2: squidgetx.
Title: Re: How do you store to and read from Appvars?
Post by: Fast Crash on January 02, 2011, 10:12:26 am
Yes i forgot it :D .Fixed now
Title: Re: How do you store to and read from Appvars?
Post by: squidgetx on January 02, 2011, 10:17:16 am
"appvNAME"->Str1
UnArchive
!If GetCalc(Str1)->A
GetCalc(Str1,10)->A
0->{A}r
Fill(A,10)
End

After creating your appvar you can use its pointer that was created by GetCalc (A in this case) as a pointer to free RAM just like you would with L1-L6 (like Michael Lee said)
Title: Re: How do you store to and read from Appvars?
Post by: Fast Crash on January 02, 2011, 10:27:08 am
If it works it's a nice optimization :)