Currently I have it so that when something happens say a switch is turned on or something like that I call a common event:
$gameTemp.reserveCommonEvent(eventId);
But if I try and do that again it wont get called again. I have to then try a third time to call it and then it gets called. So:
first time: $gameTemp.reserveCommonEvent(eventId); - common event is called.
second time: $gameTemp.reserveCommonEvent(eventId); - common event is not called
third time: $gameTemp.reserveCommonEvent(eventId); - common event is called.
Is this not the correct way to call common events on the fly?
You better go back three steps, because I think you overcomplicate matters.
Why do you even want to call a common event by script? why not have it react directly to the switch, without using any scripting?
Accessing the game loop from script is not easy, and you'll need that if you want to program it to include something (that is why the function is named "RESERVEcommonevent" instead of calling it).
It is a lot easier to use the already existing functions of events to place something in the gameloop or have them react to something from it.
For example, if you want a common event to be processed on a switch, then make that common event a parallel process conditioned to that switch. If you want it to react only once, either disable the switch with the last command or use two switches (one for the event and one for whatever other info that needs to be stored).
If that isn't what you want, then please tell us exactly what you want to do instead of how you want it to do, and we tell you how to handle it correctly without going into complications like you try above.
While this helps it doesn't answer my main question: How do you call a common event via script, I assume this was the right way to do it.
All I need to know is "Use this code to call a common event" if its not that simple then I guess I can elaborate more on what I want to do.
It doesn't answer your question, because for most cases your question is wrong. That is what I'm trying to tell you - for most effects you should NOT call a common event from a script, and I wanted to know why you even try that to see if you don't better go a different way to achieve what you want.
I think ill keep looking since you didnt answer my question. Thanks though.
So this is the correct way, I was doing something weird in my event with switches. Once I removed the stupidity it works the way I need it too.