States

AndyPanda I read through the help file and the tutorial, and I still don't fully understand how to use states. Sorry if I'm asking too much on the board, but I really tried hard on this. Here's the script that I'm struggling with. I can't get it past case 1. I have the cycle property set on case 1, so I don't understand why it won't go any further:

/*
TV-SEQUENCE
*/
(instance TVSEQ of Script
(properties)
(method (changeState newState) = state newState
(switch(state)

(case 0
Print("Let's see if I'm lucky tonight." #title "You say:")
(send gEgo:
setMotion(MoveTo 250 98 TVSEQ))
= cycles 10
)
(case 1
SetUpEgo(1 20)
(TV:
init()
setCycle(Fwd)
cycleSpeed(5))
= cycles 20
)
(case 2
Print("...and tonight one lucky person will win the first price in the <clever name here>-lottery.)")
Print("If you have number 291839 on the back of your lottery ticket, please call 1-800-3518 now!")
Print("Your reach inside your pocket, and pick up the lottery ticket.")
= cycles 15
)
(case 3
Print("I WON!!!"#font LARGE_FONT #title "You say:")

)
)
)
)

By the way, I use this to get there:

(if(Said('watch/tv'))
(if(send gEgo:has(INV_TICKET))
(TVSEQ:cue(state))
)(else
Print("There's nothing but soap operas on right now, so you decide not to.")
)

Andreas
cloudee1 Hey Andy,

It seems that the main roomcript changestate will work in that way, But other instances do not.

you can also look here:
http://www.mega-tokyo.com/forum/index.php?board=5;action=display;threadid=5675
or here, this one takes a while to get going, but may help:
http://www.mega-tokyo.com/forum/index.php?board=5;action=display;threadid=4832

If you figure it out, let us know. ;)
AndyPanda I finally came up with something that worked (thanks, cloudee). I used the changestate in the roomscript, and used some variables. Much harder, but it works ;D But something tells me I'll have to find a better way to do it later on, since this example is a fairly simple one.