Does not Equal

Posted by WRTIII on Sun 12 Jan 2003 10:58 AM — 7 posts, 51,765 views.

Canada #0
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
Canada #1
If D <> A Then
Canada #2
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.
Amended on Sun 12 Jan 2003 11:54 AM by Magnum
United Kingdom #3
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~
Canada #4
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?
USA #5
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.
Australia Forum Administrator #6
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".