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
StackAdder
Wanderer


Joined: 30 Sep 2003
Posts: 77
Location: United Kingdom

PostPosted: Tue Sep 30, 2003 5:46 pm   

Using VBScript ...
 
As I was having hassle with the ZMud script syntax, I thought I would give VBScript a go.
First thing was that it decided I had to re-register my JIT - which is odd cos I use vbscript in WSH a fair amount - but after re-registering it has settled down a bit.

One thing I am stuck on (probably through inadequate reading of the manual...) is how to access matched patterns from within vbscript if I am using it to service a trigger...

However I also had a couple of issues with just getting it to run as expected. I thought I would start off with a copy of Zugg's list-the-aliases example.

'dim cc as Object
'dim ss as Object
'dim o as Object

Set cc = CreateObject( "Zmud.Application")
Set ss = cc.CurrentSession
N = ss.NumAliases
msgbox(n)
for I = 0 to N-1
Set o = ss.AliasNum(I)
ss.sendstr(o.name)
next

Set cc = Nothing

Note I have commented out the Dim statements, because they cause the script engine to fall over.

ss.sendstr(o.name) doesn't do anything... is this because the zmud application is already running when I do a createobject? I don't think it is, but if so, how do I access the existing object?

The main reason I don't think that that is the problem is that if I replace ss.sendstr with msgbox I get a faithful representation (albeit in a popupy kinda way) of the aliases I have...

Anyone got a link to something useful in the way of a help file?
Reply with quote
Zugg
MASTER


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

PostPosted: Tue Sep 30, 2003 6:49 pm   
 
You don't need the CreateObject. When running VBScript scripts in zMUD, there are already predefined objects: zMUD and Sess for the current zMUD application and the current session. Do, for a script within zMUD, you'd just do:

N = Sess.NumAliases
msgbox(n)
for I = 0 to N-1
Set o = Sess.AliasNum(I)
Sess.sendstr(o.name)
next
Reply with quote
StackAdder
Wanderer


Joined: 30 Sep 2003
Posts: 77
Location: United Kingdom

PostPosted: Tue Sep 30, 2003 8:10 pm   
 
Yay thanks - that's what I pay for quality service from the man himself. Oh and for a damn good client.

I am hoping to get round to some serious scripting soon... I will post results of interesting bits to completed scripts as I go

cheers Zug
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