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
Buba
Newbie


Joined: 01 May 2002
Posts: 0

PostPosted: Fri Apr 05, 2002 3:28 pm   

Adding to a Var
 
In my MUD i get output like:
>qw

Apaputter Bront Chigins Darksaber Dealer Ditzy Dougall
Frogfur Galadriel Iculinejr Imperator Improvisar Jediknightq Kella
Kewlcat Kimba Kup Librarian Mastermage Meloran Netmndr
Never Nightwolf Pantara Penfold Pepper Rasal Rere
Salient Sirmark Snowlily Soulquestr Spaun Spirit Synch
Thejunior Thor Thulium Tis Tonichaze Troy Xray

42 players


Only in my mud theres 4 columns across of names
Ive got triggers in a class activated by ^>qw
then in the clas i have

#TRIGGER {^(%w) } {#IF (%ismember( %1, @players)) {null} {#additem players %1}}
#TRIGGER { (%w)$} {#IF (%ismember( %1, @players)) {null} {#additem players %1}}
#TRIGGER { (%w) } {#IF (%ismember( %1, @players)) {null} {#additem players %1}}

the only problem with this is its not grabbing the names in the last 2 columns, is there something im missing here to get these other names in the far right columns??
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 05, 2002 4:03 pm   
 
If there are four columns of names, your first trigger should get the first name since it matches any word at the beginning of the line. Your second trigger should get the final name since it matches any word at the end of the line. Your third trigger will also get the first name since it matches any word. That means none of these triggers will get the center names.

A simpler approach would be to get all four names at once. If you don't know the number of spaces use %s. Since #ADDITEM will NOT add duplicates I removed the #IF.

#TR {(%w)%s(%w)%s(%w)%s(%w)} {#ADDITEM @players %1;#ADDITEM @players %2;#ADDITEM @players %3;#ADDITEM @players $4}

LightBulb
All scripts untested unless otherwise noted
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