-
Here is my code:
If Left(Text, InStr(Text, " ")) = "!num " Then
End If
If Val(Mid(Text, InStr(Text, " "))) = 0 Then
Exit Sub
End If
If Number = 0 Then
Number = (Rnd(Time) * 50) + 1
End If
If Val(Mid(Text, InStr(Text, " "))) = Number Then
BRBot.SendText Handle & " guessed the right number"
Number = 0
End If
If Val(Mid(Text, InStr(Text, " "))) > Number Then
BRBot.SendText "Lower than " & Val(Mid(Text, InStr(Text, " ")))
End If
If Val(Mid(Text, InStr(Text, " "))) < Number Then
BRBot.SendText "Higher than " & Val(Mid(Text, InStr(Text, " ")))
End If
When a person gets to say !num 6 it will say "higher then 6" and then they guess !num 8 and it will say "lower then 8" then they'd guess !num 7 and it would say "lower then 7" now thats obviously messed up. Someone help?
-
1 Attachment(s)
Please let me know if this is otherwise, but I guess this is what you want & have done you a sample ..
-
hmm... hehe no no.. you would type !num in the chat area and then a bot I loaded, would say if they were right or not
-
it's a simple bug, when you test the number, you set it to zero before you next if-then statements, thus when you get to the statements, the number is zero. this will fix it (note also that the first if then statement does nothing, it should include the whole chunk of code that follows):
Code:
If Left(Text, InStr(Text, " ")) = "!num " Then
If Val(Mid(Text, InStr(Text, " "))) = 0 Then
Exit Sub
End If
If Number = 0 Then
Number = (Rnd(Time) * 50) + 1
End If
'i rearanged the if-then statements so the equals one is last
If Val(Mid(Text, InStr(Text, " "))) > Number Then
BRBot.SendText "Lower than " & Val(Mid(Text, InStr(Text, " ")))
End If
If Val(Mid(Text, InStr(Text, " "))) < Number Then
BRBot.SendText "Higher than " & Val(Mid(Text, InStr(Text, " ")))
End If
If Val(Mid(Text, InStr(Text, " "))) = Number Then
BRBot.SendText Handle & " guessed the right number"
Number = 0
End If
End If
-
hey i still get the same error with that one.
-