Multiple File Interaction
#1

Say I have 3 files...
file1.pwn
file2.pwn
file3.inc
... and file3.inc has a gloabal variable 'vari' declared at the top, whilst file1.pwn and file2.pwn are both filterscripts that have #include <file3> at the top.

If in file1 I do something like vari=5; will file2 now recognise vari as '5', or will it be '5' to file1 and '0' to file2?

I've recently started getting all the info about header size, code size, data size etc etc when compiling a script, so have been trying to spread code out in an appropriate manner, but just can't seem to get it working in harmony yet

Hope all this makes sense, and thanks in advance for your help and patience :P
Reply
#2

I think that vari will be 5 just for the file where you defined it to be five. There's no reason for the file to interact with the include, it just reads it, and replaces the value of that variable with the one you're giving to it locally.
Reply
#3

Quote:
Originally Posted by Benjo
If in file1 I do something like vari=5; will file2 now recognise vari as '5', or will it be '5' to file1 and '0' to file2?
It will be recognised by file2 as '0'.
I just tested it for you.

Conclusion: Filterscripts does not 'share' includes.
Reply
#4

Thanks very much both of you, that's stopped me making a very time-consuming mistake before I got in too deep :P Now too find an alternate solution... xD
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)