Store data thats not attached to an object

16 views
Skip to first unread message

Quilnux

unread,
Feb 17, 2021, 4:17:39 PM2/17/21
to Evennia
Ok, so I have an area (probably should call it a zone) of outdoor locations. I'm expanding my weatherroom typeclass to include additional features. What I would like to do is have the weather the same across multiple weatherrooms within the same zone. Is there a way to make a global variable that can be accessed from multiple room objects?

davidedwar...@gmail.com

unread,
Feb 17, 2021, 4:32:49 PM2/17/21
to Evennia
I am betting you want to use the tag feature.

Hope that helps.

Quilnux

unread,
Feb 17, 2021, 5:02:46 PM2/17/21
to Evennia
So instead of tying the weather to the zone I would tie the zone to the weather? 

Griatch Art

unread,
Feb 17, 2021, 5:40:54 PM2/17/21
to Evennia
All a 'zone' is, is a group of locations/objects that can be isolated and acted upon together. So all you need is a way to tell the system which ones belong together so they can be easily found together.
It's indeed recommended to use tagging for building 'zones'. Check out https://www.evennia.com/docs/latest/Zones.html?highlight=zone

Tags can't themselves store extra data. For the general question ("Store data that's not attached to an object"), the answer is to use a Global Script. https://www.evennia.com/docs/latest/Scripts.html?highlight=global%20script#global-scripts

Hope that helps!
.
Griatch

Quilnux

unread,
Feb 17, 2021, 6:35:06 PM2/17/21
to Evennia
Yeah, I'm currently using zones now as it is. That's what got me thinking about the WeatherRoom typeclass to begin with. I'll review the global scripts page again. Maybe I missed it or something.

Quilnux

unread,
Feb 17, 2021, 6:42:30 PM2/17/21
to Evennia
Nevermind, after you said what you said, I just thought about it. When my weather global script runs it just needs to search the zone tags and apply a Weatherroom.db.weather to each room in that zone. Python is very new for me who is used to C#. Thanks for taking the time and being patient.

On Wednesday, February 17, 2021 at 5:40:54 PM UTC-5 gri...@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages