Linking Pawn Files -
spd_sahil - 23.01.2012
Is it possible to access my other pawn files from one pawn file ?? as in .. the main one can retrieve stuff from another pawn file..
Re: Linking Pawn Files -
JamesC - 23.01.2012
You can include all your other .pwn files into one.
pawn Код:
#include "other_file.pwn"
This will be compiled into one AMX file that has all the other pawn files included.
Re: Linking Pawn Files -
spd_sahil - 23.01.2012
Will Doing this only create ease in reading the script. or does it affect your script processing time or anything like that /
Re: Linking Pawn Files -
cessil - 23.01.2012
Quote:
Originally Posted by JamesC
You can include all your other .pwn files into one.
pawn Код:
#include "other_file.pwn"
This will be compiled into one AMX file that has all the other pawn files included.
|
no you can't
there's ways to retrieve variables and ways to retrieve functions from other scripts, which are you interested in? It might be better to convert one to an include or combine them in the one script
Re: Linking Pawn Files -
JamesC - 23.01.2012
It will not make a difference to performance as all the files are compiled into one amx file. Splitting up the gamemode just makes it easier for you to manage everything. For example, you can do the following:
pawn Код:
#include "gm_players"
#include "gm_timers"
#include "gm_cmds"
#include "gm_vehicles"
Re: Linking Pawn Files -
Bakr - 23.01.2012
Quote:
Originally Posted by cessil
no you can't
there's ways to retrieve variables and ways to retrieve functions from other scripts, which are you interested in? It might be better to convert one to an include or combine them in the one script
|
Care to explain? As JamesC's way is correct and can be done like such.
@Original Poster: No, it will only affect the amount of time it takes to compile, which is of no worry.
Re: Linking Pawn Files -
cessil - 23.01.2012
Quote:
Originally Posted by Bakr
Care to explain? As JamesC's way is correct and can be done like such.
@Original Poster: No, it will only affect the amount of time it takes to compile, which is of no worry.
|
well then it'd be an include and should be named with the extension .inc, you could use the extension .pwn
you'd also have to edit the filterscript so it doesn't interfere with the current script, such as hooking duplicate uses of functions/callbacks or renaming them.
Re: Linking Pawn Files - T0pAz - 23.01.2012
Quote:
Originally Posted by cessil
well then it'd be an include and should be named with the extension .inc, you could use the extension .pwn
you'd also have to edit the filterscript so it doesn't interfere with the current script, such as hooking duplicate uses of functions/callbacks or renaming them.
|
File Extension doesn't matters. As along as your writing the proper code onto the file without duplicate stuffs, you are good to go.
Re: Linking Pawn Files -
Abreezy - 23.01.2012
Best way to do this is:
pawn Код:
#include "../gamemodes/larp.functions.pwn"
Of course you would name the "larp.functions" to whatever you have your file as. I currently do this and it works without flaws.
Re: Linking Pawn Files -
cessil - 23.01.2012
that's fine for other languages that use classes and such, however for consistency and less problems you'd use .inc for includes.
it's fine if you're only going to keep the scripts to yourself, however if you're working in a team or releasing scripts and everyone else has to change their ways to match yours they might get annoyed instead of following what they'd normally do.
Re: Linking Pawn Files -
Bakr - 23.01.2012
Quote:
Originally Posted by cessil
that's fine for other languages that use classes and such, however for consistency and less problems you'd use .inc for includes.
it's fine if you're only going to keep the scripts to yourself, however if you're working in a team or releasing scripts and everyone else has to change their ways to match yours they might get annoyed instead of following what they'd normally do.
|
For less problem? Like what? And when you say, "instead of following what they'd normally do," so YOU (as the person with the special extension) should do what you normally don't in those cases? Sounds absurd, after all, you'd be sharing the code.
Either way, I get what you mean as far as consistency and understand your concepts.
Re: Linking Pawn Files -
MorbidSaint - 24.01.2012
I was planning on asking this question, since I've seen most gamemodes just having all code in one .pwn file, which is really annoying to read/understand.
What is the difference between a filterscript and an include file?
Re: Linking Pawn Files -
MorbidSaint - 25.01.2012
Ok thanks, that clears it out. I'm still afraid of starting to write my first gamemode because I know there are so much more features in Pawn and in plugins that could save me a lot of time.