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
eironia
Beginner


Joined: 24 Jul 2006
Posts: 11

PostPosted: Wed Jun 20, 2007 5:04 pm   

Multiple word variables
 
The MUD I play, Shattered Kingdoms, has group coding with formations, 3 rows, 3 columns. To make it easier to heal, I set up a script to display the group member's health in guages, arranged like the group. That part works perfectly. My problem is that I'm trying to make the name of each guage the group member's name, and sometimes the name has multiple words.

The group display appears like this:
Code:

Group: Teraliss's Party
(11:F1)  [a furry pand]   (12:F2)  [------------]   (13:F3)  [------------]   
(21:M1)  [    Teraliss]   (22:M2)  [------------]   (23:M3)  [------------]   
(31:B1)  [------------]   (32:B2)  [------------]   (33:B3)  [------------]   
Characters                 Rank    Pos    In room  Follow    HP    ME    PE 
Teraliss                   Leader  21:M1  Yes      No      100%  100%   73%
A furry panda              Member  11:F1  Yes      Yes     100%  100%  100%


Here's my trigger:
#TRIGGER {(*)%s{Leader|Member}%s11~:F1%s{Yes|no}%s{Yes|No}%s(%d)} {
#VAR F1hp %2
#VAR F1name {%1}
}

Then I repeat that for each group position.

That name can be anywhere from one to four words. I read about using brackets to help in multiple word variables, matching (*) with {%1}, but I'm still creating a class called panda with a setting of furry. Any ideas on how to stop creating a thousand new classes, and show the name correctly? I appreciate any guidance!
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jun 20, 2007 5:31 pm   
 
I don't know what to say except that that's the way to do it and it should be working. Check that it really is saved with those brackets there. One other thing you could try is using quotes "" instead of braces {} round the value.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Thu Jun 21, 2007 2:42 pm   
 
In Zmud you do want to use "%1" around a variable if you want to catch all of the words in a %nn variable. That is why the compatibility report screams at you when it sees "%1" in a script for Cmud. As in Cmud it is no longer a valid syntax or even needed.


#TRIGGER {(*)%s{Leader|Member}%s11~:F1%s{Yes|no}%s{Yes|No}%s(%d)} {
#VAR F1hp "%2"
#VAR F1name {"%1"}
}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
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