* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Some super crappy Axe code...  (Read 3698 times)

0 Members and 1 Guest are viewing this topic.

Offline p2

  • CodeWalrus Staff
  • Super User
  • Moderator
  • CodeWalrus Supporter
  • *
  • Join Date: Aug 2016
  • Location: Germany
  • Posts: 1894
  • Post Rating Ratio: +7/-0
  • *Wubba lubba dub dub*
    • KaliPhobos
    • View Profile
  • Gender: Male
Some super crappy Axe code...
« on: August 24, 2016, 11:41:43 am »
Hey guys,
As some of you might already know, I haven't used axe for a couple of years and forgot almost everything about it  :'(
So now I'm trying to relearn axe and wanted ot ask you how I could improve the following code I wrote...
It's ment to be a player (just a square) kickign arount a Ball (a nice circle) with workign colission and gravty stuff...
I'm really sorry but I got no GIF to upload yet, hope you still understand what the code should do...  :(

(click to show/hide)

(click to show/hide)

(click to show/hide)

(click to show/hide)

Aaand explanations:
You're a square kicking arount a circle....
{L1+0}^r = X-pos ball
{L1+2}^r = Y-pos ball
{L1+4}^r = X-speed ball
{L1+6}^r = Y-Speed ball
T = Direction X-Movement ball (1 or -1)
U = Direction Y-Movement ball (1 or -1)
V = X-Pos player
W = Y-Pos player
C = Counter (add 1 each loop in main program so I can use it for executing stuff every 2 or every 4 rounds)
N = No-collide (counter for how many "rounds" it's gonna ignore colission stuff. To prevent trigering the colusion twice at once)
G = Gravitation (always rising and reset/changed by colissions)

Important: All graphic-related stuff is multiplied with 100... So I't wirking with a 9600x6400 screen and a Speed of 100 means 1px movement per round.
That's where all the /100 is coming from :)
(click to show/hide)


I plan on moving all teh vars inside L1, add a second player, add Goals and add the gravity for players, too (so you got a realistic jump isntead of just floating around).
Still It'll be a crappy game, but it's just for learning purposes not for being published or something ^^

Pls dont hate me for writing such crappy code - this is my first attempt after more than 4 years... :(

Edit: Fixed a typing mistake in Gravitation program... accidentally used '+' instead of '*' there...
« Last Edit: August 24, 2016, 03:34:40 pm by p2 »


  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Online c4ooo

  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  • Super User
  • CW Contest II Winner
  • *
  • Join Date: Aug 2015
  • Location: 127.0.0.1
  • Posts: 831
  • Post Rating Ratio: +7/-2
  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    • View Profile
  • Gender: Male
Re: Some super crappy Axe code...
« Reply #1 on: August 24, 2016, 03:20:12 pm »
Alot to of code to correct everything, but here are some tips:

Axe has left to right order of operations;
{L1+0}^r+({L1+4}^r*T)->{L1+0}^r
can be
{L1+4}^r*T+{L1+0}^r->{L1+0}^r

Code: [Select]
0->G
.N=NotCollide to prevent double collision
0->N
.C=Counter
0->C
The above can just be 0->G->N->C

G+3->G:G/10+{L1+2}^r->{L1+2}^r
Can be
G+3->G:/10+{L1+2}^r->{L1+2}^r
If there is no var/number before the "/10", then it just uses the last value. (in this case G+3)

If U=1:{L1+6}^r+102->{L1+6}^r:Else:{L1+6}^r+97->{L1+6}^r:End
Can be
Code: [Select]
If U=1:102:Else:97:End
+{L1+6}^r->{L1+6}^r

This block:
Code: [Select]
If getKey(1) and (W<5600):W+100->W:End
.LeftArrowKey
If getKey(2) and (V>0):V-100->V:End
.RightArrowKey
If getKey(3) and (V<8600):V+100->V:End
.UpArrowKey
If getKey(4) and (W>0):W-100->W:End
Can be:
Code: [Select]
If W<5600 and getKey(1):W+100->W:End
If V>0 and getKey(2):V-100->V:End
If V<8600 and getKey(3):V+100->V:End
If  W>0 and getKey(4):W-100->W:End
which can further be optimized to:
Code: [Select]
W<5600 and andgetKey(1)-(W>0 and getKey(4))*100+W->W
V<8600 and getKey(3)-(V>0 and getKey(2))*100+V->V


Please not that some of this stuff has the possibility of being wrong so dont change everything at once ;)
« Last Edit: August 24, 2016, 03:24:22 pm by c4ooo »
??? ??? ???

Offline Hayleia

  • Full User
  • Join Date: Nov 2014
  • Location:
  • Posts: 316
  • Post Rating Ratio: +11/-0
    • View Profile
Re: Some super crappy Axe code...
« Reply #2 on: August 24, 2016, 03:30:02 pm »
1) Indentation.
If you're developing on-calc, it's obviously harder to do. zStart has a small font editor but I'd also understand that you avoid zStart or that editor.
So, do it if you can, and obviously don't if you can't.

2) Custom variables.
Instead of having a comment saying "L1{X,Y,vX,vY" then using a lot of these "{L1+__}^r", you could use custom variables.
How? Well just try that:
Code: [Select]
L1+00->°PosX
L1+02->°PosY
L1+04->°VX
L1+06->°VY
Then do stuff with PosX, PosY and others as if they were variables. Like 0->PosX, PosX++, etc. It works.
Your names can contain 13 characters max. That's enough for most uses.

3) Names in general.
Pic01, what is that supposed to mean? Well, if it's a sprite, having "Pic" in the name is better than having "Str", but still. I guess it's the ball's sprite. And same, Pic02 must be the Player's sprite. Well, then, try that:
Code: [Select]
...
...
[3C7EFFFFFFFF7E3C]->°BallSprite
[FF818181818181FF]->°PlayerSprite
...
...
Pt-On({L1+0}^r/100,{L1+2}^r/100,°BallSprite)
Pt-On(V/100,W/100,°PlayerSprite)
...
...
Same, 13 characters max.

4) Subprograms.
I'd say they should only be used as a compilation of subfunctions you didn't want to put in the main file (to save space or have less lines or whatever), but having them in a loop the way you did is a bad idea. You seem to think this works the same way as in basic, which is "there is no custom subfunctions but there are subprograms that are not pasted everytime". Well it's exactly the contrary, there are subfunctions in Axe and subprograms are pasted everytime.
To use a subfunctions, do like that:
Code: [Select]
.TOASTER
...
...
Add(3,4)->A
...
...
Return

Lbl Add
r1+r2
Return

5) Optimization.
Well, I'm not talking about that one. Readability is better for beginners.

Offline p2

  • CodeWalrus Staff
  • Super User
  • Moderator
  • CodeWalrus Supporter
  • *
  • Join Date: Aug 2016
  • Location: Germany
  • Posts: 1894
  • Post Rating Ratio: +7/-0
  • *Wubba lubba dub dub*
    • KaliPhobos
    • View Profile
  • Gender: Male
Re: Some super crappy Axe code...
« Reply #3 on: August 24, 2016, 04:28:16 pm »
G+3->G:G/10+{L1+2}^r->{L1+2}^r
Can be
G+3->G:/10+{L1+2}^r->{L1+2}^r
If there is no var/number before the "/10", then it just uses the last value. (in this case G+3)
Definitely gonna modify the whole code like this :D Thanks a lot!  :thumbsup:


2) Custom variables.
Instead of having a comment saying "L1{X,Y,vX,vY" then using a lot of these "{L1+__}^r", you could use custom variables.
How? Well just try that:
Code: [Select]
L1+00->°PosX
L1+02->°PosY
L1+04->°VX
L1+06->°VY
Then do stuff with PosX, PosY and others as if they were variables. Like 0->PosX, PosX++, etc. It works.
Your names can contain 13 characters max. That's enough for most uses.
Code: [Select]
[3C7EFFFFFFFF7E3C]->°BallSprite
[FF818181818181FF]->°PlayerSprite
...
...
Pt-On({L1+0}^r/100,{L1+2}^r/100,°BallSprite)
Pt-On(V/100,W/100,°PlayerSprite)
...
...
Same, 13 characters max.
Okeyy these custom names are really cool :D I'll use them, too ^^ (Always got to add ° before the name, right? :)

But just in theory, let's say I wanted a second and a third ball added to the game...
Could I just do something like {100*Z+L1+2}^r and {100*Z+L1+4}^r and put it in a for(Z,0,2) or won't that work?
Because then it wouldn't always make sense for me to use custom variable names... ^^


4) Subprograms.
I'd say they should only be used as a compilation of subfunctions you didn't want to put in the main file (to save space or have less lines or whatever), but having them in a loop the way you did is a bad idea. You seem to think this works the same way as in basic, which is "there is no custom subfunctions but there are subprograms that are not pasted everytime". Well it's exactly the contrary, there are subfunctions in Axe and subprograms are pasted everytime.
To use a subfunctions, do like that:
Code: [Select]
.TOASTER
...
...
Add(3,4)->A
...
...
Return

Lbl Add
r1+r2
Return
I guess this Add is an example for a subroutine... Do I have to give the variables as parameter or can it just access the vars, too?
That would be a problem since I'm gonna change a lot of stuff for example in the colission program (G, xPos, YPos, vX, vY, T, U)
Aaand do I need to add a "Return" too at the end of the subroutine as long as my subroutine shouldn't return a specific value but rather change a lot of vars...?


5) Optimization.
Well, I'm not talking about that one. Readability is better for beginners.
Just show me some stuff and let's see how much I'll understand ;D Want to quickly learn everything again... >.>
*Thank you very much for your help!! :) :)
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Offline E37

  • Full User
  • Join Date: Jul 2016
  • Location: Lihilzard Empire
  • Posts: 199
  • Post Rating Ratio: +9/-0
  • I own 2 game consoles, a ti-83 and a ti-84!
    • E37
    • View Profile
Re: Some super crappy Axe code...
« Reply #4 on: August 24, 2016, 04:55:22 pm »
L1+2->oNAME
NAME = {L1+2}r
You don't need the angle. You can use NAME exactly as a letter var. It is two bytes. The angle is only needed in declaration.
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

Offline p2

  • CodeWalrus Staff
  • Super User
  • Moderator
  • CodeWalrus Supporter
  • *
  • Join Date: Aug 2016
  • Location: Germany
  • Posts: 1894
  • Post Rating Ratio: +7/-0
  • *Wubba lubba dub dub*
    • KaliPhobos
    • View Profile
  • Gender: Male
Re: Some super crappy Axe code...
« Reply #5 on: August 24, 2016, 04:59:55 pm »
So this is how it's done? :)
Code: [Select]
5->°SuperAwesome
3->A
A+SuperAwesome->A
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Offline E37

  • Full User
  • Join Date: Jul 2016
  • Location: Lihilzard Empire
  • Posts: 199
  • Post Rating Ratio: +9/-0
  • I own 2 game consoles, a ti-83 and a ti-84!
    • E37
    • View Profile
Re: Some super crappy Axe code...
« Reply #6 on: August 24, 2016, 05:17:06 pm »
SuperAwesome must be given a memory location at its declaration.
if you used your verson, 37->SuperAwesome would changes bytes 5 and 6 in ram.
if the variable was declared as L1->°SuperAwesome then 37-> SuperAwesome would set {L1}r to be 37.

What you are thinking of is a constant. Here is how to use them:
number->->°CONSTANT
creates a constant named CONSTANT and gives it the value number.
Disp °CONSTANT >dec
would display the value of the number. Note the angle sign!
Constants cannot be changed!
They do have the benefit of being the same size and speed of typing number in each time instead of constant. Axe simply replaces °CONSTANT with the number when it compiles.
« Last Edit: August 24, 2016, 05:22:41 pm by E37 »
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

Offline p2

  • CodeWalrus Staff
  • Super User
  • Moderator
  • CodeWalrus Supporter
  • *
  • Join Date: Aug 2016
  • Location: Germany
  • Posts: 1894
  • Post Rating Ratio: +7/-0
  • *Wubba lubba dub dub*
    • KaliPhobos
    • View Profile
  • Gender: Male
Re: Some super crappy Axe code...
« Reply #7 on: August 24, 2016, 05:26:02 pm »
wooow, wait a sec *-*
Code: [Select]
{L1+2}^r->°xBallA
{L1+102}^r->°xBallB
{L1+202}^r->°xBallC
for(Z,0,2):{100*Z+L1+2}^r->A:Text(10,10*Z,A>Dec):end
This would actually work? It would display all three values?
So I can then access the stuff both by using the fancy name xBallA AND by using the momory position {L1+2}^r  O.O
I love this language... >.>
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Offline E37

  • Full User
  • Join Date: Jul 2016
  • Location: Lihilzard Empire
  • Posts: 199
  • Post Rating Ratio: +9/-0
  • I own 2 game consoles, a ti-83 and a ti-84!
    • E37
    • View Profile
Re: Some super crappy Axe code...
« Reply #8 on: August 24, 2016, 05:31:10 pm »
wooow, wait a sec *-*
Code: [Select]
{L1+2}^r->°xBallA
{L1+102}^r->°xBallB
{L1+202}^r->°xBallC
for(Z,0,2):{100*Z+L1+2}^r->A:Text(10,10*Z,A>Dec):end
This would actually work? It would display all three values?
So I can then access the stuff both by using the fancy name xBallA AND by using the momory position {L1+2}^r  O.O
I love this language... >.>
Woah, Woah, Woah! hang on a sec!
Custom variables need a MEMORY LOCATON not a number!
L1+102->°xBallB would be the correct way to declare it.
Disp xBallB={L1-102}r >Dec
should then always display true (1).
It needs a memory loction because, of course, you can't create memory. It needs a place to store its data.
edit: i'm not sure you can start a variable with a lowercase though...
« Last Edit: August 24, 2016, 05:32:46 pm by E37 »
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

Offline Hayleia

  • Full User
  • Join Date: Nov 2014
  • Location:
  • Posts: 316
  • Post Rating Ratio: +11/-0
    • View Profile
Re: Some super crappy Axe code...
« Reply #9 on: August 24, 2016, 05:34:42 pm »
I guess this Add is an example for a subroutine... Do I have to give the variables as parameter or can it just access the vars, too?
That would be a problem since I'm gonna change a lot of stuff for example in the colission program (G, xPos, YPos, vX, vY, T, U)
Aaand do I need to add a "Return" too at the end of the subroutine as long as my subroutine shouldn't return a specific value but rather change a lot of vars...?
Yes it was a subroutine.
You never specify arguments in Axe. If there are any, they are r1,r2...r6.
So basically, Add(3,4,5) is the same as 3->r1:4->r2:5->r3:Add().
And the Return is the end of the subroutine. Even if it returns nothing, you must finish with a return.
And the same way G+3->G:/10 worked, the r1+r2:Return works.

Offline E37

  • Full User
  • Join Date: Jul 2016
  • Location: Lihilzard Empire
  • Posts: 199
  • Post Rating Ratio: +9/-0
  • I own 2 game consoles, a ti-83 and a ti-84!
    • E37
    • View Profile
Re: Some super crappy Axe code...
« Reply #10 on: August 24, 2016, 05:43:08 pm »
As for modifying c4ooo code even further,
W<5600 and getKey(1)-(W>0 and getKey(4))*100+W->W
could be even further optimized to:
W<5600?getkey(1)-(W?getkey(4))*100+W->W //note that the question marks are there on purpose and that is a negative sign, not a minus.
Since Axe doesn't really do negative numbers, (that is up to you) W>0 could be changed to just number. since any nonzero number is greater than zero.
(there are negative commands but I don't really touch them since they aren't a lot of cases they are useful outside of physics engines and my physics engines are terrible)
The question mark means if the previous statement is true, continue. If it isn't skip the rest of the code and go the the next newline.

As for learning to program Axe I still find it helpful to program with a paper or electronic copy of the Axe command list nearby. http://axe.eeems.ca/Commands.html
Oh... by the way, your code isn't bad at all! It is heaps better than my first code! It took me weeks to grasp the concepts of how lists are structured.
« Last Edit: August 24, 2016, 05:47:01 pm by E37 »
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

Offline p2

  • CodeWalrus Staff
  • Super User
  • Moderator
  • CodeWalrus Supporter
  • *
  • Join Date: Aug 2016
  • Location: Germany
  • Posts: 1894
  • Post Rating Ratio: +7/-0
  • *Wubba lubba dub dub*
    • KaliPhobos
    • View Profile
  • Gender: Male
Re: Some super crappy Axe code...
« Reply #11 on: August 24, 2016, 05:51:15 pm »
Woah, Woah, Woah! hang on a sec!
Custom variables need a MEMORY LOCATON not a number!
L1+102->°xBallB would be the correct way to declare it.
Disp xBallB={L1-102}r >Dec
should then always display true (1).
It needs a memory loction because, of course, you can't create memory. It needs a place to store its data.
edit: i'm not sure you can start a variable with a lowercase though...
uh sorry my fault ^^
ok then this should work now? :)
Code: [Select]
L1+2->°xBallA
L1+102->°xBallB
L1+202->°xBallC
for(Z,0,2):{100*Z+L1+2}^r->A:Text(10,10*Z,A>Dec):end
L1+2 would be a memory position while {L1+2} would be the content of the byte 2 adresses after that same one, right?
and the ^r in the declaration (first 3 lines) isn't needed because as  basic integer is's using 2 Bytes by default, right? :)
If this is both correct, I understood how to do it ^.^

edit: i'm not sure you can start a variable with a lowercase though...
Does someone here know this? ^^



And the Return is the end of the subroutine. Even if it returns nothing, you must finish with a return.
And the same way G+3->G:/10 worked, the r1+r2:Return works.

So this Subfunction DoStuff would actually do 5->A->Z:
Code: [Select]
...
...
DoStuff( )->Z
...
...
Return

Lbl DoStuff
5->A:Return

But this one would not return anything so be an error?
Code: [Select]
...
...
DoStuff( )->Z
...
...
Return

Lbl DoStuff
5->A
Return

Is it a problem if a called Subfunction returns some value but It's not used afterwards...?
Or is it optional to use the returned value, no matter if there is one or not?
Like this:
Code: [Select]
...
...
DoStuff( )
...
...
Return

Lbl DoStuff
5->A:Return
  • Calculators owned: ti-83+, ti-84+, ti-84+, ti-84+se, ti-84+se(te), ti-nsphire, ti-nsphire CX-CAS, ti-voyage, ti-voyage, Who reads this list anyways...?
Anyway war sucks. Just bring us your food instead of missiles  :P ~ DJ Omnimaga (11.10.2016 20:21:48)
if you cant get a jframe set up, draw stuff to it, and receive input, i can only imagine how horrible your game code is _._   ~ c4ooo (14.11.2016 22:44:07)
If they pull a Harambe on me tell my family I love them ~ u/Pwntear37d (AssangeWatch /r/)
make Walrii great again ~ DJ Omnimaga (28.11.2016 23:01:31)
God invented the pc, satan the smartphone I guess ~ p4nix (16.02.2017 22:51:49)

Offline Hayleia

  • Full User
  • Join Date: Nov 2014
  • Location:
  • Posts: 316
  • Post Rating Ratio: +11/-0
    • View Profile
Re: Some super crappy Axe code...
« Reply #12 on: August 24, 2016, 06:08:02 pm »
So this Subfunction DoStuff would actually do 5->A->Z:
Code: [Select]
...
...
DoStuff( )->Z
...
...
Return

Lbl DoStuff
5->A:Return

But this one would not return anything so be an error?
Code: [Select]
...
...
DoStuff( )->Z
...
...
Return

Lbl DoStuff
5->A
Return
They are exactly the same. A new line or a ":" is the same thing.
You can even write something after the return if you want (and it can be useful in some cases). Like
Code: [Select]
...
...
Lbl Stuffs
r1*r2->r5
r3*r4->r6
Return r5+r6
...
...
Well yeah, not so useful here, but you see what I mean.

Is it a problem if a called Subfunction returns some value but It's not used afterwards...?
Or is it optional to use the returned value, no matter if there is one or not?
There is something you didn't get about Axe. Every single thing "returns" something.
Example that seems unrelated but helps you understand Axe better.
Code: [Select]
A+3*3->B
Code: [Select]
A
+3
*3
->B
These codes do the same thing.
So as long as your subfunction (that we call "routine actually") has code, it will return something, even if you don't care and don't do anything with its return value.
And that's how you end up writing code that doesn't use any variable (@matref involved too) :P

Online c4ooo

  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
  • Super User
  • CW Contest II Winner
  • *
  • Join Date: Aug 2015
  • Location: 127.0.0.1
  • Posts: 831
  • Post Rating Ratio: +7/-2
  • ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
    • View Profile
  • Gender: Male
Re: Some super crappy Axe code...
« Reply #13 on: August 24, 2016, 06:08:16 pm »
" As for modifying c4ooo code even further,
W<5600 and getKey(1)-(W>0 and getKey(4))*100+W->W
could be even further optimized to:
W<5600?getkey(1)-(W?getkey(4))*100+W->W //note that the question marks are there on purpose and that is a negative sign, not a minus."

Don't think that will work @E37  If W>5600, then everything past the "?" will simply be ignored, which we don't want. In the second case it might work, but it is unnecessary. Also you can't dojust do "W?"; that will only be true if W is non zero, and a negative number is non zero. However " W>0" won't work either because ">" is unsigned comparison. You would have to do "W>>0". (So -1>0 in axe would return true)
??? ??? ???

Offline E37

  • Full User
  • Join Date: Jul 2016
  • Location: Lihilzard Empire
  • Posts: 199
  • Post Rating Ratio: +9/-0
  • I own 2 game consoles, a ti-83 and a ti-84!
    • E37
    • View Profile
Re: Some super crappy Axe code...
« Reply #14 on: August 24, 2016, 06:10:32 pm »
You got it!
Subroutines don't need to return anything.
They can just hold code. They will always return the result of the last line of code. Nobody said you had to do anything with it.
You nailed memory locations on the head.
Thanks c4ooo, my mind seemed to edit in an if at the beginning.
You don't need the greater than zero c4ooo it is unsigned.
« Last Edit: August 24, 2016, 06:16:38 pm by E37 »
  • Consoles, mobile devices and vintage computers owned: Ti83,Ti84!
I've never finished a project, there is always a way to improve!
What's my calc's name? Convert $37 to decimal. Look up that element in the periodic table. Then take the abbreviation of that element and you have it!
Look! A slime!    <(^.^)>

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games