Page 1 of 1

Get the current map?

Posted: Tue Sep 09, 2014 9:31 am
by BackRaw
Hi, quick question, can we get the current map yet with the September 7 release? :)

Posted: Tue Sep 09, 2014 10:46 am
by Ayuto

Posted: Tue Sep 09, 2014 11:22 am
by BackRaw
Woah! I didn't know 'globals' existed. How to import it?

Syntax: Select all

from globals import global_vars
like that? =) Okay, got it:

Syntax: Select all

from core import global_vars

# usage
global_vars.mapname() # right?
Or is it just like a python property?

Posted: Tue Sep 09, 2014 2:02 pm
by Doldol
BackRaw wrote:Or is it just like a python property?


It's a property. =]

I used to use GlobalVars.map_name
But it might have gotten renamed?

Posted: Tue Sep 09, 2014 3:25 pm
by satoon101
Yes, it is now global_vars.map_name. All singletons exposed from C++ and objects that are the one and only instance of a class were renamed from CamelCaps to lower_with_underscores a few weeks ago.

If you look at the link Ayuto provided, you should notice that anything that is defined by .add_property is a retrievable property value. Anything defined by .def_readwrite is a readable/writable attribute. And, anything defined by .def is a member function.

Also, anything that has NOT_IMPLEMENTED in front of it, is defined on an engine-by-engine basis.

One more thing, while the wiki is still a work in progress, the core package has been documented for some time:
http://wiki.sourcepython.com/index.php/core
http://wiki.sourcepython.com/index.php/core#global_vars
http://wiki.sourcepython.com/index.php/core#map_name

Posted: Tue Sep 09, 2014 10:42 pm
by BackRaw
Woah! didn't realize the wiki was updated :D that's good news