Visual Effect and Initial Commands "disappear" on card transition

Sannyasin Brahmanathaswami brahma at hindu.org
Sat Feb 6 04:33:28 CET 2016


 

For LC mystery forensics experts.  

I will attempt to send sweet dreams from Hawaii to anyone who can solve this problem.  

go stack url "http://dev.himalayanacademy.com/stacks/SivasHawaiiRevels/SivasHawaiiRevels.livecode”


Disclaimer: if you are appalled by my architecture, its’ because I don’t know what I’m doing…this world of animiation/presentation etc all new.  

I want users to drive events from a button on screen (on the right), so I set some custom prop flags and then this handler in the stack script does the work:  

on nextEvent  
put the uNextEvent of this card into tEvent
switch tEvent
case "nextStage" # set/called when all scenes are done on a card
put the uNextStage of this stack into tNextCard
visual effect dissolve very fast
go to card tNextCard
break
case "scene2"
send "scene2" to this card # almost always is one
break
case "scene3"
send "scene3" to this card # may not be one
break
case "scene4"
send "scene4" to this card # may not be one
break
end switch
end nextEvent

In the case of card 1, this is a title card… so I have the script drive the event, which is to go to the next card (s) after Animation Engine finishes some moves like this, the “nextEvent” command issue issued automatically:  

local tHALogo, tCompanyTitle  

on preOpenCard  
setStage
end preOpenCard

on opencard  
scene1
end opencard

command setStage  
put the long id of fld "companyTitle" into tCompanyTitle
put the long id of img "HaLogo" into tHaLogo

set the rect of tHALogo to 0,0,500,500
set the loc of tHALogo to the loc of this card
set the loc of tCompanyTitle to 1170,-123
hide grp "Navigators"
end setStage


command scene1  
set the uNextStage of this stack to "Stage1"
set the uNextEvent of this card to "nextStage"
aeLockMoves
aeChangeRect tHALogo, 40,40,220,220,1500,"overshoot"
aeMoveTo tCompanyTitle, the loc of this card, 1500, "inOut"
aeUnlockMoves
end scene1


on aeMoveDone  
nextEvent

end aeMoveDone

———  

This should cause LC to open Card 2 with a dissolve and run the preopen and open card scripts  

SetStage runs as expect, but  
scene1 does not (when coming from cd 1 only)

local tStage1Layer1, tModuleTitle  

on preopencard  
setStage
end preopencard

on openCard  
scene1
end openCard

# all objects:  

command setStage  
put the long id of img "stage-1_layer-1" into tStage1Layer1
put the long id of fld "moduletitle" into tModuleTitle
hide tStage1Layer1
hide tModuleTitle
hide grp "Navigators"
set the rect of tStage1Layer1 to the uMyEffects["startsizelocation"] of tStage1Layer1
end setStage

command scene1  
# first scenario
show img "stage-1_layer-1" with visual effect dissolve slowly

#second scenario
wait 2 seconds
put the uMyEffects["move1sizelocation"] of tStage1Layer1 into tNewLocation
put the uMyEffects["move1speed"] of tStage1Layer1 into tMove1Speed
aeChangeRect tStage1Layer1, tNewLocation,tMove1Speed,"out"
set the uNextEvent of this card to "Scene2"
show grp "navigators"

end scene1

command scene2 # this works  
show tModuleTitle


#only one scenario and then we are done... move on to next card/stage
set the uNextEvent of this card to "nextStage"

# next stage will be a puzzle:
set the uNextStage of this stack to "word-puzzle"

# we need to set the next puzzle number ahead of time
set the uPuzzleNo of card "word-puzzle" to 1


end scene2

This works fine for every transtion from card 2 to card 3, card 3 to card 4  

you can do go to card 3 (the puzzle) and do cmd 2 to go back and the script on Card 2 performs as expected  

BUT: when the script on card 1 runs. LC sticks on card 1 where I have my “wait 2 seconds” (in the cd 2, scene1 handler) and does not go to card 2 until those 2 seconds pass and then it ignores this completely  

# first scenario  
show img "stage-1_layer-1" with visual effect dissolve slowly

“For the life of me” I can figure out why….  

BR  

p.s. any advice on the approach one should talk to solving this kind of problem will help me… I tend to spin wheels… should one turn on the message watch, set a break point and step through… How do you do debugging, when there is no actual error, but things don’t perform as expected?  





More information about the use-livecode mailing list