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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Does not Equal

Does not Equal

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


Posted by WRTIII   Canada  (76 posts)  [Biography] 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
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] 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.
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] 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:

If NOT (D = A) Then

...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.
[Go to top] top

Posted by Rhinoa   United Kingdom  (37 posts)  [Biography] 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~
[Go to top] top

Posted by WRTIII   Canada  (76 posts)  [Biography] 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?
[Go to top] top

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] 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
[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.


42,031 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at HostDash]