[bfprog] Digest Configuration Variables - Update

Andrew Armstrong andrewa at bigpond.net.au
Wed Jul 27 05:22:11 PDT 2005


Managed to get something working by globaling the options array.

Thanks a lot for your and Forrest's help.

- Andrew

----- Original Message -----
From: "Einar S. Idsø" <esi at itk.ntnu.no>
To: "Battlefield Programming" <bfprog at lists.matureasskickers.net>
Sent: Wednesday, July 27, 2005 6:42 PM
Subject: Re: [bfprog] Digest Configuration Variables - Update


> 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
> _______________________________________________
> BFProg mailing list
> BFProg at lists.matureasskickers.net
> http://lists.matureasskickers.net/mailman/listinfo/bfprog



More information about the BFProg mailing list