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 ➜ Suggestions ➜ Script Engine Support

Script Engine Support

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


Posted by WillFa   USA  (525 posts)  Bio
Date Fri 23 Aug 2002 01:15 AM (UTC)
Message
Would it be terribly hard to add PythonScript to the list of scripting engines?

Thanks. :)
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #1 on Fri 23 Aug 2002 05:44 AM (UTC)
Message
Doing some research into this:

Python can register itself as another scripting engine, just like perl does. It does get registered to sufficiently function as a Scripting Host engine.

Mushclient seems to have just that list/array/other means of hard coding the supported engines, so trying to kludge a plugin to do Language="Python" gives an error on line 17 :)

I'd really like this, since a lot of the problems that I see people looking to do would be sooooo simple with dictionaries and tuples (and I am not strong in perl at all).

You can get a copy of the language, free of charge, at http://www.activestate.com/Products/Download/Register.plex?id=ActivePython
After installing it, run C:\python22\lib\site-package\win32comext\client\pyscript.py --register to enable the IActiveScript registry entries.

Information that might not help you, but I'm trying to make this as easy as possible. :)

EngineID = Python, ScriptID = pysFile
CLSID of Python = {DF630910-1C1D-11d0-AE36-8C0F5E000000}
Erm, default file extension is .pys for the scripting engine.

Anything else I can do to hopefully get this in 3.27? :)
Thanks again :)
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #2 on Sat 24 Aug 2002 04:58 AM (UTC)
Message
Oh yea, forgot to add that the engine does implement the IActiveScriptParse interface, and not the IPersist variants.

If you'd like any help adapting the webpages to include samples of Python, I'd be happy to contribute. :)

Most are very simple to adapt, on a single line it wont appear much different from VBScript. It's Pythons structuring and datatypes that lend to it's elegence.


def OnTrigger (TrigName, Matchedline, arWildCards)
    world.note("Trigger fired", TrigName)
    #commas can concatenate strings, as well as 
    #  separate parameters
    #indentation determines grouping

#blank line ends the sub routine
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 24 Aug 2002 06:28 AM (UTC)
Message
Sounds fabulous, thanks for the research.

I'll look into it early next week, and if no problems, do a version which supports Python shortly.

The examples will be harder for me as I've never used Python, but perhaps if you want to take the examplescript file and do a Python version? Of course it'll be hard to test, but perhaps you can test on a pre-release copy for me, or just do what you think *ought* to compile and email me a copy. :)

I'll have to see how array support works, using Jscript needed a bit of a kludge because arrays passed to scripts (eg. the 10 wildcards to a trigger) were a variant array of variants. I'm not sure how Python will handle that.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #4 on Sat 24 Aug 2002 03:06 PM (UTC)
Message
Oops, Typo


def OnTrigger (TrigName, Matchedline, arWildCards):
    world.note("Trigger fired", TrigName)


I accidentally left out the colon at the end of the def
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #5 on Sun 25 Aug 2002 04:27 AM (UTC)
Message
I am having trouble instantiating the Python scripting engine. In particular, this statement is causing a crash:


m_IActiveScript->AddNamedItem (L"world",
SCRIPTITEM_ISVISIBLE | SCRIPTITEM_ISSOURCE);


It works for the other 3 languages, and after some searching I can't find the solution (so far).

This statement is necessary to expose the "world" object to the scripting engine.

If I take it out the scripting initialisation crashes shortly after, so perhaps there is a problem in the scripting DLL.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by WillFa   USA  (525 posts)  Bio
Date Reply #6 on Sun 25 Aug 2002 08:12 PM (UTC)
Message
I used to have similar problems when passing literals instead of variables with the contents.

Dunno if it'll help...


char charWorld[]="world";
m_IActiveScript->AddNamedItem (charWorld,
SCRIPTITEM_ISVISIBLE | SCRIPTITEM_ISSOURCE);
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #7 on Thu 29 Aug 2002 12:52 AM (UTC)
Message
I had to use:

WCHAR charWorld[]=L"world";


However even that didn't help. After all, it crashed without the entire offending call.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
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.


16,745 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.