Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: aeTIos on October 02, 2010, 07:07:08 am

Title: how to make an appvar????
Post by: aeTIos on October 02, 2010, 07:07:08 am
hi
im currently programming an chemistry program and I was wondering how to make an appvar.
does anyone know how to do this???
it would help me out a lot
Title: Re: how to make an appvar????
Post by: Michael_Lee on October 02, 2010, 10:14:01 am
Hi!
Like this:


.TEST
"appvMY1STAPP"->Str1             The 'appv' at the front can be found by pressing [2ND] then 8.  
                                 Your appvar has to be a maximum of 8 characters long, and can include lowercase and numbers (I think?)

!If GetCalc(Str1)                This '!If' statement checks to see if your appvar already exists - if it doesn't, then GetCalc(Str1) will return 0.
GetCalc(Str1,16)->Z              This creates an appvar with a length of 16.  Note: if the appvar already exists, it'll delete it and replace it with the new one.
                                 Variable 'Z' is now a pointer to your appvar.
End

1->{Z}                           This stores 1 to the first byte of your appvar.  Think of it as {Z+0}.  A sixteen byte appvar will run from 0 to 15 (16 numbers total)
999->{Z+14}r                     This stores 999 to the last two bytes of your appvar - bytes 14 and 15.





I hope this helps!

Edit: Modified for clarity
Title: Re: how to make an appvar????
Post by: aeTIos on October 05, 2010, 03:51:37 am
thanks very much, it helped me out a lot
btw, your game is awesome!
Title: Re: how to make an appvar????
Post by: Quigibo on October 05, 2010, 04:40:20 am
The only problem with that statement is this part:

!If GetCalc(Str1)
GetCalc(Str1,16)->Z

End


You should change it to this:

!If GetCalc(Str1)->Z
GetCalc(Str1,16)->Z
<Code for new appvar>
End


Most importantly is the ->Z after the first GetCalc().  Now in the case that the appvar IS found, Z points to it.  And of course when it is not found, it is created so Z always points to the data.  The other thing to keep in mind is that you might want to have some special code to take care of what happens when the appvar is created for the first time.  Usually, this involves filling in some default values to the appvar or maybe prompting the user for some input on how to format it or something.
Title: Re: how to make an appvar????
Post by: Aichi on October 05, 2010, 06:21:57 am
Is it possible to sort 16bit numbers in an Appvar?
I tried this for example:
Code: [Select]
"appvTEST"→Str1
 Getcalc(Str1, 6)→A
4000→{A}r
2000→{A+2}r
5000→{A+4}r
SortA({A}r,6)→A
It didnt work, so I wrote an own Sorting Routine.
Regards,
Aichi
Title: Re: how to make an appvar????
Post by: Runer112 on October 05, 2010, 10:06:14 am
It probably doesn't work because, as of now, there's only a SortD() command ;)
Title: Re: how to make an appvar????
Post by: Aichi on October 05, 2010, 10:17:48 am
@ Runer
It doesnt work too, if I use SortD.
Title: Re: how to make an appvar????
Post by: LordConiupiter on October 05, 2010, 10:25:03 am
I think you don't have to store the return value of SortD to A, since it doesn't return anything usefull :P
its also a single byte command, so it doesn't sort double-byte numbers.
this should work:

Code: [Select]
GetCalc("appvTEST",4)->A    .Don't forget to create an AppVar that doesn't exist by parsing the size as second parameter
40->{A}                     .All single bytes, no words
10->{A+1}
20->{A+2}
50->{A+3}
SortD(A,4)
For(I,0,3
Output(0,I,{A+I}>Dec        .Output all the values
End

EDIT: I tested it, and it works!
Title: Re: how to make an appvar????
Post by: Aichi on October 05, 2010, 11:03:08 am
SortD is just able by using 8 Bit values? What a bummer.
I will still use my sorting routine.
Title: Re: how to make an appvar????
Post by: DJ Omnimaga on October 05, 2010, 02:07:47 pm
SortD(A,4)r sounds like it would be a nice feature addition, I think. It could sort 2 byte numbers.

Also offtopic note about your signature, you really should make frequent backups (not just Axe backup feature, but copying the files on your computer) every 30 minutes during programming, so if your project gets hit by a memory clear, you don't lose most of your code.
Title: Re: how to make an appvar????
Post by: Aichi on October 05, 2010, 03:41:28 pm
@ DJ

Yes, sorting word values would be a nice improvement.

-

My own laptop is broken at the moment and I cant be often on a PC (Most time online in wii browser, Omnimaga has some strange graphic bugs there by the way. :D). Im going write the lost part again and realease v0.1b here as soon as I can.
Title: Re: how to make an appvar????
Post by: DJ Omnimaga on October 05, 2010, 03:45:21 pm
Ah I see x.x, well nothing I can do about Wii browsing since it means the browse is not up to web standards, then (like Opera and Firefox for Windows and maybe Chrome)