1
SCI Syntax Help / Re: changeState woos
« on: Today at 11:53:04 AM »
Thanks for the reply. I think I was messing things up pointing to and from RoomScript and IvanaScript. I've made it a little simpler by moving all of Ivana's actions into her script. But I still have the moonwalk animation when she is returning to the counter after being at the soda machine, which is changeState 16 onwards of the IvanaScript. There is also the issue that sometimes she still walks off her path as indicated in the sreenshot2.
What is happening in the scene is the following:
Ivana is running her IvanaScript changeState 0 through to 7 (which is walking back a forward behind the counter. She will only stop if talked to by ego and this goes to changeState 8 to 11 then goes back to walking behind the counter changestate 0.
When ego presses the button on the soda machine with the said:
New RoomScript changeStates:
New IvanaScript changestate:
I've had to add in the Ivanascript changestates number 17 (self changeState: 18) otherwise it would not move onto changeState 18. It was getting stuck there for some reason? I forced the Cycler there to setCycle Walk also. Not sure if this is right?
There are things I still dont fully understand with the changeStates. When to setCycler, when to use Beg, When to use self. Does the order of the syntax's affect the outcome? eg: putting SetCycler: before setMotion etc.
What is happening in the scene is the following:
Ivana is running her IvanaScript changeState 0 through to 7 (which is walking back a forward behind the counter. She will only stop if talked to by ego and this goes to changeState 8 to 11 then goes back to walking behind the counter changestate 0.
When ego presses the button on the soda machine with the said:
Code: [Select]
(if (Said 'press/button')
(self changeState: 1)
)
)
this triggers (RoomScript changeState 0 through to 5 then queue's Ivanascript on changeState 6). This then makes Ivana walk out from behind the counter using changeState 12 to 21 changeStates of the Ivanascript. New RoomScript changeStates:
Code: [Select]
(method (changeState newState)
(ShowState self newState 1 2) ; Displays changeState info on screen when debug is enabled.
(= state newState)
(switch state
(0
)
(1 ; Ego goes to soda Machine
(ProgramControl)
(gEgo
illegalBits: 0
ignoreActors:
setMotion: MoveTo 158 177 self
)
)
(2 ; Ego presses soda machine button
(gEgo
cycleSpeed: 1
view: 707
setLoop: 2
setCycle: End self
)
)
(3 ; Done pressing button
(gEgo setCycle: Beg self)
)
(4 ;Soda machine turns on
(gEgo view: 000 setCycle: Walk loop: 3)
(ProgramControl)
(aSoda setCycle: Fwd)
(self changeState: 5)
)
(5
(PlayerControl)
(SetUpEgo) ;this sets ego back to normal
(= cycles 10)
)
(6
(aIvanaScript cue: changeState: 12) ; Ssets up Ivana script to move out behind counter and move to the sosa machine.
)
)
)
)
New IvanaScript changestate:
Code: [Select]
(method (changeState newState &tmp IvanaLoop)
(ShowState self newState 1 2) ; Displays changeState info on screen when debug is enabled.
(switch (= state newState)
(0
(= seconds (Random 4 8))
)
(1
(aIvana
illegalBits: 0
setPri: 8
cycleSpeed: 0
setLoop: -1
setCycle: Walk
setMotion: MoveTo 72 124 self ;Ivanna walks up
)
)
(2
(= seconds (Random 4 8))
)
(3
(aIvana setMotion: MoveTo 53 138 self) ;Ivanna walk down
)
(4
(= seconds (Random 4 8))
)
(5
(aIvana setMotion: MoveTo 53 134 self) ;Ivanna walk down part 2
)
(6
(= seconds (Random 3 9)) ; Ivana does some random poses
(switch (= IvanaLoop (Random 0 5))
(0
(aIvana loop: 6 cycleSpeed:4 setCycle: End self)
)
(1
(aIvana loop: 7 cycleSpeed:4 setCycle: End self)
)
(else
(= state -1)
)
)
)
(7
(self changeState: 0) ;Returns to the start. Only interupted if talked to.
)
(8
(aIvana setMotion: MoveTo 63 128 self) ; Let's try and talk. Ivanna stops and goes to central point.
)
(9
(aIvana setLoop: 5 cycleSpeed:4 setCycle: Beg) ;Talk a little
(= seconds 3)
)
(10
(aIvana setCel: 0 setLoop: 0)
(= cycles 10)
)
(11
(cond
(register
(switch register
(101
(PrintA 33 7) ; "test 2"
)
(102
(PrintA 33 6) ; "test 3"
)
)
)
(else
(switch msgVar
(0
(PrintA 33 8) ; "test 1"
)
(1
(PrintA 33 9) ; "Yes? May I help you?"
)
(2
(PrintA 33 10) ; "Would you like me to call security?"
)
(3
(PrintA 33 11) ; "How may I help you?"
)
)
(if (> (++ msgVar) 3)
(= msgVar 0)
)
)
)
(self changeState: 0) ;Start all over again.
)
(12
(aIvana
illegalBits: 0
cycleSpeed: 0
setLoop: -1
setCycle: Walk
setMotion: MoveTo 78 120 self ;Ivana walks out behind desk
)
)
(13 ;Ivana walks path to soda machine
(aIvana setPri: -1 setMotion: MoveTo 111 119 self)
)
(14 ;Ivana walks path to soda machine
(aIvana setMotion: MoveTo 87 179 self)
)
(15 ;Ivana walks path to soda machine
(aIvana setMotion: MoveTo 143 179 self)
)
(16 ;Ivana faces soda machine and scratches head and waits.
(aIvana loop: 6 cycleSpeed: 2 setCycle: End self)
;(= cycles 20)
)
(17
(aSoda setCel: 0) ;Soda machine stops.
(aIvana setCycle: Walk setLoop: -1)
(aIvana setMotion: MoveTo 143 173 self) ;Ivana starts walk back to counter.
(self changeState: 18)
)
(18 ;Ivana walks path back behind counter
(aIvana setMotion: MoveTo 87 179 self)
)
(19 ;Ivana walks path back behind counter
(aIvana setMotion: MoveTo 111 119 self)
)
(20 ;Ivana walks path back behind counter
(aIvana setCycle: Beg setMotion: MoveTo 78 120 self)
)
(21 ;Ivana walks path back behind counter
(aIvanaScript changeState: 1)
)
)
)
)
I've had to add in the Ivanascript changestates number 17 (self changeState: 18) otherwise it would not move onto changeState 18. It was getting stuck there for some reason? I forced the Cycler there to setCycle Walk also. Not sure if this is right?
There are things I still dont fully understand with the changeStates. When to setCycler, when to use Beg, When to use self. Does the order of the syntax's affect the outcome? eg: putting SetCycler: before setMotion etc.