Author Topic: Passing 'self' or 'super' through a procedure  (Read 2550 times)

0 Members and 1 Guest are viewing this topic.

Offline MusicallyInspired

Passing 'self' or 'super' through a procedure
« 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?
« Last Edit: April 03, 2016, 11:48:02 PM by MusicallyInspired »


Brass Lantern Prop Competition

Offline troflip

Re: Passing 'self' or 'super' through a procedure
« Reply #1 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.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline MusicallyInspired

Re: Passing 'self' or 'super' through a procedure
« Reply #2 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).
Brass Lantern Prop Competition


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.032 seconds with 23 queries.