|
Rolly Wanderer
Joined: 16 Oct 2006 Posts: 62
|
Posted: 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 |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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! |
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: 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 |
|
|
|
Rolly Wanderer
Joined: 16 Oct 2006 Posts: 62
|
Posted: 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
|
|
|
|
|
|