(New message)
Subject review (reverse sequence)
Posted by
Bottomfeeder
(42 posts) bio
Date
Fri 22 Aug 2008 05:02 PM (UTC) [ quote
]
Message
Man oh man, this has been a crash course in regular expression but I think I am finally getting the hang of them now. Thanks for the help Worstje.
I ended up using the following syntax...
You buy((\s(\d)\s\*\s)|\s)(?:@healdesc) from \w+ for \d+ gold.$
With wildcards[3] being filled with the number of potions bought on a multiple item purchase.
They are really quite handy but wrapping my head around them has been a challenge. Once again, seeing your method has been invaluable, thank you. top
Posted by
Worstje
Netherlands (867 posts) bio
Date
Fri 22 Aug 2008 03:46 PM (UTC) [ quote
] Amended on Fri 22 Aug 2008 05:27 PM (UTC) by Worstje
Message
Hrm, let's see. I'll start from scratch again since I prefer it over fixing someone elses regular expression (and I'm a bit sleepy...)
^You buy (?:(\d+) \* )?(.*?) from (\w+) for (\d+) gold\.$
Wildcards:
[1] amount (may be empty)
[2] item description
[3] salesperson
[4] spent gold
I hope that helps you a bit. :)
Edit: made a minor mistake. Fixed now. top
Posted by
Bottomfeeder
(42 posts) bio
Date
Fri 22 Aug 2008 03:34 PM (UTC) [ quote
] Amended on Fri 22 Aug 2008 03:35 PM (UTC) by Bottomfeeder
Message
Not sure if you're still around, but could you look this over and tell me how it looks?
To trigger off of either one of these:
You buy 2 * Jade Elixir from Jojobo for 1920 gold.
You buy Jade Elixir from Jojobo for 1920 gold.
I am using:
You buy(\s(\d+)\s\*)|\s(?:@healdesc) from \w+ for \d+ gold.
The only thing I'm worried about getting into wildcards is the first \d+. Which, unless I'm wrong, should go into wildcards[2].
Everything else can be matched and discarded.
I can only get it to match on the single purchases, any purchase with multiple Elixirs doesn't fire. top
Posted by
Worstje
Netherlands (867 posts) bio
Date
Thu 21 Aug 2008 09:08 PM (UTC) [ quote
]
Message
I'm glad I could help. Feel free to ask again when you run into some issues. =) top
Posted by
Bottomfeeder
(42 posts) bio
Date
Thu 21 Aug 2008 08:37 PM (UTC) [ quote
]
Message
You sir, are a gentleman and a scholar! I'm still very green and regular expressions make me wanna kick things, hard.
Thank you for cleaning that up. top
Posted by
Worstje
Netherlands (867 posts) bio
Date
Thu 21 Aug 2008 07:53 PM (UTC) [ quote
] Amended on Thu 21 Aug 2008 08:18 PM (UTC) by Worstje
Message
.. That thing gives me a headache as well. Rather than trying to fix it, I'm going to start from scratch. This thing has so many places it can go wrong at, and the fact that it clearly triggers more things than you've explained isn't really helping me figure out what parts are correct and what aren't.
First of all, there's no other trigger which may be interfering? If another trigger (same or lower sequence) matches a line and does not have keep_evaluating="y" then your trigger will never even be attempted.
Second, my attempt to match your data follows after this. I am going to assume you are only interested in the number(s) in the data. One problem I can see is that you try to repeat a group with varying contents (the affects), which should work but can pose a problem if you actually want to use the data you are triggering on since only the last repetition will be captured. For now, I'll leave that part be - simply because I want to try to make the trigger as simple as possible.
^\s*(?:\((\d+)\)\s*)?(?:\(\w+)\)\s)*(.*)\((\d+)\)$
Wildcards are filled with:
[1] = quantity
[2] = last occurrence of an affect
[3] = item description
[4] = level of item
You can use a simple script with SetVariable(), or a '%3' combined with 'Send to: Variable' to get the item description in your buffdesc variable.
I hope it helps you a bit. :) top
Posted by
Bottomfeeder
(42 posts) bio
Date
Thu 21 Aug 2008 06:24 PM (UTC) [ quote
]
Message
So I've been banging my head against the regular expression wall and would appreciate some help untangling my brain. What we have here is a trigger match line that follows:
match="^\s*(\s*|\(\s*(\d{1,})\))\s*((\((Blue Aura|Invis|Glow|Hum|Magic|([KBIGHM]))\)){0,})\s*(@buffdesc)\s\[\d{1,3}\]\s*$"
Now the text it should be triggering on is:
"(26) (Magic) (Glow) (Hum) a Refreshing Idea (100)"
-(26) is the quantity and when there's only 1 it won't be present.
-(Magic) (Glow) and (Hum) aren't always all present
-a Refreshing Idea is loaded into the variable @buffdesc
-(100) is the level of the item and will always be there and an integer although not always 100.
So could someone please tell me not understanding with the regular expression? It just won't trigger.
top
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
2,245 views.
Reply to this subject
Start a new subject
  Refresh page
Go to topic:
(Choose topic)
Area Editor: Bug reports
Area Editor: General
Area Editor: News and updates
Area Editor: Suggestions
Area Editor: Tips and tricks
Dawn of Time: Administration
Dawn of Time: Configuration
Dawn of Time: Installing/compiling the server
Dawn of Time: New Dawn Muds Announcements
Dawn of Time: Playing
Dawn of Time: What is Dawn of Time (Dawn)?
Electronics: Microprocessors
Electronics: Operational Amplifiers
Forum: About
Forum: Announcements
Forum: Mailing other users
Forum: Problems
Forum: Registering
Forum: Searching
Forum: Subscribing
Forum: Suggestions
Forum: Test
Forum: Time zones / time display
Forum software: Administration
Forum software: Installation
MUDs: Announcements
MUDs: General
MUDs: MUD Design Concepts
MUSHclient: Announcements
MUSHclient: Beta testing
MUSHclient: Bug reports
MUSHclient: Development
MUSHclient: General
MUSHclient: Getting Started
MUSHclient: International
MUSHclient: Jscript
MUSHclient: Lua
MUSHclient: Miniwindows
MUSHclient: MXP and Pueblo
MUSHclient: Perlscript
MUSHclient: Plugins
MUSHclient: Python
MUSHclient: Suggestions
MUSHclient: Tips and tricks
MUSHclient: VBscript
MUSHclient: Wine
PennMUSH: Compiling the server
PennMUSH: Running the server
Programming: General
Programming: STL
Quilting: General
ROM: Compiling the server
ROM: Running the server
SMAUG: Commands
SMAUG: Compiling the server
SMAUG: Lua
SMAUG: Running the server
SMAUG: SMAUG coding
Search the forum
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )