MUSHclient and VBScript variables

Posted by Wink on Tue 29 Mar 2005 12:46 AM — 3 posts, 15,111 views.

#0
I did quite a few searches on this topic, but the search parameters that I could think of were always too large for me to get an answer to my question. So I figured I'd post it and see if anyone can give me a couple answers (sorry about the recent rush of topics that I've posted in quick succession, also).

Basically what I think that I know is that MUSHclient variables will be saved when I exit the world, whereas VBScript ones will not. So is it generally easiest to only use MC variables where I need them to be saved?

My example is a scenario that I encounter frequently, in which a trigger sets the value of the variable abc and makes a note as such, through the "send to: script" function:

world.SetVariable "abc", vbtrue
world.note "ABC active"

However, it's not important that the value of abc is saved when I close the world. So could I simply do a "send to: script" of this?

abc = vbtrue
world.note "ABC active"


My second questions is a follow up on that. If I define a variable (such as "abc = vbtrue") through the "send to: script" in a trigger, alias, or timer, is abc then available to be used by any script function? To clarify what I mean, if I were to declare a variable, like "Dim abc", outside of a Sub procedure, then it could be used by any Sub in that world (as far as I know). Would this have the same effect?

Many thanks to anyone who can provide some info on this.
Australia Forum Administrator #1
You are correct, setting any VB variable (defined outside of a sub) will set the global variable which will persist for that session.

Using "send to script", or the script file, all share the same script "space" so variables can be shared between them. However if you use plugins then plugins have their own script spaces (each).
#2
Exactly what I needed to know, thank you, Nick.