Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: bilyp on November 24, 2011, 01:56:15 pm

Title: Storing levels to appvars
Post by: bilyp on November 24, 2011, 01:56:15 pm
Hi, I was wondering how you can store more than one byte of data to an appvar. Whatever i try, it can only store one byte, or just crashes my calc.
I want to store my level data:
Code: [Select]
:[000000000000]
:[000000000000]
:[000000000000]
:[000000000000]
:[220000000000]
:[112000000022]
:[331220002211]
:[333112221133]
:.And then there are 3 more of these, so 4 "screens" of data, 192 bytes total
:[011414] -> GDB1 .This is the  player data, so the first byte is the "screen" you are on, the next, the x value, and finally, the y value. 3 bytes total.
All of the map data is currently being absorbed into the main program, and accessed as {GDB1-(location in comparison to GDB1)}, which works fine. I don't want to have so much data taking up space in my program, and would rather have multiple worlds, etc, in external memory. (as appvars)

My question would be how to store  the full 195 bytes of data to an appvar, then read it back into GDB1, without affecting the format.
Thanks for your time.
Title: Re: Storing levels to appvars
Post by: Keoni29 on November 24, 2011, 03:24:58 pm
Code: [Select]
Getcalc(NAME)->H        //stores the pointer to the appvar in H
!If H                           //when the appvar does not exist
Getcalc(NAME,192)->H    //it creates the appvar. Size 192 chars
End
Copy(GDB1,H,192           //copies 192 bytes from GDB1 to your appvar
Title: Re: Storing levels to appvars
Post by: aeTIos on November 25, 2011, 02:43:36 am
You cannot read back into GDB1. You have to read it back either from your appvar of copy()ing it to a list.