Get the current map?

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Get the current map?

Postby BackRaw » Tue Sep 09, 2014 9:31 am

Hi, quick question, can we get the current map yet with the September 7 release? :)
My Github repositories:

Source.Python: https://github.com/backraw
User avatar
Ayuto
Project Leader
Posts: 2209
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Tue Sep 09, 2014 10:46 am

User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Postby BackRaw » Tue Sep 09, 2014 11:22 am

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?
My Github repositories:

Source.Python: https://github.com/backraw
User avatar
Doldol
Senior Member
Posts: 201
Joined: Sat Jul 07, 2012 7:09 pm
Location: Belgium

Postby Doldol » Tue Sep 09, 2014 2:02 pm

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?
User avatar
satoon101
Project Leader
Posts: 2703
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Tue Sep 09, 2014 3:25 pm

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
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Postby BackRaw » Tue Sep 09, 2014 10:42 pm

Woah! didn't realize the wiki was updated :D that's good news
My Github repositories:

Source.Python: https://github.com/backraw

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 162 guests