Main Menu

AMOS PRO AMAL Problem

Started by DarkN3mo, 25 Apr, 2022, 12:40 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DarkN3mo

In AMAL, I have a problem restarting an animation. It plays the animation well once, but when I restart the routine, nothing happens.
--------------------------------------
  Bob 3,80,60,SPELLEDIMG
   C$="Let X=R0 ; Anim 1,"
   For I=SPELLEDIMG To SPELLEDIMG+9
      C$=C$+"("+Str$(I)-" "+",5)"
   Next
   C$=C$+";"
   Channel 3 To Bob 3
   Amal Off 3
   Amal 3,C$
  ------------------------------------
-------------------------------------------
Procedure _ANIMSPELL
   If Chanan(3)=False
      Amreg(3,0)=80+Rnd(10)
      Amal On 3
      Anim On 3
   End If
End Proc

adrazar

#1
Amal On does nothing when the channel is already on. The only way to restart an arbitrary AMAL program from the beginning that I know of, is to use Amal Off and then reload it with Amal. However, the AMAL programs that you write will not be arbitrary in this sense. By writing them in a certain way they can be given the ability to restart: Add a label right at the beginning of your AMAL program, and you can make the program start over simply by jumping to it (given some appropriate condition, for instance by checking if register 9 has been set to some specific value).

So in this case you could consider replacing the Amal On instruction in _ANIMSPELL with an Amreg instruction, and modify the AMAL program such that it ends with this kind of loop: "B: IR9=1JA; PJB;". Anim On is not required when using the AMAL version of Anim, by the way.

DarkN3mo