[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Dangit, I need a GOOD vbs reference site.

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Dangit, I need a GOOD vbs reference site.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Sat 05 Jan 2002 02:56 PM (UTC)  quote  ]
Message
Argh, another syntax error and Microsoft's site is of no use. I need a vbs book, but I don't buy books 'cause everything is on the internet, it's just a matter of finding it. :)

In the meantime, I'll ask the living VBS book, Nick:

Dear Guru, how do I get this line to work?

If Not Casting AND Not PauseCasting Then

So simple, yet so hard...

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #1 on Sat 05 Jan 2002 03:29 PM (UTC)  quote  ]
Message
Sometimes, it helps not to be an idiot.

I tried:

If (Not Casting) AND (Not PauseCasting) Then

...and was stumped as to why it wasn't working. Finally, when I inserted lines before the IF statement to echo the values, I realized the STUPID error of my ways:

If (Not World.GetVariable("Casting")) AND (Not World.GetVariable("PauseCasting")) Then

I was using the wrong variables! Aaaaaaarrrgh!

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Nick Gammon   Australia  (18,770 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Sat 05 Jan 2002 09:27 PM (UTC)  quote  ]
Message
This link will probably become out-of-date one day, but try this: Microsoft's VBScript Documentation

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Krenath   USA  (74 posts)  [Biography] bio
Date Reply #3 on Mon 07 Jan 2002 10:19 PM (UTC)  quote  ]
Message
"Clarify your code by using local VB variables."

Huh? What did he say? What's that mean?

Well, if you're constantly gonna use the values from MUSHclient's variable collection, why not assign them to VB variables (which have the advantages of FAR shorter names and much less punctuation) to help clear things up.

Here's how I'd have written the exact same code. Sure there are more lines doing the job of the one example line, but if there was a LOT of code to come after the example, I'd end up saving a lot of typing and have some understandable code as well.

Quote:

'b stands for Boolean value. I use one-letter prefixes
' to indicate variable types. s=string, i=integer...
Dim bCasting,bPauseCasting

bCasting = World.GetVariable("Casting")
bPauseCasting = World.GetVariable("PauseCasting")

If Not (bCasting Or bPauseCasting) Then
'...stuff here...
End If


By using local VB variables, you eliminate the World.GetVariable("...") in each place you have to use it. If there's a lot of repetition, this'll clean things up quite a lot. If there's not a lot of repetition, it's often not worth the bother.

- Krenath from
bDv TrekMUSH
ATS TrekMUSH
TNG TrekMUSE
TOS TrekMUSE
[Go to top] 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.


3,404 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]