|
Orang Apprentice
Joined: 22 Jul 2004 Posts: 118 Location: USA
|
Posted: Wed Jul 27, 2005 3:28 pm
help with a few trigs |
the first block of text is:
Code: |
(%w) is auctioning (*) ~(Level (%d), Num (%d)~). Current bid is (%d).
|
now what i'd like to do with this is:
#gag it and have it replace it with the same text, only the (*) part of it will be an #MXP which will send "bid %4" to the mud
i also want the trig to capture the ansi color from the line and show it exactly as it would be normally, except with the previously mentioned #mxp
2nd block:
Code: |
[Exits: north east west down]
|
what i want to do with this is:
#gag that line and replace the exits with clickable links that send the dirs
the possible exits are: north south east west up down
if anyone could help me with this i would really appreciate it.
thanks |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Jul 27, 2005 3:34 pm |
There's no easy way to capture the color, but other than that you can look into the use of #SUBSTITUTE or #PSUB. If the colors never change, forget about capturing them and simply add them yourself with either %ansi() or the mxp color tag.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Orang Apprentice
Joined: 22 Jul 2004 Posts: 118 Location: USA
|
Posted: Wed Jul 27, 2005 3:36 pm |
ok forget about the color part i can find a way thats pretty close.. do you know how to do the rest of it?
|
|
|
|
Ikyu Beginner
Joined: 27 Feb 2005 Posts: 24
|
Posted: Wed Jul 27, 2005 6:37 pm |
As far as the dirs go, you can make these triggers.
(only shown for south, but the rest is easy to figure out :p)
It is automatically replaced, so not gagged.
Code: |
#trigger {south} {#sub {~<send>south~</send>}} |
But I figure this is only wanted when there are real exits and not whenever you see south.
I had a go at this, but I am encountering a small problem there.. Maybe someone else knows a better way.
these are the triggers i created.
Code: |
#trigger {^~[Exits:(*)up} {#sub {~[Exits:%1~<send>up~</send>}}
#trigger {^~[Exits:(*)down} {#sub {~[Exits:%1~<send>down~</send>}}
#trigger {^~[Exits:(*)north} {#sub {~[Exits:%1~<send>north~</send>}}
#trigger {^~[Exits:(*)east} {#sub {~[Exits:%1~<send>east~</send>}}
#trigger {^~[Exits:(*)south} {#sub {~[Exits:%1~<send>south~</send>}}
#trigger {^~[Exits:(*)west} {#sub {~[Exits:%1~<send>west~</send>}} |
My thoughts were to trigger only on the "[Exits:" part, and substituting the line, with pasting back in whatever was in between the [Exits: and the specific exit. That way the dirs could be in a random order.
If i turn all off, but leave north/south on, both show as link.
If i turn all off, but leave north/east on, it shows east as link, but not north.
If i turn all off, but leave south/east on, both show as link.
If i turn them all on, only down shows as link.
If i only turn down off, it shows only up as link.
Here is a post of the exits line:
Quote: |
[Exits: north east south west up down] |
maybe someone else knows why it only works for some dirs? |
|
|
|
Ikyu Beginner
Joined: 27 Feb 2005 Posts: 24
|
Posted: Wed Jul 27, 2005 6:54 pm auction sub |
As far as the auction goes, you can use:
Code: |
#trigger {(%w) is auctioning (*) ~(Level (%d), Num (%d)~). Current bid is (%d).} {#SUBSTITUTE {%1 is auctioning ~<send "bid %4">%2~</send> ~(Level %3, Num %4~). Current bid is %5.}} |
This will mess up the color though.. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Wed Jul 27, 2005 9:55 pm |
How about this for Exits!
#TRIGGER {~[Exits: (*)~]} {#SUBSTITUTE {~[Exits: %subregex("%1","(\a+)","~<send "%%1">%%1~</send>")~]}} |
|
|
|
Orang Apprentice
Joined: 22 Jul 2004 Posts: 118 Location: USA
|
Posted: Thu Jul 28, 2005 12:31 pm |
thanks guys! that worked
|
|
|
|
Ikyu Beginner
Joined: 27 Feb 2005 Posts: 24
|
Posted: Thu Jul 28, 2005 5:08 pm |
nexela wrote: |
How about this for Exits!
#TRIGGER {~[Exits: (*)~]} {#SUBSTITUTE {~[Exits: %subregex("%1","(\a+)","~<send "%%1">%%1~</send>")~]}} |
Thanks, that one is much easier than my multiple triggers.
Gotta start studying how to best use regex :) |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Thu Jul 28, 2005 10:36 pm |
I don't like Regex's They are ugly and hard to read. zMud's Pattern Matching wildcards will work for 90% of the lines you want to match on. But there is no denying the power behind %subregex as compared to %replace for modifying strings quickly.
|
|
|
|
Orang Apprentice
Joined: 22 Jul 2004 Posts: 118 Location: USA
|
Posted: Fri Jul 29, 2005 2:15 pm |
nexela wrote: |
I don't like Regex's They are ugly and hard to read. zMud's Pattern Matching wildcards will work for 90% of the lines you want to match on. But there is no denying the power behind %subregex as compared to %replace for modifying strings quickly. |
yeah.. on some of the auctoins it messes it up, not giving an mxp or sometimes it shows PERSON is auctioning level x number y .. with no item.. but its still good enough i guess |
|
|
|
|
|