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
➜ Python
➜ GetTriggerWildcard doesn't work with unlabelled triggers (Python)
|
GetTriggerWildcard doesn't work with unlabelled triggers (Python)
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Cadari
(25 posts) Bio
|
| Date
| Sun 06 Jul 2008 03:56 PM (UTC) Amended on Sun 06 Jul 2008 03:58 PM (UTC) by Cadari
|
| Message
| Hello. Just as the title says, if the trigger doesn't have a label,
def trigger_proc(name, line, wildcards):
world.GetTriggerWildcard(name, '1')
GetTriggerWildcard returns None. Lua scripts don't have such a problem, while Python ones do. Any way to make it work without labelling all the triggers?
P.S. I think it's more suited for the General section. Please move, if I'm wrong. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Mon 07 Jul 2008 03:01 AM (UTC) |
| Message
| Actually it behaves the same in Lua. The name field on a trigger function is empty, if the trigger name is empty.
To solve your specific problem, simply index into the wildcards array:
def trigger_proc(name, line, wildcards):
world.Note (wildcards [0])
Other approaches are:
- Give the triggers a name, if you want to query named wildcards.
- Use "send to script" and use %1 (or whatever) to have the trigger contents placed inside your script.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Cadari
(25 posts) Bio
|
| Date
| Reply #2 on Mon 07 Jul 2008 10:43 AM (UTC) |
| Message
| | Got it, thank you, Nick. | | 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.
13,510 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top