Page 1 of 1

How do I stop this thing???

Posted: Sat Nov 22, 2014 4:30 pm
by Peacfulrvr
On moveobj
move image "grabber.gif" to the points of graphic ("Path"&random(4)) in 3 seconds
send "moveobj" to me in 3.1 seconds
add 1 to field "score"
if field "score" >= 10 then
go to next card
end if
end moveobj

The code works great to move me to the new page but it does so before ending the moveobj. This results in moveobj continuing to execute on the next card. How do I stop it? Can I do it on this script or on opencard on the next card?

Re: How do I stop this thing???

Posted: Sat Nov 22, 2014 4:44 pm
by Klaus
Hi Peacfulrvr,

nit sure, what logic you are looking for, but maybe this is what you want:

Code: Select all

On moveobj
  move image "grabber.gif" to the points of graphic ("Path"&random(4)) in 3 seconds
  ## send "moveobj" to me in 3.1 seconds
  add 1 to field "score"
  if field "score" >= 10 then 
     go to next card 
  else
      send "moveobj" to me in 3.1 seconds
  end if
end moveobj
Best

Klaus

Re: How do I stop this thing???

Posted: Sat Nov 22, 2014 4:45 pm
by FourthWorld
Your handler calls itself, so as long as it's able to run it will.

If you want the handler to stop based on some condition, you'll want to add that condition to the code to determine when to call itself, or stop calling itself.

Re: How do I stop this thing???

Posted: Sat Nov 22, 2014 5:49 pm
by Peacfulrvr
I am watching a video that I think shows how to put true into a variable and then change the variable based on a condition. I think I can figure it out... we shall see. I have not coded in like 15 years so this is interesting to learn. It has become a much needed hobby. And my students at school enjoy testing my game.