Community

SCI Programming => SCI Syntax Help => Topic started by: MusicallyInspired on April 03, 2016, 11:46:00 PM

Title: Passing 'self' or 'super' through a procedure
Post by: MusicallyInspired on April 03, 2016, 11:46:00 PM
Two questions:

1) If I use 'self' in a procedure to trigger a caller, will that send it back to wherever the procedure was called from?
2) What if I want to choose which caller specifically that I want to call from a procedure (rmScript or a custom script)? Can I name it outright when used and pass it into the procedure as a param variable?
Title: Re: Passing 'self' or 'super' through a procedure
Post by: troflip on April 03, 2016, 11:55:14 PM
Generally, yes (if I understand your question).

"self" just pushes a pointer to the current object onto the parameter stack. Using the object name directly (e.g. "roomScript") should also work. Using a variable that has a pointer to the object should also work.


The usual behavior of these things is to call the cue() method on the object. The implementation of cue() for a Script object just calls changeState() with the current state plus one.
Title: Re: Passing 'self' or 'super' through a procedure
Post by: MusicallyInspired on April 04, 2016, 12:02:52 AM
Thank you! It seems to be working exactly as I intended it to. I don't think a cue method would work for my script object seeing as it's just an isolate changeState sequence that triggers the next rmScript state after it's all finished (just because I didn't want to clog up the room's changeState method with 30+ states).