Ok j, I cleaned up your code a little bit you had a couple of funny things going on. Methods should never appear inside of each other. You can have several types of methods acting in a roomscript, but they each close before a new one starts, just like instances, you'll notice that the entire roomscript is an instance of a script and it ends before the other instances begin. Each method has kind of different rules to go by just like instances. For instance it doesn't make sense to apply motion to an instance of sound or to play() a view, certain methods are used for certain things. doit method checks your if statements every cycle. the handle event method is used to get user input either from the keyboard, mouse, or joystick, if there is no input then it doesn't bother doing anything. The changestate is used to change things around sequentially, but only when its told to.
Also instead of checking for program control around each statement in the doit method, we can just check once and stick those other if statements inside of it. But remember only the things you want to happen when program control is set should go inside there, If you want something checked regardless, it would still need to be in the doit method but outside of the "(if(not(gProgramControl)) ... ) // ends not program control" statement
Here is what I got out of your roomscript instance. You may want to take a moment to compare yours and this.(instance RoomScript of Script
(properties)
(method (doit)
(var dyingScript)
(super:doit())
(if(not(gProgramControl))
(if(< (send gEgo:distanceTo(aMan)) 15)
ProgramControl()
= dyingScript ScriptID(DYING_SCRIPT)
(send dyingScript:caller(3)register("You're dead"))
(send gGame:setScript(dyingScript))
)
(if(< (send gEgo:distanceTo(aMan2)) 15)
ProgramControl()
= dyingScript ScriptID(DYING_SCRIPT)
(send dyingScript: caller(4)register("You're dead"))
(send gGame:setScript(dyingScript))
)
(if(< (send gEgo:distanceTo(aMan3)) 15)
ProgramControl()
= dyingScript ScriptID(DYING_SCRIPT)
(send dyingScript:caller(5)register("You're dead"))
(send gGame:setScript(dyingScript))
)
(if(< (send gEgo:distanceTo(aMan4)) 15)
ProgramControl()
= dyingScript ScriptID(DYING_SCRIPT)
(send dyingScript:caller(6)
register("You're dead"))
(send gGame:setScript(dyingScript))
)
) // ends not program control
)// end method
(method (handleEvent pEvent)
(super:handleEvent(pEvent))
(if(Said('look'))
Print("You are in a room...ahhhh there are ghosts all around you stay away from them!!!")
)// end said look
) // end method
) // end roomscript instance
(instance aMan of Act (properties y 185 x 220 view 3))
(instance aMan2 of Act (properties y 18 x 20 view 4))
(instance aMan3 of Act (properties y 85 x 200 view 5))
(instance aMan4 of Act (properties y 50 x 10 view 6))
Hope this helps clear some things up.