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
➜ Tips and tricks
➜ Roller
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Blum
(3 posts) Bio
|
Date
| Thu 03 Apr 2003 11:08 PM (UTC) |
Message
| Hi, I am trying to create a roller for a mud I play.
Unfortunately scripting is something I suck at so I could use some help.
The input is:
Rolled: str [18(0)] int [10] wis [16] dex [10] con [17] cha [14]
Do you want to keep these stats? [Y/N]
The output, as you probably guessed should be if those numbers are higher than something y, otherwise n
| Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 03 Apr 2003 11:25 PM (UTC) |
Message
| There is at least one example of that on the forum, maybe more. Search it for "stat roller" I think. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Blum
(3 posts) Bio
|
Date
| Reply #2 on Fri 04 Apr 2003 01:19 AM (UTC) |
Message
| Well, I found one example, http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=604 but I am having some problems with it.
First the trigger: If I understand correctly mine should look something like this:
^\s*\R\o\l\l\e\d\:\s*\s\t\r\s*\[(\d+)\((\d+)\)\]\s*\i\n\t\s*\[(\d+)\]\s*\w\i\s\s*\[(\d+)\]\s*\d\e\x\s*\[(\d+)\]\s*\c\o\n\s*\[(\d+)\]\s*\c\h\a\s*\[(\d+)\]$
Unfortunately it doesn't work.
Did I miss something? | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
Date
| Reply #3 on Fri 04 Apr 2003 04:15 AM (UTC) |
Message
| Umm. You seem to be a bit confused about what \ does. This character is used to define 'special' situations. For instance \d means 'any numeric digit). Thus your trigger should be:
^\s*Rolled:\s*str\s*[(\d+)\((\d+)\)]\s*int\s*[(\d+)]\s*wis\s*[(\d+)]\s*dex\s*[(\d+)]\s*con\s*[(\d+)]\s*cha\s*[(\d+)]$
or something like that. This would break down to:
^ - start of line
\s* - one or more spaces
Rolled: - Literal letters, having no 'special' meaning.
\s* - one or more spaces
[ - the '[' character
(\d+) - return as a wildcard one or more numeric digits.
\( - the '(' character
...
By using \ in front of every character you where actually telling it to use every single one as a 'command', instead of as a letter. Only special ones like \, [, (, +, ?, * and a few others 'require' the '\' in front of them when you intend them to be letters instead of commands, since those have special meanings when used without a '\'. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #4 on Fri 04 Apr 2003 05:40 AM (UTC) |
Message
| You need a backslash in front of the [ as well as the other places, otherwise the [ has a different meaning (creates a set). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Blum
(3 posts) Bio
|
Date
| Reply #5 on Fri 04 Apr 2003 09:57 AM (UTC) |
Message
| Thank you for your help.
I now got me a working roller:)
| Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #6 on Fri 04 Apr 2003 12:55 PM (UTC) |
Message
| God, just use a normal expression, it's not that regex will be THAT important in a roller... Why have [d+] when * will do just as well? You don't have to be that precise... |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | 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.
19,909 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top