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
Orang
Apprentice


Joined: 22 Jul 2004
Posts: 118
Location: USA

PostPosted: 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
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
Orang
Apprentice


Joined: 22 Jul 2004
Posts: 118
Location: USA

PostPosted: 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?
Reply with quote
Ikyu
Beginner


Joined: 27 Feb 2005
Posts: 24

PostPosted: 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?
Reply with quote
Ikyu
Beginner


Joined: 27 Feb 2005
Posts: 24

PostPosted: 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..
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Wed Jul 27, 2005 9:55 pm   
 
How about this for Exits!

#TRIGGER {~[Exits: (*)~]} {#SUBSTITUTE {~[Exits: %subregex("%1","(\a+)","~<send "%%1">%%1~</send>")~]}}
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Orang
Apprentice


Joined: 22 Jul 2004
Posts: 118
Location: USA

PostPosted: Thu Jul 28, 2005 12:31 pm   
 
thanks guys! that worked
Reply with quote
Ikyu
Beginner


Joined: 27 Feb 2005
Posts: 24

PostPosted: 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 :)
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: 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.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Orang
Apprentice


Joined: 22 Jul 2004
Posts: 118
Location: USA

PostPosted: 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
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