Register forum user name Search FAQ

Gammon Forum

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 ➜ Repeat on Same Line

Repeat on Same Line

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Mccane   (28 posts)  Bio
Date Sat 22 Dec 2007 02:48 PM (UTC)

Amended on Sat 22 Dec 2007 03:06 PM (UTC) by Mccane

Message
EDIT: My apologies, per usual, I wasn't as investigative enough. I found an appropriate function Nick wrote in this thread http://www.gammon.com.au/forum/bbshowpost.php?id=7669 that I was able to change around to suit my purposes. Problem solved. :)

--------------------------
Okay, so on this MUD I'm playing on you can type stats and see something like:

Str: 4 (+3) (+7) (+8)
Wis: 10 (+10) (+3)
etc...

The first number is your actual stat, and all the additions are bonuses from spells, equipment, stuff like that.


So I wrote a regexp to capture the first number and any number in parentheses after a + sign. I turned on repeat on same line and set it to color it to red to see what happened and every number got highlighted correctly. Then I made it so it would take every number and add it to a Lua table (stats.[Stat] = {#, #, etc}). But then I realized it would only add the first number in parentheses of every line, and I did some searching and found the thread about repeat on same line is just for coloring, it doesn't actually repeat the function for every match.

So now I'm a bit confused, I'm wondering if anyone has any ideas on how I can proceed to break the line down so it'll store on every instance of the match and not just the first? Should I continue using regexp? Any help appreciated, thanks.
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.


8,038 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.