 |
drake19 Newbie
Joined: 18 Aug 2019 Posts: 1
|
Posted: Sun Aug 18, 2019 3:11 pm
Trying to figure out how to do something on cMUD |
I'd like to capture a database titled "party", then have a positional notifier for party order number, then subset values of that positional. For example, party.1.name = cliff, party.1.hp = 2138, etc
I've been easily able to get proper regex to capture the variables but I'm not sure how to properly nest things into my DB variable such that I can accomplish what I'm after. If it's not possible with a single database, I could be willing to do something like party.1 = cliff, cliff.hp = 2138, but that seems clunky.
What's the best way to accomplish this that you've found |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4718 Location: Pensacola, FL, USA
|
Posted: Sun Aug 18, 2019 7:41 pm |
If you are hoping to have buttons or a status object updated with the values, then you want regular variables, not a dbVar.
Its a limitation of the implementation.
As for how you would go about editing a nested dbVar:
//first we get the current value in a local variable
$this=%db(@party, 1)
//then update the values for the nth party member
#ADDKEY $this Name Cliff
#ADDKEY $this HP 2138
//before we save the updated values back to our permanent variable
#ADDKEY party 1 $this
This process can be extended as many levels as needed. |
|
_________________ Discord: Shalimarwildcat |
|
|
 |
shalimar GURU

Joined: 04 Aug 2002 Posts: 4718 Location: Pensacola, FL, USA
|
Posted: Sun Aug 18, 2019 8:10 pm |
Unless the party nth placement is relevant, i would just do it as:
$this=%db(@party, Cliff)
#ADDKEY $this hp 2138
#ADDKEY party Cliff $this |
|
_________________ Discord: Shalimarwildcat |
|
|
 |
|
|
|
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
|
|