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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion Goto page 1, 2, 3  Next
Fang Xianfu
GURU


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

PostPosted: Wed Apr 18, 2007 2:49 am   

Windows Script Host
 
Zugg - CMUD 1.27 release notes wrote:
This version also includes full support for alternate scripting languages, such as VBScript, JavaScript, Perl, Python, Ruby, etc. Any scripting language that you have installed that supports the Microsoft scripting engine should automatically appear in the drop-down Languages list in the Script editor.


In one of my more bored moments, I decided to look into alternative scripting languages. I don't have a great deal of experience with this, and it seems that I've fallen at the first hurdle. I searched for quite a while and couldn't find any information at all on actually getting those languages into the host so they're available in CMUD. Does anyone have any experience with this and can explain how it works and what I'd need to do?
Reply with quote
bortaS
Magician


Joined: 10 Oct 2000
Posts: 320
Location: Springville, UT

PostPosted: Wed Apr 18, 2007 3:18 am   
 
You need to find an install of the script language that you want. The install for the script language should automatically make it available to the scripting host. For Perl, Python, and Tcl go here:

http://www.activestate.com/

Look on the bottom left for ActivePerl, ActivePython, and ActiveTcl.

For Lua go here:

http://www.andreas-rozek.de/Lua/Distributions/index_en.html
_________________
bortaS
~~ Crusty Klingon Programmer ~~
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Apr 18, 2007 5:08 am   
 
Thanks bortaS! Though that second link's for lua 4.0 and the link to tcl/tk leads to a page with no downloadable files. It's a start, though.

EDIT: Did some searching and managed to find downloads for tcl/tk - but the only version they didn't have was 8.3, which is the one I needed! Very frustrating.

EDIT2: FINALLY found it! It was hiding in the most obvious place. For anyone else following that guide, it's this that you want.

EDIT3: But even with that installed, it's still not working. Pah.
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Wed Apr 18, 2007 10:17 am   
 
Found a newer verison of lua yet, anyone heh?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Apr 18, 2007 1:42 pm   
 
When you want something, it's always best to go to the source. Lua 5.1 download
_________________
Asati di tempari!
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Apr 18, 2007 1:46 pm   
 
Indeed it is, and there are plenty of sources and binaries available. But there's no information anywhere on how to get Lua to appear in the Windows Script Host once you've got them, which was my question in the first place.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
bortaS
Magician


Joined: 10 Oct 2000
Posts: 320
Location: Springville, UT

PostPosted: Wed Apr 18, 2007 2:41 pm   
 
Alright, here's a better place to find scripting languages for the Windows Host:

http://www.mvps.org/scripting/languages/

Bah, the Lua links are all useless, but still...
_________________
bortaS
~~ Crusty Klingon Programmer ~~
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Apr 18, 2007 2:42 pm   
 
Yeah, I found that one on my long, arduous search for one for Lua :)

EDIT: I was told in an IRC channel that LuaCOM might be able to do it, but I have no idea how to go about it. I'm going to investigate more. It bugs me that the ONLY thing that could do this (LuaScript) just vanished off the face of the planet and there isn't even a single mirror, let alone a replacement.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Wed Apr 18, 2007 4:52 pm   
 
Slight correction, the easiest way to get the binaries is here (http://luabinaries.luaforge.net/download.html). The link provided earlier nets you the source code.
_________________
Asati di tempari!
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Wed Apr 18, 2007 4:56 pm   
 
What's really sad is that some of this is Microsoft's fault. From what I've heard, they are moving away from the Microsoft Scripting Host in Vista (although it still works). This is probably related to their own scripting plans. The Scripting Host interface was always a pain to implement for other developers (poor documentation, etc). And so it took several years for 3rd party developers to get the hang of it. The ActiveState people have done most of the 3rd party work on getting scripting languages working with the Scripting Host interfaces (and even they don't implement the full interface).

So, just when developers have finally had enough time to figure out Active scripting and get it working, Microsoft says that they won't be supporting it in the future. How would you feel if this happened to you? So, naturally the interest in Active scripting has waned.

Back when I worked on my Scripting Host for zApp, I ran into many of these same problems. ActivePerl and ActivePython were the best, but still didn't implement all of the interface that Microsoft's own VBScript and JScript did. I never tried Lua.

But this is the reason I'm considering putting Lua into CMUD itself, since it's pretty small and efficient. I'm considering the same thing for Ruby, but still need to evaluate the licensing and implementation of that. Unfortunately, Perl and Python are too large to be bundled with CMUD, so you are stuck with the ActivePerl and ActivePython products for that.

Finally, I admit that I haven't had a chance to test CMUD 1.27/1.28 with anything except the normal VBScript and JScript that come with Windows. So it's possible that my autodetection routine that looks in the registry for Active scripting interfaces might not be working properly. So if you get ActivePerl or ActivePython installed and they don't show up in the CMUD dropdown Languages list, let me know.

Eventually I want to add a section to the Help files for each language with specific instructions and links. Just haven't had the time to do this yet. So please post any of your research that provides useful links...it will really help me document this in the future.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Apr 18, 2007 6:13 pm   
 
Zugg wrote:
I'm considering putting Lua into CMUD itself

If only you weren't married, Zugg... Move over, Chiara Twisted Evil

EDIT: And incidentally, ActivePyton and ActivePerl both work like a charm. RubyScript works just lovely as well. Though the one I have has a RubyScript language and a GlobalRubyScript language added to the drop-down and I haven't figured out the difference yet.
Reply with quote
Strakc
Apprentice


Joined: 31 Jan 2006
Posts: 106
Location: Virginia Beach, Virginia

PostPosted: Wed Apr 18, 2007 7:06 pm   
 
Aint Ruby based off lua?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Apr 18, 2007 7:42 pm   
 
Don't think so, they're pretty dissimilar. Both were apparently written in 1993 as well.

http://www.ruby-lang.org/en/about/ wrote:
blended parts of his favorite languages (Perl, Smalltalk, Eiffel, Ada, and Lisp) to form a new language
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Apr 22, 2007 6:11 pm   
 
So I've been experimenting with the different ActiveScripts that've been linked. ActivePython works well and references zvar properly. VBScript works too.

I don't know any Perl syntax at all (I was using "zvar.test = 25" for all my tests. I'd've thought that was pretty universal, but if it's not right please correct me) but Perl wouldn't assign the zvar a value properly when I tried.

RubyScript threw errors whenever I tried to access or assign zvar. Possibly this is thanks to Ruby's var.method syntax?

JScript didn't work, but for a different reason - that option wouldn't stay selected. If I clicked on another setting or ran my alias, the selection would change back to zScript and create a record variable called zvar.

Anyone else had better luck getting this to work?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Sun Apr 22, 2007 7:27 pm   
 
i tried using some functions with php but couldn't get even a basic echo 'test'; to work, i was thinking that if i got php working in zmud i could use it with mysql/apache to create a dynamic online database. is there any special feature besides selecting PHP from the pulldown that needs to be done?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Apr 22, 2007 7:48 pm   
 
Nope, once you've got PHP selected it should Just Work. I really depends what features your ActiveScript version of PHP has installed though - some things that you're trying to use might not be accessible. Pray there's some detailed documentation on it somewhere - a lot of the components I've seen have little to none :(

That's why I'll be extremely happy if Lua gets put straight into CMUD. Then the script won't be going Lua -> LuaScript -> WSH -> CMUD, with each of those steps creating more problems and incompatabilities and lacks of documentation.
Reply with quote
Thinjon100
Apprentice


Joined: 12 Jul 2004
Posts: 190
Location: Canada

PostPosted: Sun Apr 22, 2007 9:59 pm   
 
OK, I've done a little searching through the forums, library, and finished scripts, but so far haven't had much luck... if I change the dropdown to, say, vbscript, and I want the script to do something, then execute a zmud command (like #ECHO)... how do I do that? I found an example that used CreateObject("Zmud.Application") and loaded the current session and attempted a command execution based on that, but the script always failed on the createobject...

I tried something simple like
mytestvar = 1
echo mytestvar

and variations of that... couldn't get anything to work... anyone want to point me in the right direction?
_________________
If you're ever around Aardwolf, I'm that invisible guy you can never see. Wizi ftw! :)
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Apr 22, 2007 10:55 pm   
 
You can't at the moment. It'll be in very soon I expect - there'll be zcmd and zfunc objects that you can call to execute zScript commands and functions, but they're not in yet. Right now all you can do is assign and call variables with the zvar syntax. But that doesn't work in all cases, as I described above.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Apr 23, 2007 1:07 am   
 
Fang is correct. All you can access right now is "zvar". I didn't want to implement zcmd and zfunc until I knew how this was working.

Fang: the syntax for Perl is:

$zvar.varname = value

In Perl, all variables start with the $ character.

On Ruby, I'm not sure what is wrong, since I haven't done much Ruby programming myself. Anyone know how Ruby handles COM objects? Does it have any sort of CreateObject method for creating them? Once you have a COM object, how do you access it's properties and methods? zvar is a COM object. It's dynamic, which means that the properties of this object (your CMUD variables) change over time. If the scripting language caches the property/method ID values (which it isn't supposed to, but might), then it won't work properly. But it sounds more like a syntax issue for how you access COM variables within Ruby.

Thinjon100: The example you found was for zMUD. For CMUD, just change your CreateObject from "zmud.application" to "cmud.application" and then it should work.
Reply with quote
Thinjon100
Apprentice


Joined: 12 Jul 2004
Posts: 190
Location: Canada

PostPosted: Mon Apr 23, 2007 1:17 am   
 
[Homer] Doh! [/Homer]

Now I feel silly. Thanks for the help.

By the way... just a minor suggestion perhaps, but most languages include something akin to an 'echo' command... would it be feasible to link a scripting language's 'echo' output to a sort of 'send to mud' command? Not sure if parsing it or not would be ideal... but if it's possible, it might be a good implementation.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Apr 23, 2007 2:11 am   
 
Nope, no way to link into that kind of thing. But if you take a look at the "Root" object in zApp, you will see that there will be some core routines available to all scripting languages once I migrate the zApp libraries into CMUD.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon Apr 23, 2007 3:07 am   
 
ActivePerl still isn't working using that syntax you gave me :(

The correct syntax in Ruby is (unsurprisingly)

$zvar["varname"] = value

Also, is anyone else having the same problem with JScript that I was having?

EDIT: Either I've done something to it, or I was (or am) dreaming, but that Ruby syntax has stopped working. How annoying.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1244

PostPosted: Tue Apr 24, 2007 12:39 am   
 
Fang Xianfu wrote:
That's why I'll be extremely happy if Lua gets put straight into CMUD. Then the script won't be going Lua -> LuaScript -> WSH -> CMUD, with each of those steps creating more problems and incompatabilities and lacks of documentation.

I don't think WSH is actually in there - Zugg said he had his own scripting host (following the M$ documentation), so you can take that one out of your flowchart.
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Apr 24, 2007 2:50 am   
 
Sorry, I made another mistake with perl. The syntax should be:

$zvar->varname = value

Perl uses the -> instead of the . for object properties and methods.
Reply with quote
Nick Gammon
Adept


Joined: 08 Jan 2001
Posts: 255
Location: Australia

PostPosted: Mon Jun 18, 2007 6:18 am   
 
Thinjon100 wrote:
By the way... just a minor suggestion perhaps, but most languages include something akin to an 'echo' command... would it be feasible to link a scripting language's 'echo' output to a sort of 'send to mud' command? Not sure if parsing it or not would be ideal... but if it's possible, it might be a good implementation.


One of the nice things about Lua is you can redefine how functions work. For example, when I added Lua to MUSHclient, I made my own "print" function, which replaced the standard one (which sends to stdout). The replacement function effectively just writes to the output window, which is what you expect it to do reallly.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
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