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
➜ Does not Equal
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| WRTIII
Canada (76 posts) Bio
|
Date
| Sun 12 Jan 2003 10:58 AM (UTC) |
Message
| How do I do does not equal?
Here is my code,
Sub Crackitman (Timername, name, safe)
if Isempty(world.getvariable ("CODE")) then
world.setvariable "CODE", "000"
end if
Dim CODE, A, B, C, D, E, F
CODE = world.getvariable ("CODE")
If CODE < 10 then
B = 0
C = 0
end if
if CODE < 100 and CODE > 9 then
C = 0
end if
A = mid (CODE, 1, 1)
B = mid (CODE, 2, 1)
C = mid (CODE, 3, 1)
If D=
world.send "TURN 1 TO " & A
world.send "TURN 2 TO " & B
world.send "TURN 3 TO " & C
world.send "open safe"
D = mid (CODE, 1, 1)
E = mid (CODE, 2, 1)
F = mid (CODE, 3, 1)
C = C + 1
if C = 10 then
C = 0
B = B + 1
end if
if B = 10 then
B = 0
A = A + 1
end if
CODE = A & B & C
If CODE = 1000 Then
CODE = 000
end if
world.setvariable "CODE", CODE
End Sub
Or the partial of it
I figure if I take D E F as the values before then before I turn the safe door I do
If D DNE(does not equal) A than cahnge dial
If it does skip the step
If E DNE B Then change the dial
Else Skip the Step
If F DNE C then change the dial
Else Skip the Step
No since in changing the dial to 1 if it's already at one plus it would cut down on the amount of spam I send to the mud | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #1 on Sun 12 Jan 2003 11:43 AM (UTC) |
Message
| If D <> A Then |
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 #2 on Sun 12 Jan 2003 11:53 AM (UTC) Amended on Sun 12 Jan 2003 11:54 AM (UTC) by Magnum
|
Message
| I should also point out, you can use the word NOT as well. This is particularly useful when you want to test if a Boolean variable is 'False'.
If NOT IsEmpty(Variable) Then
...and technically, you could even use it for what you want:
...although my first answer is much simpler. |
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Rhinoa
United Kingdom (37 posts) Bio
|
Date
| Reply #3 on Sun 12 Jan 2003 02:01 PM (UTC) |
Message
| If I understand you correctly, then this is what you want.
Public D, E, F
Sub Crackitman (Timername, name, safe)
if Isempty(world.getvariable ("CODE")) then
world.setvariable "CODE", "000"
end if
Dim CODE, A, B, C
CODE = world.getvariable ("CODE")
If CODE < 10 then
B = 0
C = 0
end if
if CODE < 100 and CODE > 9 then
C = 0
end if
A = mid (CODE, 1, 1)
B = mid (CODE, 2, 1)
C = mid (CODE, 3, 1)
if D <> A then
world.send "TURN 1 TO " & A
end if
if E <> B then
world.send "TURN 2 TO " & B
end if
if F <> C then
world.send "TURN 3 TO " & C
end if
world.send "open safe"
D = mid (CODE, 1, 1)
E = mid (CODE, 2, 1)
F = mid (CODE, 3, 1)
C = C + 1
if C = 10 then
C = 0
B = B + 1
end if
if B = 10 then
B = 0
A = A + 1
end if
CODE = A & B & C
D = mid (CODE, 1, 1)
E = mid (CODE, 2, 1)
F = mid (CODE, 3, 1)
If CODE = 1000 Then
CODE = 000
end if
world.setvariable "CODE", CODE
End Sub
~Rhinoa~ | Top |
|
Posted by
| WRTIII
Canada (76 posts) Bio
|
Date
| Reply #4 on Sun 12 Jan 2003 03:36 PM (UTC) |
Message
| Hmm .. Well the way I did it with .getvariable like how CODE was done works
but now you got me curious, I have no clue about or how that
public d e f
part works, but if it is how I think, why not do the varible CODE like that as well? | Top |
|
Posted by
| Shadowfyr
USA (1,791 posts) Bio
|
Date
| Reply #5 on Sun 12 Jan 2003 10:23 PM (UTC) |
Message
| You could.. However variables that are not saved with setvariable do not remain intact if you reload the script. In this case it may not matter, but if you had a long wait while it cracked things and you went and edited your script for something else that you where doing, then as soon as it reloaded the changed script, it would immediately lose track of what it was doing. It is just a little safer, but not always necessary. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #6 on Sun 12 Jan 2003 11:10 PM (UTC) |
Message
| Once again you are starting a new forum subject and repeating your original code. Please confine questions that are related to the same piece of code to the same subject. It is confusing and wasting of space to keep repeating the code breaking code over and over. ie. "reply to this subject" rather than "start a new subject". |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
45,208 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top