Calculator Community > [FR] Programmation Axe Parser

[Axe] Tableau dynamique

(1/3) > >>

Jagang:
(Re) bonjour,
J'ai de nouveau un problème pour mon jeu Mario Sokoban
Je charge mes cartes dans des GBD comme ceci :

--- Code: ---Data(0,1,1,1,1,0,0,0,1,1,0,0,1,1,1,1,1,0,0,0,0,0,0,1,1,0,3,3,1,2,0,1,1,1,1,0,0,2,0,1,0,0,1,1,1,0,0,1,0,0,0,0,1,1,1,1)->GBD1
--- End code ---
Étant donné qu'il y a plusieurs cartes, j'ai utilisé des condition, comma ça :

--- Code: ---If L=1
    Data(...)->GBD1
End
If L=2
    Data(...)->GBD1
End
etc ...
--- End code ---
Le problème, c'est que quand je lance la compilation, ça marche pas ...
Je ne peux pas utiliser un GBD par map puisque j'ai plus de 10 maps ...
Dans la version TI-Basic de mon programme, à chaque nouveau niveau, j'allais changer la valeur de la matrice [A].
En Axe, je pensais que c'était pareil ... dommage
Comment faire alors ?

Merci d'avance
Cordialement
Jagang

calcdude84se:
I don't speak French, but using Google Translate I can tell that you seem to be misunderstanding how "->GDB1" works.
(DJ or another French speaker, please translate my response.)
GDB1 etc. are not dynamic like in BASIC. Instead, when you use "->" with them, the data you store to them is placed in the compiled program. To use it like you would in BASIC, you have to use L1 or another place to store your data. However, this does bring up another problem; you still have to store the original data somewhere. You can use one GDB for each map, and you can add another digit to each. (You can use GDB10, GDB56, and so on, and maybe even another, like GDB623. However, I'm not sure about two extra digits.)
Another solution exists, though. If each set of data is the same size, rather than using GDB01 to access the first, GDB02 for the second, and so on, you can use GDB1 for the first, GDB1+56 for the second, GDB1+112 for the third, and so on, storing them like in the code box below. (assuming each set map is 56 bytes) (If you are using it with L like you were above, you could actually just use L-1*56+GDB1 to access the L'th set of data, indexed from 1.)

--- Code: ---Data(...)->GDB1
.Data for map 1
Data(...)
.Data for map 2
Data(...)
.Data for map 3
.And so on
--- End code ---
Thinking over it, I've realized that, if you're using maps, they are static and their content does not change. This means that you won't have to use L1 for that purpose. Rather, you can have a line like

--- Code: ---L-1*56+GDB1->M
--- End code ---
M now contains the address of the map data, and you can index from there. If, however, you would rather use L1 (perhaps for convenience?) you would have to copy the data to L1 like so: (You can use any free RAM area, not just L1)

--- Code: ---Copy(L-1*56+GDB1,L1,56
--- End code ---
Feel free to ask more if you are still confused; I doubt I've clarified everything.

Jagang:
Thank you, but, my maps are dynamics...
So, how load my maps in L1 ?

--- Code: ---Data(0,2,2,2,3,1,4,1,..)->L1
--- End code ---
?
Because, I need the same pointer/variable in the main program (where I test if an action is possible).

Sorry, I don't speak English very well (though I should), but it's always better than Google  Translate (I think ...)

calcdude84se:
Okay. My suggestion was that, instead of, say, L1+5 you use M+5, where M is the pointer to the map created by the code I gave above.
To load the maps into L1, you can use Copy(. For example, to copy X bytes from GDB1 to L1, you can use Copy(GDB1,L1,X).
A more complete line of code was that which was given above:

--- Code: ---Copy(L-1*56+GDB1,L1,56
--- End code ---
This code assumes you store 56-byte maps in the way I suggested in my previous post.

Jagang:
Ok, I understand, thank you.
So, I create a Data like that :

--- Code: ---Data([map 1],[map 2],[map 3] ...) ->GBD1
--- End code ---
And to load one map I use :

--- Code: ---Copy(L-1*128+GDB1,L1,128)
--- End code ---
Where L is the level starting at 1 and 128 is the size of the map.
But my maps have different size.
Can I use an other GDB with the size of each map ?
For example :

--- Code: ---Data([map 1, 56],[map 2, 42] ...)->GDB1
Data(56,42 ...)->GDB2
--- End code ---
And to load :

--- Code: ---0->A
For(I,0,L)
    A+{I+GDB2}->A
End
Copy(A+GDB1,L1,{L+GDB2})

--- End code ---
Does it work ?

How to access at the different case of L1 ?
Like GDB ?

--- Code: ---If {D+L1}=3
    2->{D+L1}
End

--- End code ---

Thank you

Jagang

EDIT: Someone know an Axe editor for PC ? Actualy, I use TI-Graph Link 83+ and it hasn't the instruction of Axe.
Personne ne connaitrais un éditeur pour l'Axe sur ordi ? J'utilise TI-Graph Link 83+ en ce moment, mais il n'a pas les instruction d'Axe et en plus il est francisé (Str1 = Chaîne1 ...)

Navigation

[0] Message Index

[#] Next page

Go to full version