Page 3 of 3

Re: move to the points of graphic

Posted: Tue Jan 18, 2022 4:59 pm
by Samuele
Thanks, but it doesn't solve the problem

Re: move to the points of graphic

Posted: Tue Jan 18, 2022 6:16 pm
by Klaus
Hi Samuele,
Samuele wrote: Mon Jan 17, 2022 7:16 pm
jacque wrote: Mon Jan 17, 2022 6:34 pm You said it used to work until you changed something. What did you change?
I still have a version where it works.
the old version that works:

Code: Select all

 on ActivateTimer
   HideStart
   if field "timer"  > 0
   then
      subtract 1 from field "timer"
      send ActivateTimer to me in 1 sec
      put the result into _pendingMessage
   else
      StopMoveMe
     #hide button "Stop" with visual effect zoom out very fast  
     show button "Restart" with visual effect dissolve very fast
     show button "Info" 
     show button "Home" 
     show button "Settings" 
    GameOver
    DisableObjects
    HighScore
 end if
end ActivateTimer

on HideStart
   if field "timer" = 1
   then
      hide button "Start" #with visual effect zoom out very fast
      hide button "Stop" with visual effect zoom in very fast
      end if
end HideStart

on StopMoveMe
   lock screen
   cancel _gmoveMePendingMethodID
      cancel _gmoveMePendingMethodID1
   cancel _gmoveMePendingMethodID2
   cancel _gmoveMePendingMethodID3
end StopMoveMe

on GameOver
   show image "GameOverSign" with visual effect dissolve slow
   move image "GameOverSign" to the points of graphic "Curve" in 3 seconds without waiting
   show graphic "GrayThing"
   show field "RestartInfo"
end GameOver

on DisableObjects
   disable button "minus100"
   disable button "doublePoints"
   disable button "clickMe"
   disable button "bonus1000"
end DisableObjects
the new version with a bug in the move...

Code: Select all

on ActivateTimer
   HideStart
   if field "timer" > 0 then
      subtract 1 from field "timer"
      send "ActivateTimer" to me in 1 sec
      put the result into _pendingMessage
   end if
   
   if field "timer" = 50 then show btn "Bomb"
   else if field "timer" = 30 then show btn "doublePoints"
   else if field "timer" = 20 then show btn "bonus1000"
   
   else if field "timer" = 0 
      then
      GameOver
      aeStopMoving "all"
      DisableObjects
      show button "Restart" #with visual effect dissolve very fast
      show widget "Info" 
      show widget "Home" 
      show widget "Settings" 
      HighScore
      HideBonuses
   end if
end ActivateTimer

on HideStart
   if field "timer" = 1
   then
      hide button "Start"
      hide button "Stop" with visual effect zoom in very fast
      end if
end HideStart


on GameOver
   show image "GameOverSign"
   move image "GameOverSign" to the points of graphic "Curve" in 3 seconds without waiting
   show graphic "GrayThing"
   show field "RestartInfo"
end GameOver

--this is from the animation stack--
on aeStopMoving tControl
   if tControl="all" then
      delete variable tAEEasing
   else
      delete variable tAEEasing[the long id of tControl]
   end if
end aeStopMoving

on DisableObjects
   disable button "minus100"
   disable button "doublePoints"
   disable button "clickMe"
   disable button "bonus1000"
end DisableObjects

on HighScore
   if field "userScore" > field "HighScore" of card "HomeCard"
   then
      put field "userScore" into _ghighScore
      put _ghighScore into field HighScore of card "HomeCard"
      answer "You've reached your high score!!:" & _ghighScore
      save this stack
   end if
end HighScore

on HideBonuses
   hide btn "doublePoints"
   hide btn "bonus1000"
   hide btn "Bomb"
end HideBonuses
I'm sharing all the script because the problem is almost 100% here and i can't find it...
BTW that's the animation stack https://github.com/derbrill/animationEngine
Thanks!
your first script contains 5 (FIVE) Handlers, the second script contains 7 (SEVEN) handlers
and throws an error at both lines with "delete variable..."
Maybe ->tAEEasing is neither LOCAL nor GLOBAL?

Code: Select all

on aeStopMoving tControl
   if tControl="all" then
      delete variable tAEEasing
   else
      delete variable tAEEasing[the long id of tControl]
   end if
end aeStopMoving
And this (save tis stack) will not work in a runtime, the script will actually STOP at that point and not execute what comes after that line!

Code: Select all

on HighScore
   if field "userScore" > field "HighScore" of card "HomeCard" then
      put field "userScore" into _ghighScore
      put _ghighScore into field HighScore of card "HomeCard"
      answer "You've reached your high score!!:" & _ghighScore

      ## Does nto work in a runtime!!!
      save this stack
      ## Does nto work in a runtime!!!
   end if
end HighScore
And please explain what does NOT work as exspected, I could not tell from your video!?


Best

Klaus

Re: move to the points of graphic

Posted: Tue Jan 18, 2022 6:56 pm
by jacque
@klaus I think you need the AE library to avoid the errors. If I remember right, Samuele is using a splash stack for the app, so the real mainstack should save okay.

If it were mine, I'd go back to the working script and add commands one at a time until I see what breaks it.

Re: move to the points of graphic

Posted: Tue Jan 18, 2022 8:45 pm
by Samuele
jacque wrote: Tue Jan 18, 2022 6:56 pm @klaus I think you need the AE library to avoid the errors.
yes, tried it without, doesn't work.
jacque wrote: Tue Jan 18, 2022 6:56 pm If I remember right, Samuele is using a splash stack for the app, so the real mainstack should save okay.
and yes

Re: move to the points of graphic

Posted: Tue Jan 18, 2022 8:59 pm
by Klaus
Ah, OK, I see, sorry...