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
➜ Dangit, I need a GOOD vbs reference site.
Dangit, I need a GOOD vbs reference site.
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Sat 05 Jan 2002 02:56 PM (UTC) |
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. | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #1 on Sat 05 Jan 2002 03:29 PM (UTC) |
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. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #2 on Sat 05 Jan 2002 09:27 PM (UTC) |
Message
| |
Posted by
| Krenath
USA (76 posts) Bio
|
Date
| Reply #3 on Mon 07 Jan 2002 10:19 PM (UTC) |
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 | 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.
17,583 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top