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
Snark
Novice


Joined: 15 Nov 2001
Posts: 38
Location: Russia

PostPosted: Tue Sep 16, 2003 3:36 am   

zMud and PerlScript
 
Does anybody have successful experience in writing aliaces/triggers etc. with PerlScript? I do it perfectly using VBScript, but have problems with PerlScript. I installed last ActivePerl, checked my Windows Scripting Host (via writing simple PerlScript .WSF-file) and made sure that WSH now understands PerlScript. But when I try to use perlscript instead of VBScript while writing - say - aliases, I get NOTHING. Exactly nothing! I tried to write something like "sdfsdfsdf" in "Scripting language" box and found that zMUD knows about PerlScript existance (it says "No such scripting language exists" for "sdfsdfsdf" and doesn't write any error message if I use "perlscript" instead). But when I try to run my simpliest perlscript alias I have nothing! No results, no error messages - absolutely nothing! Moreover, I tried to write PerlScript alias with single line: "blablabla", what is wrong for sure. I didn't have any error message still!

Well, the question is at the very top. zMUD + PerlScript: have you seen it working together?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Sep 16, 2003 4:36 am   
 
Someone reported PerlScript working fine during the beta testing of adding W.S.H., error reporting is left up to the individual dll's that implement a scripting system. I can't say whether ActivePerl preforms this according to MS's wishes, but valid code should work if you use the correct language by following the help for #SS, #MSS, %mss, and others that I forget (hit related functions/commands).
Reply with quote
Snark
Novice


Joined: 15 Nov 2001
Posts: 38
Location: Russia

PostPosted: Tue Sep 16, 2003 7:29 am   
 
Well, after some research I found that the only real problem with PerlScript is this: if you have error in your script it "dies" without any warning, so you can think that nothing happens at all. But you can avoid it, for example, this way: place 2 following lines at the very beginning and at the very end of your script:

$sess->EchoStr("!!! start !!!",15);
# your script here
$sess->EchoStr("!!! end !!!",15);

... and you'll see whether your script running or has an error inside.

But now I'm thinking about 2 next problems. One of them is not so serious: is there a way to change zMUD variable value without using COM.ProcessCommand interface. For example, in VBScript you can do it like this:

sess.GetVar("fr1","").value="new value"

But the line below doesn't work at all in PerlScript:

$sess->GetVar("fr1","")->Value="new value";

(Notice that $sess->GetVar("fr1","")->Value exists and contains value of variable fr1)

It was the 1'st problem. And the 2'nd is more serious. I can't find how can I pass parameters into PerlScript alias. For example in VBScript I can do it like in zScript:

Dim p1, p2

p1=%1
p2=%2

... and voila - I have 2 parameters from command line of my alias. But the same attempt in PerlScript:

$p1=%1;
$p2=%2;

... causes and error (for sure as it has to do). Still haven't figured out how to avoid it...
Reply with quote
Interitus
Novice


Joined: 16 Mar 2003
Posts: 45
Location: Russia

PostPosted: Sun Sep 21, 2003 2:18 pm   
 
Hi Snark!
Here is the solution for your second problem.
$p1="%1";
$p2="%2";
And voila ;) But it doesn't work without quotes.

Что делать с первой проблемой я не знаю, потому как только после твоего поста я осознал, что можно перл юзать оказывается. ;)

Interitus.
Reply with quote
Interitus
Novice


Joined: 16 Mar 2003
Posts: 45
Location: Russia

PostPosted: Sun Sep 21, 2003 2:35 pm   
 
And for your first problem: use MakeVar instead of GetVar:
$sess->MakeVar("fr1","new value","","");

Interitus.
Reply with quote
Snark
Novice


Joined: 15 Nov 2001
Posts: 38
Location: Russia

PostPosted: Mon Sep 22, 2003 2:41 am   
 
Wow! Great! Thanks a lot. :)
Although MakeVar isn't a clear and right way still, nevertheless it's much better then ProcessCommand. And about 2'nd problem solution - great! Viva la Perl! :)
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