Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ How to capture 1 line of several almost identical and manipulate
|
How to capture 1 line of several almost identical and manipulate
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Smokebomb
(6 posts) Bio
|
| Date
| Thu 29 Mar 2012 01:17 PM (UTC) |
| Message
| Hi there! I'm new to Lua and coding in general but have got a small grip on the basics such as variables, strings, functions and operators.
My question is how do I capture parts of 1 line of several similar lines and then manipulate that data with an alias.
Firstly, the line I wish to capture parts of is something like:
You still have to kill * a whittling boy (Child's Play)
Secondly, I wish to capture the mob (a whittling boy) and area of the mob (Child's Play).
Can I use wildcard's or do I need something else? I tried using wildcard's with no luck as a trigger to match the first line of several:
You still have to kill * a whittling boy (Child's Play)
You still have to kill * some sawgrass (The Fire Swamp)
You still have to kill * A Dragon Citizen (The First Ascent)
You still have to kill * A Gargoyle (The First Ascent)
You still have to kill * a bobwhite quail (The Forest of Li'Dnesh)
You still have to kill * a dark brown waterthrush (The Forest of Li'Dnesh)
You still have to kill * the scorpion (The Gauntlet)
You still have to kill * a hidden thief (The Path of the Believer)
You still have to kill * a beer-drinking ratling (Tournament Camps)
I tried the following as the trigger:
You still have to kill * ^\* (*)
And the following as the send:
hold portal
enter
d
rt %2
where %1
Nothing whatsoever happens when i 'campaign check' and the list of mobs left to kill is displayed, not even an error.
I tried asking on the MUD and they said something about regex but that's over my head, I tried looking on Google 'regex Lua' only to get completely confused.
Many thanks in advance,
Smoke-bomb.
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Thu 29 Mar 2012 08:37 PM (UTC) |
| Message
|
Quote:
You still have to kill * ^\* (*)
It's hard to know what you are doing without seeing the actual trigger.
 |
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
There is a reasonably readable write-up on regular expressions here (written by me *cough* *cough*) ...
 |
Regular expressions
- Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
- Also see how Lua string matching patterns work, as documented on the Lua string.find page.
|
What you want is easy enough. You will learn more by attempting it yourself. Try to keep it simple. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
17,086 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top