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.
Entire forum
➜ MUSHclient
➜ Lua
➜ Help with capturing multi-line text
Help with capturing multi-line text
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Silco69
Australia (3 posts) Bio
|
Date
| Wed 09 Dec 2015 08:21 AM (UTC) Amended on Wed 09 Dec 2015 04:48 PM (UTC) by Fiendish
|
Message
| Hello again!
I'm attempting to create a calculator to determine the total amount of mindspace your spells take up in the discworld MUD.
The problem I'm currently facing, is capturing the spells you have in your head. It is currently displayed as follows
You know the following defensive magic spells:
Chrenedict's Corporeal Covering Grisald's Reanimated Guardian
Endorphin's Floating Friend Transcendent Pneumatic Alleviator
You know the following offensive magic spells:
Doctor Kelleflump's Deadly Demon Pragi's Fiery Gaze
Effermhor's Hypersonic Assault Wungle's Great Sucking
Myrandil's Vicious Seizure
You know the following misc magic spells:
Collatrap's Instant Pickling Stick
Fabrication Classification Identification
Floron's Fabulous Mirror
Fyodor's Nimbus of Porterage
Gryntard's Feathery Reliever
Jogloran's Portal of Cheaper Travel
Worstler's Advanced Metallurgical Glance
Would anyone have any suggestions as to how I might capture multi-line text that appears to be split into columns or if it is at all possible?
Thank you in advance!
* I see that copy/pasting it here formats the tabs inbetween the spells. If needed I could upload a screenshot
[EDIT] moderator's note: I added code tags - Fiendish | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #1 on Wed 09 Dec 2015 04:51 PM (UTC) Amended on Wed 09 Dec 2015 04:52 PM (UTC) by Fiendish
|
Message
| Break the problem into sections of work. Let's start with the defensive spells, for instance.
You want two triggers. One that captures "You know the following defensive magic spells:", call it DEFENSIVE_START,
and one that captures "*" (otherwise known as a catchall), call it DEFENSIVE_CAPTURE.
Now you only want DEFENSIVE_CAPTURE to get enabled when DEFENSIVE_START fires and you only want it to stay active until the next blank line. So the first thing that DEFENSIVE_START does should be to EnableTrigger("DEFENSIVE_CAPTURE"). And the first thing that DEFENSIVE_CAPTURE does should be to disable itself if it has just matched a blank line. And that covers making sure that the capture is only active when you want it to be.
Now you need to make DEFENSIVE_CAPTURE do something. There are two obvious cases. The first case is if it captures a blank line. In that case, as stated above, it should immediately disable itself from capturing future lines via EnableTrigger("DEFENSIVE_CAPTURE", false). The second case is if it captures something other than a blank line. By constructive definition, everything else is defensive spell data, so you want to parse the line appropriately and do something with the information. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,094 posts) Bio
Forum Administrator |
Date
| Reply #2 on Wed 09 Dec 2015 09:26 PM (UTC) |
Message
| |
- 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.
11,683 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top