Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Masinini on January 04, 2011, 08:01:06 pm

Title: Help with movement.
Post by: Masinini on January 04, 2011, 08:01:06 pm
So I decided to start learning axe, with my limited know how of the codes. I made a movement routine that ended up resetting my ram. Anyone have a movement routine that works and is not an unbreakable loop?
Title: Re: Help with movement.
Post by: squidgetx on January 04, 2011, 08:02:01 pm
By movement, are you talking about simply moving around a sprite on the screen?

There's a thread around here talking about that...

edit: Here it is (http://ourl.ca/8578)
Title: Re: Help with movement.
Post by: willrandship on January 04, 2011, 08:18:02 pm
Easy way to make a program not have an infinite loop:

First line of code (after description line)
repeat getKey(0) or getkey(15), for any key or for clear
your code
goes in
this area
end
that way, unless it actually crashes the calc, you can get out simply by pressing clear, or, any button if you used getkey(0)
Title: Re: Help with movement.
Post by: AngelFish on January 05, 2011, 01:26:18 am
I made a movement routine that ended up resetting my ram.

Get used to that :P It'll probably happen a lot more before you learn how not to [purposefully] reset your calc.

On a related note, never do Asm(C7 unless something freaks out the OS and you have no other way of shutting down the calc.
Title: Re: Help with movement.
Post by: guy6020665 on January 05, 2011, 01:29:17 am
What does Asm(C7 do? And is it done on the homescreen with Basic or Axe?
Title: Re: Help with movement.
Post by: AngelFish on January 05, 2011, 01:32:13 am
It's compiled with Axe (to RST $00) and it's basically a simulated RAM clear... with all of the fun [and data loss] of a real one.
Title: Re: Help with movement.
Post by: guy6020665 on January 05, 2011, 01:34:24 am
just RAM right?, not Archive?
Title: Re: Help with movement.
Post by: AngelFish on January 05, 2011, 01:35:36 am
Yep.

I used it to shut down my calc awhile back when some OS hook failed and disabled the 2nd+On combination on my calc. Pulling the batteries didn't work either, so it was the only option. Yes, Axe saved my calc  ;D
Title: Re: Help with movement.
Post by: squidgetx on January 05, 2011, 07:12:27 am
You could've done that in BASIC too: AsmPrgm: C7 then ran it from the homescreen with Asm()
Title: Re: Help with movement.
Post by: DJ Omnimaga on January 05, 2011, 12:55:12 pm
Nice trick to know, although I personally just go in the MEM menu. I guess it can be useful if a normal reset or ON+DEL fails
Title: Re: Help with movement.
Post by: Quigibo on January 05, 2011, 01:02:55 pm
You know, if you can't get to the ram clear menu or are unable to clear your ram for some reason where taking out the batteries doesn't work, you can always take out the backup battery (which powers the ram) to guarantee a ram clear even if the calculator wasn't frozen.
Title: Re: Help with movement.
Post by: Michael_Lee on January 05, 2011, 03:14:24 pm
So I decided to start learning axe, with my limited know how of the codes. I made a movement routine that ended up resetting my ram. Anyone have a movement routine that works and is not an unbreakable loop?

Here -- try this:
Code: [Select]
.TEST

[FFFFFFFFFFFFFFFF]->Pic1
10->X->Y

Repeat getKey(15)
  ClrDraw

  getKey(3)-getKey(2)+X->X
  getKey(1)-getKey(4)+Y->Y

  Pt-On(X,Y,Pic1)

  DispGraph
End

(Of course, when you're typing this out on your calc, you don't need to add the indents or spaces)

The code should display a solid black square that moves around with the arrow keys -- press [CLEAR] to exit the program.
Title: Re: Help with movement.
Post by: DJ Omnimaga on January 05, 2011, 08:34:31 pm
You know, if you can't get to the ram clear menu or are unable to clear your ram for some reason where taking out the batteries doesn't work, you can always take out the backup battery (which powers the ram) to guarantee a ram clear even if the calculator wasn't frozen.
For 1 minute, I assume, right? Because I removed all 5 batteries once, then immediately put them back, yet my RAM was still intact.
Title: Re: Help with movement.
Post by: Michael_Lee on January 06, 2011, 09:08:31 pm
You know, if you can't get to the ram clear menu or are unable to clear your ram for some reason where taking out the batteries doesn't work, you can always take out the backup battery (which powers the ram) to guarantee a ram clear even if the calculator wasn't frozen.
For 1 minute, I assume, right? Because I removed all 5 batteries once, then immediately put them back, yet my RAM was still intact.

Hmm, that's weird.  Were you on the homescreen when you pulled the batteries?  Because pulling the batteries while on the home screen doesn't cause a RAM clear -- you have to be running a program or something.
Title: Re: Help with movement.
Post by: turiqwalrus on January 06, 2011, 10:19:17 pm
Ok. thanks for that, Michael_Lee. I'm also learning axe, and am planning on a short game involving movement. this helped a bit on understanding the syntax in general.
Title: Re: Help with movement.
Post by: DJ Omnimaga on January 07, 2011, 12:19:57 am
You know, if you can't get to the ram clear menu or are unable to clear your ram for some reason where taking out the batteries doesn't work, you can always take out the backup battery (which powers the ram) to guarantee a ram clear even if the calculator wasn't frozen.
For 1 minute, I assume, right? Because I removed all 5 batteries once, then immediately put them back, yet my RAM was still intact.

Hmm, that's weird.  Were you on the homescreen when you pulled the batteries?  Because pulling the batteries while on the home screen doesn't cause a RAM clear -- you have to be running a program or something.
Even when removing the lithium one too? And yeah I was on the home screen.
Title: Re: Help with movement.
Post by: Michael_Lee on January 07, 2011, 01:19:04 am
Well...
I don't know about the lithium -- I've never had a reason to take it out, so I've no clue as to what would happen.
Title: Re: Help with movement.
Post by: Masinini on January 10, 2011, 09:59:21 pm
Okay, So I was thinking about Movement programs, and I was wondering. I made a program That went like this.

.Movement
[FFFFFFFFFFFFFFFF->pic1
20->X
20->Y
Repeat getkey(54)
Pt-change(X,Y,pic1
dispgraph
Pt-change(X,Y,pic1
X+(Getkey(4) and X=/= edge )-(getkey(1) and x=/=1) -> X
Y+(getkey(3) and Y=/= Edge)-(getkey(2) and Y=/=1)-> Y
End.

When it displayed it, it displayed it at 20 20, then moved it to like 1, 6. When I tried to move the dot, it would move one space, and then go back to 1,6. Any idea what i am doing wrong?
Title: Re: Help with movement.
Post by: calcdude84se on January 11, 2011, 12:48:48 pm
You can't use it like  "getKey(1) and X!=1" That will evaluate like "(getKey(1) and X)!=1", which is not what you want.
To get the correct order of operations, you either need to put parentheses around (X!=1) or else change the order to "X!=1 and getKey(1)"
Note: This goes for all of them, not just the part with getKey(1) ;)
Title: Re: Help with movement.
Post by: Masinini on January 11, 2011, 05:49:09 pm
Alright, I understand what you mean. it was waiting for 1 and X to be pressed. I'll try a re-write tomorrow. And Imma post any other questions I have from now on.