Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Wed Feb 14, 2007 3:56 am   

Creating/Using Multiple Database variables
 
Okay, I just want to get a picture of how to go about a new project I'm working on for Achaea. Basically, I have a set of abilities that affect a room for a length of time. I can place one of each of these abilities in a single room, tough I can have them in multiple rooms at the same (ability X in room A, and ability X in room B for example).

What I'd like to be able to do is create something that will record where I use the abilities, and track how much time remains with the abilities (from a base value). For dealing with a single room, I can pretty much accomplish this. It is when dealing with multiple rooms and concurrent use of the abilities that I can't seem to grasp going about doing for some reason.

So the situations are:

Playing of ability X in room A.
Playing of ability Y (and so on) in room A.
Playing of ability X (and so on) in room B.

EDIT: Oh, and this is the tip of the iceberg. Lots of stuff dealing with summoning the ability to another location afterwards.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Feb 14, 2007 10:01 pm   
 
Use a record variable with keys of RoomNumber; and values of Ability#####, where the numbers are derived from either %secs or %ctime. That provides you a start time, you might want to use a second record variable to speed up time clearing. There are a few tricks you can do with %match or %regex and %expanddb to rapidly locate the Ability values if you don't want to use a second variable.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Wed Feb 14, 2007 11:07 pm   
 
Vijilante wrote:
Use a record variable with keys of RoomNumber; and values of Ability#####, where the numbers are derived from either %secs or %ctime. That provides you a start time, you might want to use a second record variable to speed up time clearing. There are a few tricks you can do with %match or %regex and %expanddb to rapidly locate the Ability values if you don't want to use a second variable.


Would using a record variable with a record value work in this situation? So that the initial key is RoomNumber, and the value is a record with a key of AbilityName and value of TimeLeft? Is this even possible?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Feb 15, 2007 2:31 am   
 
That's not what he's suggesting - he's saying have the keys be the room number and the values be the Ability AND the time left.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Thu Feb 15, 2007 4:34 am   
 
Would this allow multiple abilities to be played in the same room? I thought the key had to be unique or else you just overwrite everything.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Thu Feb 15, 2007 6:35 am   
 
Ahh, I see. That's a bit more complicated - the easiest way to do that would be to use %additem to make each record's value a stringlist, so it'd end up being Whatever.286=Ability285|DifferentAbility220 and so on. I know someone (I think it was MattLofton, but I can't be sure) posted functions a while ago that allowed for easy creation and manipulation of databases like that.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net