-
Detect String
Hey this is my 3rd topic I need help on. Some of you know I am making a mod for a game called CSPSP, and so far it's AWESOME. I need help now. In that game there is a bug where when you join the game from a PSP and type something in chat, your message shows up to other people, but not to you. Also, you can't join teams. If you quit the game, you will have to wait, because when you quit, your name is still in the server so you wait ~1 min until server clears up players (bad coding), if you kick that person, they can rejoin without having to wait.
So: I need to make a command like "!bug", and it kicks the players
In the text box, when they say bug, it shows up as
*SPEC* Player1: !bug
How do I make it so the person can type bug, and the computer detects the string BEFORE the : and AFTER the *SPEC*? This is very difficult for me, since I just learned how to get the string AFTER the command, but now it's a lot more advanced. Please help. Even if you try, I will give you +REP
I want the player name to be in STRING_HERE
Code:
Call SendMessage(hWndTextbox, WM_SETTEXT, 0, "/ban " & STRING_HERE)
Call PostMessage(hWndTextbox, WM_KEYDOWN, VK_RETURN, 0)
Sleep (75)
-
Re: Detect String
-
Re: Detect String
Here are a couple of different ways of getting the info out of the string, using split is probably the easiest of the two. Output is to the debug window (ctrl + g)
Code:
Private Sub Command1_Click()
Dim s$, EndPosSpec&
s = "*SPEC* Player1: !bug"
EndPosSpec = InStr(1, s, "*SPEC*") + Len("*SPEC*")
Debug.Print Mid(s, EndPosSpec, InStr(1, s, ":") - EndPosSpec)
Debug.Print Split(s, (" "))(1)
End Sub
-
Re: Detect String
what you write means very little to me...
when you type *spec* do you mean that these characters always appear as in your example or is *spec* a shortcode for some random amount of garbage you wish to ignore
here to help