Author Topic: Need help by storing and loading something from free RAM  (Read 7776 times)

0 Members and 1 Guest are viewing this topic.

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Need help by storing and loading something from free RAM
« on: September 26, 2010, 12:10:35 pm »
Hi Omnimaga Community,
I'm working on my first Axe prog. I started it as the Axe example AXESDEMO
and added a shoot and pause feature, but there is some trouble by
storing new shoots into into L1 (savesscreen).
Code: [Select]
ClrDraw
DrawInv
For(A,0,63
sub(D
End
L1->B
For(H,0,29
0->{B+H}
End
ClrHome
43->X
Repeat XøX
sub(D
sub(U
DispGraph
sub(U
If getKey(2) and (Xø1
X-1->X
End
If getKey(3) and (Xø87
X+1->X
End
If getKey(54) and (T=0
For(H,1,9
!If {B+3*H}
1->{B+3*H}
X->{B-1+3*H}
55->{B-2+3*H}
15->T
Goto G
End
End
End
Lbl G
T=0+T-1->T
For(H,1,9)
If {B+H*3}
{B-2+H*3}-1->{B-2+H*3}
!If {B-2+H*3}
0->{B+3*H}
End
End
End
If getKey(55)
Fix 3
Text(37,19,"Pause
Text(20,26,"ENTER) CONTINUE
Text(27,33,"CLEAR) QUIT
Repeat getKey(9)
If getKey(15)
Goto Z
End
End
End
End
ClrDraw
ClrHome
Return
Lbl D
Vertical +
If rand^16
Pxl-Off(rand^96,1
End
Return
Lbl U
Pt-Change(X,55,Pic1
For(H,1,9)
If {B+H*3}
Pt-Change({B-1+H*3},{B-2+H*3},Pic2)
End
End
Return
Lbl Z
Fix 0
What happened:

Does anyone know where my mistake is?
Regards,
Aichi
« Last Edit: September 26, 2010, 12:32:42 pm by Aichi »

_player1537

  • Guest
Re: Need help by storing and loading something from free RAM
« Reply #1 on: September 26, 2010, 12:16:11 pm »
Would you mind moving the code out of the spoiler block?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Need help by storing and loading something from free RAM
« Reply #2 on: September 26, 2010, 12:29:54 pm »
Yeah, it's really tiny :P

Nice screenshot, though.




Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Need help by storing and loading something from free RAM
« Reply #3 on: September 26, 2010, 12:36:32 pm »
um, didn't look too closely at your code, but judging by the screenie, you didn't set a limit to the x and y values of the laser. So they kept increasing (and getting drawn off screen), and when they reached 255, they reset to 0 (this is why they appeared then on the other side)

Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: Need help by storing and loading something from free RAM
« Reply #4 on: September 26, 2010, 12:37:12 pm »
@ _player1537
Better? :)

@ Deep Thought
It would be nicer, if the shoots on the screenshot do not activate by themself. :)

Edit:
@ quidgetx
The shoots will be deleted, if position y of a shoot reaches 0 (On start of Lbl G).
But Im wondering about the main problem: The shoots appear without shooting (getkey=54) and move back one pixel on X per frame. ._.
« Last Edit: September 26, 2010, 12:46:52 pm by Aichi »

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Need help by storing and loading something from free RAM
« Reply #5 on: September 26, 2010, 12:43:42 pm »
Haven't read all of the code yet, but let's see... Did you remember that Axe has no order of operations? Meaning that
B+H*3
is actually
(B+H)*3?




Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Need help by storing and loading something from free RAM
« Reply #6 on: September 26, 2010, 12:45:37 pm »
ok looked at it a bit more closely but this
Code: [Select]
!If {B+3*H}
1->{B+3*H}
X->{B-1+3*H}
55->{B-2+3*H}

is the same as
Code: [Select]
!If {B+3*H}
1->{B+3*H}
X->{B+2*H}
55->{B+1*H}

remember, Axe does order of operations left to right, ignoring conventional algebra styles.

What I think you want is
Code: [Select]
!If {H*3+B}
1->{H*3+B}
X->{H*3+B-1}
55->{H*3+B-2}




Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Need help by storing and loading something from free RAM
« Reply #7 on: September 26, 2010, 12:46:36 pm »
^This.

I made that same mistake once every few weeks :P But really, the way Axe does it is a good idea. Saves a lot of memory that way.
« Last Edit: September 26, 2010, 12:47:51 pm by Deep Thought »




_player1537

  • Guest
Re: Need help by storing and loading something from free RAM
« Reply #8 on: September 26, 2010, 12:56:31 pm »
Teehee, everyone is copying me :)  I made something very similar :P  And with the same method of having bullets on or off :)

Looks very nice so far ^^  G'luck :)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Need help by storing and loading something from free RAM
« Reply #9 on: September 26, 2010, 12:59:18 pm »
Teehee, everyone is copying me :)  I made something very similar :P  And with the same method of having bullets on or off :)

Looks very nice so far ^^  G'luck :)

Let that be a tribute to your great coding skills :D

Oh, and Aichi, try not to leave closing parentheses off in Axe. It can occasionally cause problems, unlike in BASIC.
« Last Edit: September 26, 2010, 01:00:27 pm by Deep Thought »




Offline Aichi

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 290
  • Rating: +76/-3
    • View Profile
    • Devrays
Re: Need help by storing and loading something from free RAM
« Reply #10 on: September 26, 2010, 01:16:06 pm »
I put the 'H*3' to the front and that solved the problems.
Thank you guys! ^-^

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Need help by storing and loading something from free RAM
« Reply #11 on: September 26, 2010, 01:18:38 pm »
Glad to hear this is solved. I am curious what you will come up with (as game) when there is some more progress :D

Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: Need help by storing and loading something from free RAM
« Reply #12 on: September 26, 2010, 01:19:51 pm »
And that is a sweet screenie

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Need help by storing and loading something from free RAM
« Reply #13 on: September 26, 2010, 02:03:03 pm »
Yep. Nice ship, btw.




Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Need help by storing and loading something from free RAM
« Reply #14 on: September 26, 2010, 02:25:31 pm »
Looks like a nice screenie.  Good luck. :)