[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Python
. . -> [Subject]  Python?

Python?

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


Pages: 1 2  

Posted by Ixokai   USA  (24 posts)  [Biography] bio
Date Thu 24 Apr 2003 07:54 AM (UTC)
Message
How much begging, prodding, crying and worshipping would it take to get Python added to the list of supported scripting languages?

I don't know what interface you're using, but if its the ActiveX/Windows Scripting Host, then Python interfaces to it just fine with the win32all package...

Plllease? :)
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 24 Apr 2003 07:59 AM (UTC)
Message
I tried that - the appropriate changes are in the code, however it didn't work. Some bizarre interface problem. Unless they have fixed up the Python script interface I can't do it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Thu 24 Apr 2003 08:03 AM (UTC)

Amended on Thu 24 Apr 2003 08:04 AM (UTC) by Nick Gammon

Message
See my earlier attempts

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Thu 24 Apr 2003 08:20 AM (UTC)
Message
Don't get me wrong - I would if I could - I had a demo bit of source that reproduces the fault that I sent to WillFa (see earlier posts).

If I can make that work, or if someone can tell me what I am doing wrong, I'll put it in. You are welcome to a copy.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Ixokai   USA  (24 posts)  [Biography] bio
Date Reply #4 on Thu 24 Apr 2003 09:11 AM (UTC)
Message
Do you mean:

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

in reference to the demo, or did you send a different bit? Since you said it crashed even without the above, I was wondering if I missed something.

Can you provide details on what sort of crash? What error message; access violation, etc? I might be able to do some digging for you.
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Thu 24 Apr 2003 11:13 AM (UTC)

Amended on Thu 24 Apr 2003 11:20 AM (UTC) by Nick Gammon

Message
Yes, that is what I meant.

This is what I had last time:


// pScriptEngine = new CScriptEngine (this, "vbscript"); // this works
pScriptEngine = new CScriptEngine (this, "python"); // this doesn't



If you change the language to "vbscript" then it works and displays the message box. Otherwise you get the message about the ESP value. If you comment out the line that adds the "world" variable to the script engine it crashes anyway (scripttengine.cpp line 210).

The files are largely unchanged from the MUSHclient version, in the stdafx.h file is a define:

#define CMUSHclientDoc CScripttestDoc

This is so that the files think it is using a CMUSHclientDoc document.

If you can get this to work (changing compile options or something?) then I should be able to make MUSHclient work too.

Continued in next message ...

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Thu 24 Apr 2003 11:15 AM (UTC)

Amended on Thu 24 Apr 2003 11:17 AM (UTC) by Nick Gammon

Message

I got this error:

The source is at pythontest.zip - 28 Kb - just unzip, build, run and select View menu -> Test.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Thu 24 Apr 2003 11:18 AM (UTC)
Message
I don't know about this "declared with a different calling convention" bit - the exact same code works if you change the language to Vbscript, Jscript, or Perlscript.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Thu 24 Apr 2003 11:22 AM (UTC)
Message
I downloaded Python today to make sure I had the latest version - it was 2.2.2 build 224.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #9 on Thu 24 Apr 2003 11:25 AM (UTC)
Message
Get the example program to work reliably and you can have Python this week. :)

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #10 on Thu 24 Apr 2003 07:21 PM (UTC)
Message
Hmm. Did a bit of hunting and found that most things dealing with Python and 'calling convention' involve the facts that Python and C++ do not automatically use the same method. While my brief search didn't uncover specifics, one possibility is that Python uses the Pascal convention and in that case the difference involves stack management. The method C++ uses is 'caller clears the stack', while the pascal method employs 'the program called clears the stack'. This is only a guess though, but it suggests that a key process is either being done by both ends or by neither end and this would definitely cause a crash.

Wish I knew if this was the case or how to actually fix it though.. I imagine that changing the calling method to properly support Python could break everything else, so there has to be some sort of better solution. :p
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Fri 25 Apr 2003 12:15 AM (UTC)
Message
After making a subtle change to the way scripting was instantiated - after spending hours reading web pages - I now have Python active (nothing to do with calling conventions BTW). However after a script error in "immediate" mode it stops processing further scripts. I am investigating this.

Meanwhile, as a newbie to Python, perhaps a few examples of the sort of thing you would like to try would help me to test it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Fri 25 Apr 2003 01:14 AM (UTC)
Message
Like, for instance, how do I cast types?

Here is a simple example. In the plugins I echo the description by getting plugininfo, which is a variant, and displaying it with Note, which takes a string. Like this:

/world.Note (world.GetPluginInfo (world.GetPluginID, 3))

This gives a type mismatch.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Fri 25 Apr 2003 01:25 AM (UTC)
Message
Hmm - I withdraw that comment slightly - the error was when not running as a plugin, so it probably got an empty variant.

My experimenting seems to indicate that str(x) casts x to a string.

What about the format for constants? See this page:

http://www.gammon.com.au/scripts/function.php?action=errors

Can you suggest the syntax (for one line, I can work out the rest) for the constant list? This is auto-generated by the page anyway, I just need the format to do it.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #14 on Fri 25 Apr 2003 01:29 AM (UTC)
Message
What about iterating through an array - a variant array? See this page:

http://www.gammon.com.au/scripts/function.php?name=GetInternalCommandsList

How would you do that in Python?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


61,005 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]