Community
SCI Programming => SCI Syntax Help => Topic started by: Cloudee1 on November 12, 2013, 09:31:03 AM
-
Ok, so I have a global variable declared in the main script, rememberState. I have an actor who is being controlled in it's own script, passingBy which just consists of a changestate. The actor walks from off screen all the way across offscreen and back. I have a local variable whichWalker set up so that the view is randomly selected.
(instance passerBy of Act(properties x -10 y 133 view 504 loop 0))
(instance passingBy of Script
(properties)
(method (changeState newState)
= state newState
(switch (state)
(case 0 = whichWalker Random(504 505)
(passerBy:view(whichWalker))
= seconds Random(4 12)
)
(case 1 (passerBy:setCycle(Walk) setMotion(MoveTo 330 133 passingBy)))
(case 2 = whichWalker Random(504 505)
(passerBy:view(whichWalker))
= seconds Random(8 16)
)
(case 3 (passerBy:setCycle(Walk) setMotion(MoveTo -10 133 passingBy)))
(case 4 (self:changeState(0)))
) // switch end
) // method end
) // instance end
I am trying to capture the current state number of the passingBy script to the global variable so that I can leave the room and start the actor back up where it left off upon return. I had thought that this would work
= rememberState (passingBy:changeState)
Unfortunately I was wrong. Anyone have any ideas on how I can accomplish this
-
Yes, create a property called 'state', then you should be able to do this:
=rememberState (passerBy:state)