Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Jimi on Tue 29/04/2003 19:24:24

Title: Suggestion: Global Scripts.
Post by: Jimi on Tue 29/04/2003 19:24:24
I had an idea of Global Scripts. They could be used in exactly the same way as Global Messages, only they are scripts. In the room script, you could type something like...

RunGlobalScript(4);

...and it would run global script 4 that could be edited in the Global Scripts Menu.

I think this could be useful, because if you had a number of thing that have the same script, for example...

int ran=Random(2);
if (ran==0) {
  DisplaySpeech(GUYBRUSH,"mmm...no!");
  }
else if (ran==1) {
  DisplaySpeech(GUYBRUSH,"My pirate instincts tell me I should keep this to myself");
  }
else DisplaySpeech(GUYBRUSH,"I don't think that's wise");
  }


...that was just an example, but you could use Global Scripts for all sorts of things! I think everyone would benifit from this.

What do you think?  :)
Title: Re:Suggestion: Global Scripts.
Post by: Barcik on Tue 29/04/2003 19:37:54

We have them. They are called custom functions.
Title: Re:Suggestion: Global Scripts.
Post by: Pumaman on Tue 29/04/2003 20:09:08
It's perhaps not the most well documented part of AGS, but look up "Calling global functions from local scripts" in the manual.
Title: Re:Suggestion: Global Scripts.
Post by: Jimi on Tue 29/04/2003 20:35:44
Okely Dokely. Thanks!