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
Rolly
Wanderer


Joined: 16 Oct 2006
Posts: 62

PostPosted: Fri Aug 22, 2008 11:04 pm   

capturing lists sepparated by comma and space to string lists
 
There must be a neat way to do this. I want to have a trigger state that follows the line from the "who here" command in Achaea:
so the first trigger should be {You see the following people here:}
and the trigger state would need to capture the following: Player1, player2, player3 into the list var {player1|player2|player3} for as many people as are currently in the room.
I've tried various trigger states to get the list but nothing works. This list is often more than one line of text so do I need several trigger states?

Please help
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sat Aug 23, 2008 8:02 pm   
 
Off the top of my head, but this should do the trick. Or close enough to it to get you going.

Code:
#TRIG {You see the following people here:} {}
#COND  {%w*} {#VAR PlayerList %replace(%1,",","|"}


It would help to look up %replace. I kinda cheated in my example and didn't get rid of the extra spaces, but you could do that with another %replace or %trim when you retrieve the list.
_________________
Asati di tempari!
Reply with quote
Caled
Sorcerer


Joined: 21 Oct 2000
Posts: 821
Location: Australia

PostPosted: Sat Aug 23, 2008 11:30 pm   
 
You may also need to use %trim to remove trailing spaces. I would do this at the beginning rather than later. Some of the name lists in IRE don't end at their, well, end. Also, you can remove the commas and the spaces at the same time, with ", " <-- note that there is a space after the comma.

Code:

playerList=%trim(%1)
playerlist=%replace(@playerlist,", ","|")
_________________
Athlon 64 3200+
Win XP Pro x64
Reply with quote
Rolly
Wanderer


Joined: 16 Oct 2006
Posts: 62

PostPosted: Sun Aug 24, 2008 5:46 pm   
 
Thaks, it works very well! I can now do free actions with a group of people in the same room
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