Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
avidal
Beginner


Joined: 04 Jun 2002
Posts: 23

PostPosted: Fri Apr 25, 2008 7:53 pm   

Scripting in alternative languages
 
ZMUD and CMUD both allow you to code in alternative languages via the Windows Script Host(?)

My question is, how does this work? I've never seen a single article or tutorial on it. I have ActivePython installed, and I'd like to knock up a more complex script in Python as opposed to zScript.

Does anyone have any experience with using it or can point me to an article on this method?
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Apr 25, 2008 8:13 pm   
 
zMUD doesn't support languages via the WSH. zMUD supports only zScript, VBScript and JScript.

CMUD does support WSH languages, though. You install ActivePython, and ActivePython registers itself with the WSH. Then in the top-right corner of any setting, you can choose Python (it might have something prefixed or suffixed, I can't remember) in addition to the normal ones of zScript, Lua, VBScript and JScript. Then you just write your Python.

Trouble is that most of the CMUD interface is currently exposed only to Lua. You'll have to wait until a later date when the full interface is made available to WSH languages.

For now, the zvar object (it's a table, or whatever your language's version of one of those is) will contain all your variables, and you'll be able to get and set their values, but nothing else. You can make more complex stuff happen this way by using expression triggers, but it's a bit roundabout.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
avidal
Beginner


Joined: 04 Jun 2002
Posts: 23

PostPosted: Fri Apr 25, 2008 8:19 pm   
 
Ah. And if I code in JScript for ZMUD, will I still have the zvar object available? Do triggers and aliases work the same? You define the trigger/alias name/pattern as normal, and the code itself is in JScript?

I'm trying to make a fairly complex script that'll work in both ZMUD and CMUD, and it would be great if I could just do it in a language I'm more comfortable with.
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri Apr 25, 2008 8:23 pm   
 
Yes, though you won't be able to define them with the #trig command and whatnot, because there's no way to specify the language.

I honestly have no idea how the script interface works in zMUD; someone else'll have to answer that.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat Apr 26, 2008 1:39 am   
 
Fang Xianfu wrote:
zMUD doesn't support languages via the WSH. zMUD supports only zScript, VBScript and JScript.

That's not quite true Fang only VBScript and JScript are immediately visible from Scripting Language the drop-down menu,
but if you have another WSH language installed and you manually type in the Language to use such as "Python" or "PerlScript"
that language is availble to script with.
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat Apr 26, 2008 3:04 am   
 
Code:
#ALIAS testPython {#SS "Python" import win32com.client
zmud = win32com.client.Dispatch("ZMUD.Application")
zmud.CurrentSession.EchoStr("Hello From Python",7)}

There's your hello World :p
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net