Author Topic: Global Script house keeping  (Read 345 times)

Global Script house keeping
« on: 10 Oct 2021, 23:15 »
Hello.

My global script is growing and growing, and now it is so long that it is really difficult to read.
How it would be the best solution to keep all the Character and inventory interactions in separated scripts?

Regards.

Slasher

  • .
    • I can help with AGS tutoring
    • I can help with scripting
    • I can help with story design
    • Lifetime Achievement Award Winner
    • Slasher worked on one or more games that won an AGS Award!
    •  
    • Slasher worked on one or more games that was nominated for an AGS Award!
Re: Global Script house keeping
« Reply #1 on: 12 Oct 2021, 04:38 »
Use Modules...

Re: Global Script house keeping
« Reply #2 on: 12 Oct 2021, 07:39 »
You should find a bunch of existing topics about this; the general idea is to use CallRoomScript or modules to distribute the code among other scripts.

Re: Global Script house keeping
« Reply #3 on: 12 Oct 2021, 18:50 »
The trouble with modules is, a lot of event functions must reside in GlobalScript.asc, the character and inventory events among them.
You can, of course, do something like

Code: Adventure Game Studio
  1. function cEgo_UseInv()
  2. {
  3.     EgoUseInv();
  4. }
move EgoUseInv() into some script module and let EgoUseInv() do the real work. But the stub that calls EgoUseInv() will still muddle up GlobalScript.asc.
« Last Edit: 12 Oct 2021, 22:24 by fernewelten »

Re: Global Script house keeping
« Reply #4 on: 12 Oct 2021, 22:09 »
I see, then I don't have too much to do.