How do I stop this thing???

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Peacfulrvr
Posts: 34
Joined: Mon Nov 03, 2014 7:11 pm

How do I stop this thing???

Post by Peacfulrvr » Sat Nov 22, 2014 4:30 pm

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?

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How do I stop this thing???

Post by Klaus » Sat Nov 22, 2014 4:44 pm

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: How do I stop this thing???

Post by FourthWorld » Sat Nov 22, 2014 4:45 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Peacfulrvr
Posts: 34
Joined: Mon Nov 03, 2014 7:11 pm

Re: How do I stop this thing???

Post by Peacfulrvr » Sat Nov 22, 2014 5:49 pm

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.

Post Reply