How to make universal turns scripts?

Local_Redditor
21 Sept 2021, 15:17

I just want to know how to make turn scripts affect every room and object.


mrangel
21 Sept 2021, 17:19

If you put a turnscript in a room, it will only work while the player is inside that room. If turnscripts aren't inside an object, it will run whenever it is enabled.

You can create them at the bottom of the game's "Scripts" tab.


Local_Redditor
22 Sept 2021, 08:46

Well, considering I asked how I can sort commands in my last question, how can I do the same for these turn scripts?

Also, thanks for the previous response.


mrangel
22 Sept 2021, 09:43

You could sort turnscripts in the editor by putting them into rooms, and have a script that runs at the start of the game to move them outside the room. For example, if you organised them all into rooms under a room called turnscripts_container, your script could be:

foreach (ts, AllTurnScripts()) {
  if (Contains (turnscripts_container, ts)) {
    ts.parent = null
  }
}
destroy ("turnscripts_container")