 |
Zillat Newbie
Joined: 31 May 2008 Posts: 8
|
Posted: Sun Jun 15, 2008 7:47 am
Help on matching variables in triggers. |
Trigger:
^You see exits leading (%w)({%s?%w door?|,}) (%w)({%s?%w door?|,}) and (%w)({%s?%w door?|.})
In trigger:
#IF (%2 = ~(closed door~)) {#VAR direction_one CLOSED} {#VAR direction_one OPEN}
#IF (%4 = ~(closed door~)) {#VAR direction_two CLOSED} {#VAR direction_two OPEN}
#IF (%6 = ~(closed door~)) {#VAR direction_three CLOSED} {#VAR direction_three OPEN}
Line of text from MUD:
You see exits leading east, down, and in (closed door)
I want it to make direction_one/two/three open unless the mud sends (closed door) like in the third direction. So i want my variables after the MUD sends me that to be
direction_one = OPEN
direction_two = OPEN
direction_three = CLOSED
Right now all of them are turning up closed.
Thanks in advance |
|
|
 |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Jun 15, 2008 4:56 pm |
I would change your method, as you can't guarantee that every room will have three exits like this. I'd also think about changing the variables from a dir1, dir2, etc setup to dirN, dirS, etc or something similar (that way, you don't have to worry about which direction number is which direction).
#Trigger {^You see exits leading (*).} {#forall "stringlist of all directions in your mud" {dir%i = ""};#forall %replace(%replace("%1"," and "," "), ", ", "|") {#if (%ends("%i", "(closed door)")) {#var dir%word("%i",1) "CLOSED"} {#var dir%word("%i",1) "OPEN"}}}
Quote: |
#forall "stringlist of all directions in your mud" {dir%i = ""}
|
This will initialize the exits variables back to blank.
Quote: |
#forall %replace(%replace("%1"," and "," "), ", ", "|") {#if (%ends("%i", "(closed door)")) {#var dir%word("%i",1) "CLOSED"} {#var dir%word("%i",1) "OPEN"}}
|
This will set the available exits for the room. Exits variables are in the format of "direast", "dirdown", dirin". |
|
_________________ EDIT: I didn't like my old signature |
|
|
 |
Zillat Newbie
Joined: 31 May 2008 Posts: 8
|
Posted: Mon Jun 16, 2008 1:25 am |
excellent, thank you. the only problem with this mud is that the syntax changes depending on how many exits and what sort they are.
For example your two exit rooms don't have a comma:
north and east
Where as three rooms does:
north, east, and west
And one room changes the whole line to:
You see a single exit leading west
I can manage the whole single exit with a new trigger, how would you change it so instead of:
north east
..for my two exits, i got:
north|east
like i'm supposed too? |
|
|
 |
Zillat Newbie
Joined: 31 May 2008 Posts: 8
|
Posted: Mon Jun 16, 2008 1:28 am |
oh don't worry i think i got it, by changing the space after " and " to a "|"
|
|
|
 |
|
|
|
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
|
|