I need help getting my greet to change by command heres what im tring but it wont work. plz help.
'####Greet
If Left(Message, Len(varBotTrigger) + 3) = varBotTrigger & "greet" Then
If username = varMaster Then Bot_Settings.txtGreet.Text = Mid(Message, 6)
If username = varMaster Then CleanSlateBot1.Send "Greet Message Changed"
If username = varMaster Then AddChat rtbChat, varUsername & ": Greet Changed" & vbNewLine, vbWhite
End If
'=================================================================================
Len("greet") != 3
If I may make a suggestion. If you are making more than 1 command, it would be better to use a select case. As such:
If Left(Message, Len(varBotTrigger)) then
Dim CMD as string
CMD = Split(Message & Space(1), Space(1))(0)
CMD = Mid(CMD, Len(varBotTrigger) + 1)
Select case LCase(CMD)
'INSERT CASES HERE
End Select
End If
This could be better, But Let me explain it to you. #1 the If statement, It checks to see if the bot's trigger is the 1st part of the message. Then The Split(), That Spits out the 1st word in the message, (determined by a space). Then the Mid() Cuts off the trigger from the CMD, then Select Case LCase(CMD) starts a select case of the LOWERCASE ver of the CMD, This makes it so that commands are case InSensitive.
Then you jsut add Cases between teh Select Case & End Select such as Case "greet"
If username = varMaster Then
Bot_Settings.txtGreet.Text = Mid(Message, 6)
CleanSlateBot1.Send "Greet Message Changed"
AddChat rtbChat, varUsername & ": Greet Changed" & vbNewLine, vbWhite
End If
note: "greet" is lower case, it must be lower case to work becase of the LCase(CMD).
note2: i combined your 3 if statements into 1
note3: cases dont need end case, just end select.
also as FoFo stated "greet" = 5 not 3
~-~(HDX)~-~
Thanks i will try it as soon as i get hom from school.