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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Jasondaro
Newbie


Joined: 05 Aug 2019
Posts: 1

PostPosted: Mon Aug 05, 2019 10:54 am   

Trying to figure out how to do something on cMUD
 
Hello everyone,,
So I'm trying to find the best way to store party data for variable/trigger usage in cMUD. Party info lines come in two forms:

| * F Cliff | 2138/2138 | 2839/2839 | 1022/1022 | 45419 |
and

|Cliff | HP: 2138/2138 | SP: 2839/2839 | EP: 1022/1022 |
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?

Sorry about the ambiguous title, realized it sucked right after I posted.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4671
Location: Pensacola, FL, USA

PostPosted: Mon Aug 05, 2019 7:12 pm   
 
It's all about the setters and getters.

$this=%db(@party, 1)
#ADDKEY $this Name %1
#ADDKEY $this HP %2
#ADDKEY party 1 $this
#SAY @party.1.Name
#SAY %db(%db(@party, 1), Name)
_________________
Discord: Shalimarwildcat
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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