|
rkubiak Beginner
Joined: 27 May 2001 Posts: 22 Location: USA
|
Posted: Fri Feb 13, 2004 4:00 pm
Group members variable? |
Trying to make a variable with all the members of my group in it, so far I have it so it adds and removes them fine, however if I enter a group with people already in it I want it to get the names of all those people as well. Any ideas? Also, how could you count the number of items in a container?
<397H 566M 291V 1625644X 100S> grou
Your group consists of:
[ 578( 578)H 169( 186)M 238( 238)V] [22 Wa] Bob (Head of group)
[ 529( 529)H 250( 250)M 244( 244)V] [22 Pa] Joe
[ 437( 437)H 260( 460)M 154( 154)V] [22 Ra] Jim
[ 600( 600)H 609( 682)M 101( 161)V] [26 CC] Dan
[ 397( 397)H 566( 566)M 293( 294)V] [27 Dr] Me
<397H 566M 293V 1625644X 100S>
sack (carried) :
a scroll of identify
a scroll of identify
a scroll of identify
a scroll of identify |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Feb 13, 2004 5:48 pm |
#TR {Your group consists of} {#VAR group {""}}
#COND {~[%d %w~] (%w)} {#ADDITEM group {%1}} {LoopLines|Param=9}
#TR Contents1 {(*) ~(carried~)} {#T+ Contents2;#VAR contents {""};#VAR container {%1}}
#COND {(*)} {#VAR contents {%additem( "%1", @contents)}} {LoopLines|Param=99}
#TR Contents2 {^$} {#T- Contents2;#STATE Contents1 0;#SAY @container;#LOOPDB %countlist( @contents) {#SAY %val %key}} |
|
|
|
rkubiak Beginner
Joined: 27 May 2001 Posts: 22 Location: USA
|
Posted: Fri Feb 13, 2004 6:25 pm |
Thanks a lot for the help! ... however, the first one doesn't seem to work for me. I think I have the trigger entered in correctly, the COND pattern is under the states tab and the trigger pattern is Your group consists of, action is just #var groupies ""... am I missing something? Groupies variable just stays blank.
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Feb 13, 2004 7:53 pm |
The #CONDITION adds the names. It's pattern, just like the #TRIGGER pattern, must match the MUD output.
There are probably some additional spaces which didn't show up in the forum. Put the correct number of spaces between the level and class, and between those and the name, and the trigger should work. |
|
|
|
rkubiak Beginner
Joined: 27 May 2001 Posts: 22 Location: USA
|
Posted: Sat Feb 14, 2004 12:27 am |
I thought I had checked the spaces, but low and behold that was it. You're the best
|
|
|
|
rkubiak Beginner
Joined: 27 May 2001 Posts: 22 Location: USA
|
Posted: Sat Feb 14, 2004 7:35 am |
Ran in to this problem today. The main purpose of this was to keep people not in my group from emoting to steal spells, but I just did a check to see if are any "The"s in the group. I'd still be interested in a proper method to do this just so I could learn though.
[ 359( 733)H 192( 192)M 262( 262)V] [30 Wa] The Dragon Tralin |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat Feb 14, 2004 6:13 pm |
If the name is always the last word, you may still be able to do this. If it's not always the last word, then you'll probably have to enter names manually.
#TR {Your group consists of} {#VAR group {""}}
#COND {~[%d %w~] * (%w) ~(Head of group~)} {#ADDI group {%1}}
#COND {~[%d %w~] * (%w)$} {#ADDI group {%1}} {LoopLines|Param=8} |
|
|
|
rkubiak Beginner
Joined: 27 May 2001 Posts: 22 Location: USA
|
Posted: Sun Feb 15, 2004 8:06 am |
And what does the $ do?
|
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Sun Feb 15, 2004 10:11 am |
$ matches the End of a line
If the length of the name is only one word but could also be two three ......... try something like this to always use the last word
#TR {Your group consists of} {#VAR group {""}}
#COND {~[%d %w~] (*) ~(Head of group~)} {#ADDI group {%word(%1,%numwords(%1))}}
#COND {~[%d %w~] (*)} {#ADDI group {%word(%1,%numwords(%1))}} {LoopLines|Param=8}
To get even more complicated if you have names like this
The Dragon Nexela, the assassin
or
The Dragon Nexela of clan assassin post here and Ill show you a way to get just Nexela out of that |
|
|
|
|
|