Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: PC5LeGeND on May 30, 2012, 12:41:14 pm
-
I want to create a game wich saves to lists like: L1 but it gives me an error when i trie it like: 5->L1(1)
Does anybody know how to do it ???
Please answer if it will work it will certainly be a fantastic game
-
This is axe, not BASIC. L1 in axe is just another pointer to a location in free RAM. You can use appvars to store savefile data in. There are some great tutorials here about appvars.
-
Here (http://www.omnimaga.org/index.php?action=articles;sa=view;article=58) is a tutorial about external vars.
But maybe you don't need external vars, maybe writing to free Ram would be enough. I don't know what your game is but you may want to learn about pointers too :)
-
Well, if you want to save stuff temporarily wile in the program, you can use safe RAM areas like L1.
There are 712 bytes, and you can refer to them like: {L1}, {L1+1}, up to {L1+711}.
Of course, you can also store stuff into them.
As far as saving goes, like saving a high-score, etc. You can use appvars. To do this, you do:
GetCalc("appvTEST",2)->A //make an appvar called TEST which is 2 bytes large and store it into pointer A
B->{A}r //When B is your highscore, store it into A (the appvar) with 2 bytes. (using the superscript r)
I'd also refer to this tutorial (http://www.omnimaga.org/index.php?action=articles;sa=view;article=58) about external vars.
Also, welcome here. :D Please introduce yourself in this thread: http://www.omnimaga.org/index.php?board=10.0
EDIT: :ninja:
-
I really need a sort of list so i can store coordinates in it can someone help me with that ?
-
Well... You could at least have a look at those tutorials first :/
-
If it is just when the game is running, try doing {L1+X} instead of L1(X-1) ;)
No need for external vars
-
I really need a sort of list so i can store coordinates in it can someone help me with that ?
Exactly. Rather than doing "L1(1)", do "{L1}". same with "L1(3)", do "{L1+2}".
EDIT: :ninja: again x.x
-
Please read the tutorial!!!!
-
Ok thank you it works
but another problem i want to know the dim from a list does it work with dim({L1}???
-
L1 has no "dimension". The only thing we could say is that it contains 712 bytes.
It is just free ram, not a list.
In fact, Axe's syntax is close to Basic but it is not Basic ;)
-
You cant get like how many numbers it got
-
But yeah it will be without lvl editor
-
You cant get like how many numbers it got
There is no command like this but it is not that difficult to code in a subroutine. Assuming your list doesn't include any zeros just do this
_______________________
Fill(L1,711,0)
.this at the very beginning of your program
...
your code here
...
Return
.End of your code
Lbl Dim
0->r2
{r1}
While
r2++
{r1++}
End
Return r2
_______________________
Then using Dim(L1) (with an uppercase D) should return the number of elements "in" L1 (if I didn't do any mistakes)
-
PC5LeGeND, please try to avoid double posting.
Double-posting (posting two messages in the same topic in quick succession) is discouraged.
- Double-posting to "bump" a thread that hasn't been replied to for a day is permitted.
- For special cases (such as a major project update), use your own discretion.
- Remember that you can always use the "MODIFY" buttons to edit the content of a post.
-
Oh srry i didnt know that i was double posting srry
-
Omg it works thank you guys i will maybe do a pre release soon
-
You just double posted again D:
-
Yay a pre-release :3 You play minecraft I assume XD
-
Yeah i play minecraft but i didnt double post or does it mean i post 2 times after eachother ?? Than srry about that i thought it mean you post 2 times the same
-
If your "list" contains zeros, then you will need to make a counter variable that simply stores the length of the array. For example, L could be the length, and the array would be in L1. Then, whenever you want to append data to the array:
myNum->{L + L1}
L++
To read the last element:
{L-1+L1}
To remove an element, you can either write the last element as zero and then decrement the length counter, or simply decrement the length counter if you know that you won't be reading from after the array.
-
i didnt double post or does it mean i post 2 times after eachother ?? Than srry about that i thought it mean you post 2 times the same
Yes, double posting is posting 2 times in a row, not necessarily the same post :)
If your "list" contains zeros, then you will need to make a counter variable that simply stores the length of the array. For example, L could be the length, and the array would be in L1. Then, whenever you want to append data to the array:
myNum->{L + L1}
L++
To read the last element:
{L-1+L1}
To remove an element, you can either write the last element as zero and then decrement the length counter, or simply decrement the length counter if you know that you won't be reading from after the array.
Or still use my method with a number X other than zero that is not in the list :P
_______________________
Fill(L1,711,0)
.this at the very beginning of your program
...
your code here
...
Return
.End of your code
Lbl Dim
0->r2
{r1}
While -X
r2++
{r1++}
End
Return r2
_______________________
-
My lvl editor works but if i want to get values from my list it say invalid dim is there a command so that i can strore it and acces from my caculator OS
-
My lvl editor works but if i want to get values from my list it say invalid dim is there a command so that i can strore it and acces from my caculator OS
No
-
That...is a problem
-
Why would you want to use the OS's lists? It is much easier to use free ram areas and appvars.
-
But what is the command to store in your appvar
-
But what is the command to store in your appvar
There is no such thing. You just write a value to an adress. Like this:
GetCalc("appvTEST",2)->A //A is the pointer to your appvar now!
10->{A} //stores 10 in appvar TEST
21->{A+1} // stores 21 in appvar TEST
disp{A}>Dec //Displays 10 in this case
disp{A+1}>Dec //Displays 21 in this case
-
GetCalc("appvNAME",[size of data you need])->A //appvar NAME is created with the amount of data you need and stored to pointer A.
Copy([your data],A,[size of your data]) //Copy's the size of your data from your data into pointer A (appvar NAME)
EDIT: :ninja:
-
GetCalc("appvNAME",[size of data you need])->A //appvar NAME is created with the amount of data you need and stored to pointer A.
Copy([your data],A,[size of your data]) //Copy's the size of your data from your data into pointer A (appvar NAME)
EDIT: :ninja:
For a level editor it might be better to copy the level data to free ram and copy it back to the appvar, indeed, so that you don't end up destroying the level without a spare save file.