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
boblinski
Novice


Joined: 05 Dec 2005
Posts: 49
Location: New Zealand

PostPosted: Thu Jul 18, 2019 6:18 am   

Variable and capture/display question
 
Hi! Just a couple of questions form a returning noob


----------------1-----------------
Code:
Bob's group:
[22 Thi] Ronal                         65% hp 100% mana 100% mv  87843 xp
[17 Hea] Bob                          100% hp 17% mana 100% mv  63813 xp


How do I capture the above values into a variables like:

ronal_hp
ronal_mana
ronal_mv
bob_hp
bob_mana
bobl_mv
----------------2-----------------
How can I then display the above variables in a tidy table in a capture window like:

Code:
 65%hp 100%m 100%mv  --  Ronal
100%hp  17%m 100%mv  --  Bob
Reply with quote
shalimar
GURU


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

PostPosted: Thu Jul 18, 2019 12:09 pm   
 
Code:
#TR {'s group:} {}
#COND {~[(%d) %w~] (%w) %s (%d)% hp (%d)% mana (%d)% mv  (%d) xp} {
  #STATE 1
  #VAR %concat(%2, "_hp") {%3}
  #VAR %concat(%2, "_mana") {%4}
  #VAR %concat(%2, "_mv") {%5}
  } {within|param=1}


Would make all the variables you want, which could in turn be used to define an #STWIN, but unless you need to make use of these variables elsewhere, there is an easier way:

Code:
#TR {'s group:} {#EXECWIN GroupStats {#CLR}}
#COND {~[(%d) %w~] (%w) %s (%d)% hp (%d)% mana (%d)% mv  (%d) xp} {
  #STATE 1
  #WIN GroupStats {%format("&3d&s &3d&s &3d&s  &s  &s", %3, "%hp", %4, "%m", %5, "%mv", "--", %2)}
  } {within|param=1}


That %format might need some touchups: #HELP %format
_________________
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