|
Python error while using trigger
|
Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Shwick
(21 posts) bio
|
| Date |
Sun 23 May 2010 02:54 AM (UTC) [ quote
] Amended on Sun 23 May 2010 03:00 AM (UTC) by Shwick
|
| Message |
I have a trigger calling a python script. The script works when the trigger regex is "hai", but doesn't when it's "Hunger".
haiTrigger - http://img532.imageshack.us/img532/7906/haitrigger.jpg
haiOutput - http://img4.imageshack.us/img4/1215/haioutput.jpg
hungerTrigger - http://img139.imageshack.us/img139/646/hungertrigger.jpg
hungerOutput - http://img59.imageshack.us/img59/8051/hungeroutput.jpg
As you can see the triggers are exactly the same except for the regex, but one gives an error.
The script is,
def OnStats (strTriggerName, trig_line, wildcards):
world.Note ("hi")
The scripts file is named "pythonScripts.py", it does not have the .pys extension used in the example file.
I'm using python 2.6 and I installed the script engine using pywin32-214.win32-py2.6.exe.
Using Mushclient 4.33, windows xp 32 pro.
I've done lots of reading and can't find an answer, help is appreciated.
| top |
|
| Posted by |
Nick Gammon
Australia (18,800 posts) bio
Forum Administrator |
| Date |
Reply #1 on Sun 23 May 2010 06:15 AM (UTC) [ quote
] |
| Message |
Rather than posting images it is easier just to use the Copy button and paste the text right here.
 |
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
Anyway, your problem seems to me to be that you are sending the matching line "to script" as well as calling a script.
Leave the Send box empty (delete the %0) and leave the "send to" box as "World".
You are doing the work in OnStats (which is called anyway, even if you don't do "send to script"). Using "send to script" tries to evaluate what is in the Send box as Python commands which probably won't work. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
| Posted by |
Shwick
(21 posts) bio
|
| Date |
Reply #3 on Mon 24 May 2010 03:39 AM (UTC) [ quote
] |
| Message |
| thanks that solved my problem | 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.
1,433 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )