SA-MP Forums Archive
Splitting one big script to more smaller ones. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Splitting one big script to more smaller ones. (/showthread.php?tid=452741)



Splitting one big script to more smaller ones. - Roko_foko - 22.07.2013

Hello people!

As title says, I want to know is it possible to split one big script( 26k lines ) to more smaller scripts.
If yes, should I do it with filterscripts, includes ( not sure if possible ) or something else?
I want to do that to make debugging and bug fixing better and faster by splitting systems(vehicles, jobs, factions, etc.) in special files.

Tell me what you think. Thank you for your time


Re: Splitting one big script to more smaller ones. - Mauzen - 22.07.2013

Put them in different includes, and just include them in the main gamemode pwn.
Using tons of filterscripts is slow as hell, and communication between them is even slower and unhandy.


Re: Splitting one big script to more smaller ones. - Roko_foko - 22.07.2013

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Put them in different includes, and just include them in the main gamemode pwn.
Using tons of filterscripts is slow as hell, and communication between them is even slower and unhandy.
I hoped to hear this. One more question. By doing this with includes, can I split callbacks.
For example if in my OnPlayerConnect in Gamemode looks like this:
Код:
public OnPlayerConnect(playerid)
{
    SendClientMessage(TextOne);
    SendClientMessage(TextTwo);
...
}
am I able to split it like this:
Код:
//INCLUDE#1
public OnPlayerConnect(playerid)
{
    SendClientMessage(TextOne);
    return 1;
}
//INCLUDE#2
public OnPlayerConnect(playerid)
{
    SendClientMessage(TextTwo);
    return 1;
}
//INCLUDE#2
public OnPlayerConnect(playerid)
{
    ...
    return 1;
}
Thank you for your response


Re: Splitting one big script to more smaller ones. - iggy1 - 22.07.2013

If you want to use the same callback in your includes like you said, you will need to hook the callback.

y_hooks makes it easy to hook callbacks.

Good read if you don't know what callback hooking is: Advanced library sytem (ALS)