Hello Cemetech Users. I was wondering what you can do with an appvar in ICE, which things you can store in one and how many. For example, in Geometry Dash a whole level was stored in an appvar. Until now I have only stored lists in an appvar, but I would be interested in what you can use an appvar for. Graphing Calculator
Anything you want. Appvars can be up to 64KiB in size each.
Wait, wait, wait. Does this mean that you can even store whole programs in an appvar? Confused
Yes.
It's literally like any other file. Keep whatever raw data you want in there in whatever format you want, even in your own formats.
Wow, okay. Can I also store a list and a string in the same appvar?
Sure. You can store any arbitrary data in whatever format you want.
Like I said, any binary data. There is no distinction between lists and strings with appvars, it just depends on how you read and write.
MateoConLechuga wrote:
Sure. You can store any arbitrary data in whatever format you want.

And how would I do that. Sorry for all the asking, I just think it's cool. I now have a lot of ideas about games that I might still be able to program.
Take a look at the ICE documentation here under the File I/O section

https://htmlpreview.github.io/?https://github.com/PeterTillema/ICE/blob/master/documentation/commands.html#fileioc
The big problem is that I'm German and I don't understand most of the documentation and don't find what I'm looking for. For example, I don't understand what Offset and Origin are for sum(10,OFFSET,ORIGIN,SLOT) and unfortunately this is not explained in the documentation.
The File I/O API in ICE is very similar to that in C.

Link Here to fseek (C) documentation
In general, the term “origin” in this context typically means a starting position, while “offset” is a distance forward or backward from that starting position at which to perform an operation.
I have one more question. How can I store a list and a string in the same appvar and how can I retrieve them? If that's even possible? Because I imagine Appvars to be like a normal variable, it can only store one thing. In my case I want to store a list and a string in the appvar LEVEL. Is that possible?
Yan-Nick wrote:
I have one more question. How can I store a list and a string in the same appvar and how can I retrieve them? If that's even possible? Because I imagine Appvars to be like a normal variable, it can only store one thing. In my case I want to store a list and a string in the appvar LEVEL. Is that possible?


Yes, an Appvar is literally a sequence of bytes and can represent anything smaller than 65516 bytes.
beckadamtheinventor wrote:
Yan-Nick wrote:
I have one more question. How can I store a list and a string in the same appvar and how can I retrieve them? If that's even possible? Because I imagine Appvars to be like a normal variable, it can only store one thing. In my case I want to store a list and a string in the appvar LEVEL. Is that possible?


Yes, an Appvar is literally a sequence of bytes and can represent anything smaller than 65516 bytes.

How would I have to do that?
Yan-Nick wrote:
beckadamtheinventor wrote:
Yan-Nick wrote:
I have one more question. How can I store a list and a string in the same appvar and how can I retrieve them? If that's even possible? Because I imagine Appvars to be like a normal variable, it can only store one thing. In my case I want to store a list and a string in the appvar LEVEL. Is that possible?


Yes, an Appvar is literally a sequence of bytes and can represent anything smaller than 65516 bytes.

How would I have to do that?


It's like a file on a PC.
ICE code to overwrite to the appvar "File" with "Hello World!", including the (automatic) 0 at the end of the string.

Code:

sum(1,"File","w"->D
sum(4,"Hello World!",13,1,D
sum(3,D
Ok, but if I then store a list in the appvar, isn't the string "Hello World!" gone?
Yan-Nick wrote:
Ok, but if I then store a list in the appvar, isn't the string "Hello World!" gone?


If you want to append (add to the end)

Code:

sum(2,'L₁',"r",2→D
sum(18,D→PTR
sum(16,D→LEN
sum(3,D
sum(1,"File","a+"→D
sum(4,PTR,LEN,1,D
sum(3,D

Just like any file on a PC.

NOTE: there has to be single quotes around the token L₁, otherwise it will not work correctly.
Ah, now I know what a+ is. Thanks for your help, if there are any more problems, I'll call you back. Very Happy
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement