Global Script house keeping

Started by nightmarer, Sun 10/10/2021 23:15:09

Previous topic - Next topic

nightmarer

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


Khris

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.

fernewelten

#3
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: ags
function cEgo_UseInv()
{
    EgoUseInv();
}

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.

nightmarer

I see, then I don't have too much to do.

SMF spam blocked by CleanTalk