Join us on Discord!
You can help CodeWalrus stay online by donating here.

I need help with Axe Parser [Can I Axe you a question?]

Started by CKH4, January 06, 2015, 09:49:36 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Dream of Omnimaga

Quote from: Hayleia on January 09, 2015, 11:47:09 PM
Quote from: DJ Omnimaga on January 09, 2015, 03:51:41 PM
An Hayleia draws near! *.*
Lol, I should probably introduce myself by the way, for those who don't know me.
Indeed, especially that some people here are from Cemetech, PLanète-Casio or have joined after the site public opening :)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

CKH4

Quote from: CKH4 on January 09, 2015, 09:53:57 PM
I'm trying to improve builderboys string physics program by making corrective center velocity. I am attempting to make inward velocity when the X coordinate is grater than or less than 48 (the center) and the Y coordinate is greater than 31. I have been trying to do this by changing A (x velocity) positive or negative but it doesn't seem to work.
Here is the original code:
.AXE
ClrDraw
48*256->X->I
32*256->Y->J
0->A
0->B

Repeat getKey(15)
X+A->X
Y+B->Y
B+8->B
getKey(3)-getKey(2)*16+A->A
getKey(1)-getKey(4)*16+B->B

If abs(X-I)->[r1]*^[r1]+(abs(Y-J)->[r1]*^[r1])>576
X-I//24->N
Y-J//24->O
A**N+(B**O)*~1->K
If K<<0
K**N*3//2+A->A
K**O*3//2+B->B
End
End

Circle(X/256,Y/256,4
Line(48,32,X/256,Y/256
DispGraphClrDraw

End

Any thoughts on how to do this?
Bump I guess. I also changed some stuff.
  • Calculators owned: TI-83+, TI-84+


CKH4

Is there a way to make lists in axe?
  • Calculators owned: TI-83+, TI-84+


Snektron

#33
Yes, but it's quite low level.
The variables L1 - L6 are used as free ram and can me used as lists well.
To set/get an element:

0->{L1 + Index}
{L1 + Index}->Var

You can also set 16 bit elements:

0->{Index*2 + L1}^r
{Index*2+L1}^r->Var

Note that the index needs to be multiplied by 2 since 16 bit values need 2 elements (an element is ofcourse 8 bits).

100->N

Lbl Init       .init particles
  For(I,0,N)
    I*6->A
    rand^24576->{L1+A}^r     . start x pos
    rand^16384->{L1+A+2}^r     . start y pos
    rand->{L1+A+4}^r          . start vel, these are 8 bit and stored in L1+A+4 and L1+A+4, but are both set at the same time
  End
Return

Lbl Upd     . update particles
  For(I,0,N)
    I*6->A
    {L1+A}^r+{L1+A+4}-128->{L1+A}^r     . update x pos
    {L1+A+2}^r+{L1+A+5}-128->{L1+A+2}^r     . update y pos
  End
Return

Lbl Rndr     . draw particles
  For(I,0,N)
    I*6->A
    Pxl-On( {L1+A}^r/256, {L1+A+2}^r/256)
  End
Return

I made a simple particle system with these 3 functions to show you
some examples. Note that this code is untested. Also, the particles
do not have any restrictions (they'll fly out of the screen).
Happy coding! :P
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


CKH4

Thanks but there is no way that I'll figure that out today. Maybe later. It looks like I'll have to find a different way to accomplish what I need until then.
  • Calculators owned: TI-83+, TI-84+


Snektron

  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Dream of Omnimaga

One note: Lists in Axe are actually data you store inside RAM areas. FOr example, L6 is the LCD content. If you store something there it doesn't create a variable or BASIC list, it will just change the value at the RAM location you specified and if it's  L6, then even the LCD content will change.

Just making sure that you are aware of that, since internally L1 in Axe works much differently than in TI-BASIC.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

CKH4

I'm trying to make a list of bullet positions but I'm not sure that I want to use a list, maybe just 4 variables to keep the bullet number down.
  • Calculators owned: TI-83+, TI-84+


Hayleia

Quote from: Cumred_Snektron on January 16, 2015, 06:17:25 PM
You can also set 16 bit elements:

0->{L1 + Index*2}^r
{L1 + Index*2}^r->Var

Note that the index needs to be multiplied by 2 since 16 bit values need 2 elements (an element is ofcourse 8 bits).
This will probably not work exactly the way you want. Remember that Axe does operations from left to right without caring about priorities... ;)

Quote from: CKH4 on January 16, 2015, 06:54:40 PM
I'm trying to make a list of bullet positions but I'm not sure that I want to use a list, maybe just 4 variables to keep the bullet number down.
Using 4 variables would just make the code bigger and unmaintanable. You'll probably copy paste your code to work with 4 variables, and when you'll want to add something, you'll forget to put it in all 4 portions.
Plus, using "lists" would teach you how to use something you need here and you'll need later in all of your projects. Just imagine you don't know about loops and instead of doing a loop you paste your code 16 times in a row. That's ridiculous. Instead of doing that, you learn how to use loops. Well, same here, you should learn how to use "lists".

Snektron

Quote from: Hayleia on January 17, 2015, 06:47:19 AM
Quote from: Cumred_Snektron on January 16, 2015, 06:17:25 PM
You can also set 16 bit elements:

0->{L1 + Index*2}^r
{L1 + Index*2}^r->Var

Note that the index needs to be multiplied by 2 since 16 bit values need 2 elements (an element is ofcourse 8 bits).
This will probably not work exactly the way you want. Remember that Axe does operations from left to right without caring about priorities... ;)
Oops :3
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


CKH4

I've run into a problem with my custom variable. I have

°GMODELDIST-getKey(54)+getKey(48)->°GMODELDIST

I get error invalid token. What am I doing wrong?
  • Calculators owned: TI-83+, TI-84+


Snektron

Youre adding/substracting values from the address. use

GMODELDIST-getKey(54)+getKey(48)->GMODELDIST
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


CKH4

  • Calculators owned: TI-83+, TI-84+


alexgt

This is a little different from what we have been talking about but how do you make appVars in Axe? Also (this one is silly but necessary) how do you use if statements with multiple conditions like:
If getKey(41) or getKey(15)
or is it:
If (getKey(41)) or (getKey(15))
or maybe:
If getKey(41)??getKey(15)
or could it be:
If (getKey(41))??(getKey(15))
I've tried all and it seems they execute it all the time or not at all   <_<
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Snektron

I always use something like if getKey(41)+getKey(15)
Though the on key detect seemed to have some bugs in axe.

As for app vars: Theres an examply in the axe documentary :P (note that appv is a symbol not actually 'a' + 'p' + 'p' + 'v' if u know what i mean)
  • Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...


Powered by EzPortal