dagobaking Posted March 19, 2018 Posted March 19, 2018 I have set up a scene within a quest. That runs. But, now I would like to be able to run a function when one of the phases is completed and also use the referencealias associated with that phase/action. How does that need to be written from within the quest? I've tried:Event Scene.OnPhaseEnd(int auiPhaseIndex) Debug.Notification("Scene phase " + auiPhaseIndex + " has just finished") EndEventandEvent OnPhaseEnd(int auiPhaseIndex) Debug.Notification("Scene phase " + auiPhaseIndex + " has just finished") EndEventBoth give compile errors. I see that there is also Scene.OnAction. Is that the way to pull in the referencealias? Or, can I reach that somehow using the phaseindex?
dagobaking Posted March 19, 2018 Author Posted March 19, 2018 (edited) I discovered the problem. For anyone else troubleshooting this: You have to add a parameter to the Event. It is always the sender of the event. So, it has to be the correct type and most people use the label "akSender". So, it should be written like this:Event OnPhaseEnd(Scene akSender, int auiPhaseIndex) Debug.Notification("Scene phase " + auiPhaseIndex + " has just finished") EndEventIt would be helpful if the wiki authors just wrote it like that in their examples. Or, if they want to preserve the locally run syntax, at least include a note about this. Additional note. You also need to register to listen for the event like this:Self.RegisterForRemoteEvent(yourScene, "OnPhaseEnd") Edited March 19, 2018 by dagobaking
Evangela Posted March 21, 2018 Posted March 21, 2018 (edited) I'm curious about this. What object you're attaching this script to? Edited March 21, 2018 by Rasikko
werr92 Posted March 21, 2018 Posted March 21, 2018 On 3/21/2018 at 6:52 AM, Rasikko said: I'm curious about this. What object you're attaching this script to?This script is to be added on Quest itself.
Evangela Posted March 21, 2018 Posted March 21, 2018 Yeah that's why I asked that, because I did a test to verify his findings if the wiki article does indeed need to be updated(it was written by the language creator who doesn't work with the quest system), and it certainly wouldn't compile on a quest script, not even remotely. Though I'm unfamiliar with remote calls, so I probably did it wrong. So I was thinking if the OP attached it to a reference alias, or somewhere else within the quest. However it will compile if attached to the scene itself(which is obviously part of the quest).
Recommended Posts