How to check if user uses a / command
Blitz3D Forums/Blitz3D Beginners Area/How to check if user uses a / command
| ||
| How can I detect if a user has entered a / command? |
| ||
| I'm not entirely sure what you mean by a "/" command, but from what you've posted, I'm assuming you mean they enter something beginning wth "/" You have a problem here: If SndMsg <> "" If(Left$(SndMsg, 1)) = "/" Select SndMsg Case "test" The Case you check for of SndMsg="test" will never be true since you begin with: If(Left$(SndMsg, 1)) = "/" What you may wish to try is something like:
Local Command$=""
If SndMsg <> ""
Command=Lower$(Right$(SndMsg$,Len(SndMsg$)-1))
If(Left$(SndMsg, 1)) = "/"
Select Command$
Case "test":
MessageBox(0,Lower$(Right$(SndMsg,Len("test"))),Lower$(Right$(SndMsg,Len("test"))),0)
End
End Select
EndIf
EndIf
Or even:
If SndMsg <> ""
If(Left$(SndMsg, 1)) = "/"
SndMsg$=Lower$(Right$(SndMsg$,Len(SndMsg$)-1))
Select SndMsg$
Case "test":
MessageBox(0,Lower$(Right$(SndMsg,Len("test"))),Lower$(Right$(SndMsg,Len("test"))),0)
End
End Select
EndIf
EndIfEnsuring you check for the actual 'command' wording excluding the "/" character. |
| ||
| This code is PERFECT! Thanks Malice! |