[bfprog] Digest Configuration Variables - Update
"Einar S. Idsø"
esi at itk.ntnu.no
Wed Jul 27 01:42:45 PDT 2005
Have you taken a look at this?
http://bf2.fun-o-matic.org/index.php/Scripts:Modified_admin_script
It shows how you can import your own custom settings, as well as how you
can globalize them.
Hope this helps,
Einar, Kybber @ Battlefield.no
Andrew Armstrong wrote:
> Thanks for that.
>
> Im thinking due to the way the multiple server configurations are setup, ill
> just have to include the 'read config data' (parseConfig) function in my own
> script, unless I can specify how to import a specific file.
>
> For example, I dont just have default.py and default.cfg - They are called
> server1.py and server1.cfg (and they work together).
>
> Is it possible to do the following in server1.py for example:
>
> import myscript
>
> myscript.init(1)
>
> Then in myscript.py:
>
> def init(servernum)
> from (server + servernum) import options
> ... Then use the options array
>
> I dont see that working though :)
>
> Alternativly, I can just place the parseConfig code in my script and re-read
> it again on initilization (when init() is called) and maintain the array
> myself, this seems the best solution.
>
> One issue I have with that solution though is, how can I access variables
> between the functions (Eg, I create the options array again in init(), how
> can I then access it (from within the same python file, myscript.py) in
> another function? Im talking about global variables.
>
> So in:
>
> def init(servernum)
> # Setup the options array here
>
> def anotherfunction()
> # I can access the options array that I created in init() earlier
>
> Any ideas?
>
> Thankyou for the help so far.
>
> - Andrew
More information about the BFProg
mailing list