Author Topic: Storing levels to appvars  (Read 2360 times)

0 Members and 1 Guest are viewing this topic.

Offline bilyp

  • LV2 Member (Next: 40)
  • **
  • Posts: 21
  • Rating: +9/-1
  • Axing the z80
    • View Profile
Storing levels to appvars
« 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.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Storing levels to appvars
« Reply #1 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
If you like my work: why not give me an internet?








Offline aeTIos

  • Nonbinary computing specialist
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3915
  • Rating: +184/-32
    • View Profile
    • wank.party
Re: Storing levels to appvars
« Reply #2 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.
I'm not a nerd but I pretend: