New instance to run event cases

Robert Eric I've been trying to use an instance of Script to run my cases instead of RoomScript, to keep things in order. I have:

In RoomScript

(if(== (send gEgo:onControl()) ctlGREEN)
(if(Said('talk'))
(send gEgo:setMotion(MoveTo 50 50 moveScript))
)
)

In it's own instance

(instance moveScript of Script
(properties)
(method (changeState newState)
= state newState
(switch (state)
(case 0
Print("He moved.")
= cycles 10
)
(case 1
Print("He's still there.")
= cycles 10
)
(case 2
Print("The view has moved to it's first position!")
= cycles 10
)
)
)
)

When I'm on the green control, and I type "talk", he walks to 50,50, but then nothing happens. Any ideas?
Eigen The code works here...

Are you sure it reaches 50 50? Maybe there's something blocking the way.



-Eigen
cloudee2 You are trying to get it to do all cases in one pass aren't you? It seems to be a bit of a debate about this type of thing in other posts but what I have become convinced of is that the Roomscripts changestate is the only place that works, these other instances only seem to be good for one case actions, or to illustrate how your script worked in my test game:

first time talk, dude treked over and said "he moved"
... then nothing
wander around talk again and this time he goes and reports "he's moving"
... then nothing
roam some and talk again and away he goes again "reached his position"

I assume that isn't the desiredresponse however?



Robert Eric I thought it was supposed to run the next case no matter if you have an actor move, animate, have a sound play, Print(), or Display() something? I have those Print() functions to test that theory. It works in the RoomScript instance, but if it can't do the same in a seperate Script instance, then that really bytes. I mean, bites.

Edit: Actually, I put it in RoomScript, but it didn't work. He moved to 50, 50, then stopped, and nothing happened.
cloudee1 Hey Rob Bob,
When I stick this in roomscript, it works. With just this, upon room start it prints the statements.
(instance RoomScript of Script(properties)
(method (changeState newState)
= state newState
(switch (state)
(case 0
Print("He moved.")
= cycles 10
)
(case 1
Print("He's Moving.")
= cycles 10
)
(case 2
Print("The view has moved to it's first position!")
= cycles 10
)
)
)
(method (handleEvent pEvent)


now just add a local variable and check against it as to whether to start this or not and you should be fine
Robert Eric It DOES work, but I was hoping to be able to use it in it's own instance. I guess this will do for now, until I can figure it out on my own. Thanks cloudee.
cloudee1 me too, but I couldn't ever get mine to work ::)