Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ MUSHclient and VBScript variables

MUSHclient and VBScript variables

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Wink   (16 posts)  Bio
Date Tue 29 Mar 2005 12:46 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 29 Mar 2005 05:24 AM (UTC)
Message
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).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Wink   (16 posts)  Bio
Date Reply #2 on Fri 01 Apr 2005 08:13 PM (UTC)
Message
Exactly what I needed to know, thank you, Nick.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


14,335 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.