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
➜ Lua
➜ Problem with grabbing information from a wildcard.
Problem with grabbing information from a wildcard.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Batista
(15 posts) Bio
|
Date
| Sat 25 Mar 2006 09:15 AM (UTC) |
Message
| I'm having some difficulty pulling information from my prompt.
This is what the prompt looks like:
3380h, 3718m, 15800e, 15800w cexdb-
Right now, my prompt trigger is this:
(?P<chp>\d+)h, (?P<cmp>\d+)m, (?P<cend>\d+)e, (?P<cwill>\d+)w ([cexkdb@]*)-
MUSH recognizes the prompt and acts accordingly. Well... almost.
For sipping and whatnot, it works just fine. The values for the wildcards register normally EXCEPT for that last part: ([cexkdb@]*). I don't know why. No matter what configuration I use, be it that or (.*?) or even just a regular * with no regexp stuff in the trigger, it always ALWAYS registers as 'nil'.
Any idea what's going on? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 25 Mar 2006 07:31 PM (UTC) |
Message
| You realise your last wildcard doesn't have a name? The others do. What are you testing, which equals nil?
I tried your trigger with your example and it worked. I used the ExampleTrigger script which ships inside the exampscript.lua file that comes with MUSHclient. This is what I saw:
Trigger fired.
Matching line was: 3380h, 3718m, 15800e, 15800w cexdb-
Wildcards ...
1="3380"
2="3718"
3="15800"
4="15800"
5="cexdb"
"chp"="3380"
"cwill"="15800"
0="3380h, 3718m, 15800e, 15800w cexdb-"
"cmp"="3718"
"cend"="15800"
Line with style runs ...
1:
"textcolour"=12632256
"backcolour"=0
"length"=35
"style"=0
"text"="3380h, 3718m, 15800e, 15800w cexdb-"
You can see that your last wildcard (number 5) was returned OK.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Batista
(15 posts) Bio
|
Date
| Reply #2 on Sat 25 Mar 2006 11:33 PM (UTC) |
Message
| That's what is so frustrating. It -should- work. There's nothing wrong with it. It just... doesn't.
To test it, I use the Note() function. Whenever I have it report all wildcard values, I get all the correct stuff... EXCEPT for the last wildcard.
I'll put Note(%5) under that trigger in the send box and it'll report 'nil'.
*scream* | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Sun 26 Mar 2006 04:24 AM (UTC) |
Message
|
Quote:
I'll put Note(%5) under that trigger in the send box and it'll report 'nil'
You have to think about what is happening here. MUSHclient literally substitutes the trigger wildcard for the %5, so what you are getting is:
Note (cexdb)
This is listing the contents of variable cexdb which does not exist, and is thus nil.
You want:
Note ("%5")
The others worked because they are numbers, eg.
Note (3380)
That would work. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Batista
(15 posts) Bio
|
Date
| Reply #4 on Sun 26 Mar 2006 08:14 AM (UTC) |
Message
| ... oh. Well, hmm. It works now, heh. Sorry for the stupid question. *grin* Shoulda thought of that myself.
Thanks for the help! :D | 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.
14,291 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top