Gamemode by include
#21

Quote:
Originally Posted by Gammix
View Post
There is a difference in "modular scripting" and "object oriented scripting".
The word module is self explanatory. It means spliting your script, either by hooking way(which i recommend) or simple splitting.

Also another way out is using filterscripts and (S)PVars fpr script integration. The only reason you do modular type of scripting is for:
- Script integration (like you want to get player admin level in more than one module, like you have login dialog in login.pwn and want to access that variable in say houses.pwn)

- Making a part more readable and editable, like you know in future you want to change textdraws, you can make a function "CreateSelectionTextDraws" in a seperate module so it will be easy for modifying the tds)

- Plug'n'play features, they are same as filterscripts (like maps or objects; a custom vending machine script etc)

I remade serversided.inc using modular scripting technique, if you want a refrence here it is: https://github.com/Agneese-Saini/SA-...de/serversided
Actually, only important files that connect stuff like MySQL connection info or SQLite details should be in modules, and then included to the gamemode so it can be used in other scripts without rewriting it, but adding callbacks for an event in a module? how does that even make sense?

Modular design examples:
- create "houses.pwn/p/inc" module which contains the functions that adds houses, removes houses or edits houses.
- create "database" module that connects to database, returns connection handle, closes connection, etc.
- create "accounts" module that adds accounts, removes accounts, renames accounts, etc.

So it can be used in both gamemodes and other scripts.

The modular designs which I call shit:

- create "callbacks.pwn headers.pwn commands.pwn" for a single script, definitely not going to be used in other scripts so it's really useless to do that.

Anyways, it's possible to achieve some sort of basic/simple modular design in PAWN. Unlike other high level languages such as C++ or C#.
Reply


Messages In This Thread
Gamemode by include - by Dayrion - 22.02.2017, 12:48
Re: Gamemode by include - by jlalt - 22.02.2017, 12:53
Re: Gamemode by include - by Dayrion - 22.02.2017, 13:17
Re: Gamemode by include - by jlalt - 22.02.2017, 13:25
Re: Gamemode by include - by Dayrion - 22.02.2017, 14:52
Re: Gamemode by include - by jlalt - 22.02.2017, 14:57
Re: Gamemode by include - by PrO.GameR - 22.02.2017, 19:44
Re: Gamemode by include - by iKarim - 23.02.2017, 06:13
Re: Gamemode by include - by Sew_Sumi - 23.02.2017, 06:20
Re: Gamemode by include - by Yashas - 23.02.2017, 06:52
Re: Gamemode by include - by iKarim - 23.02.2017, 19:41
Re: Gamemode by include - by Dayrion - 23.02.2017, 23:47
Re: Gamemode by include - by Sew_Sumi - 24.02.2017, 00:50
Re: Gamemode by include - by iKarim - 24.02.2017, 05:17
Re: Gamemode by include - by DRIFT_HUNTER - 24.02.2017, 05:24
Re: Gamemode by include - by Sew_Sumi - 24.02.2017, 05:35
Re: Gamemode by include - by Gammix - 24.02.2017, 07:34
Re: Gamemode by include - by Dayrion - 24.02.2017, 10:21
Re: Gamemode by include - by DRIFT_HUNTER - 24.02.2017, 14:28
Re: Gamemode by include - by patrickgtr - 24.02.2017, 14:32
Re: Gamemode by include - by iKarim - 24.02.2017, 14:59
Re: Gamemode by include - by Dayrion - 01.03.2017, 22:27
Re: Gamemode by include - by azzerking - 01.03.2017, 23:41
Re: Gamemode by include - by Dayrion - 02.03.2017, 12:52
Re: Gamemode by include - by azzerking - 02.03.2017, 18:00
Re: Gamemode by include - by renatog - 02.03.2017, 19:50
Re: Gamemode by include - by Dayrion - 02.03.2017, 20:15
Re: Gamemode by include - by renatog - 02.03.2017, 20:58
Re: Gamemode by include - by Mauzen - 03.03.2017, 03:46
Re: Gamemode by include - by Y_Less - 03.03.2017, 10:25
Re: Gamemode by include - by RyderX - 03.03.2017, 10:49

Forum Jump:


Users browsing this thread: 3 Guest(s)