• Log in or sign up for an account here: https://www.sythe.org/login

IRC like chat - parsing data?

gigabyt3r

Member
Banned
Joined
Jul 31, 2007
Sythe Gold
0
Messages
64
IRC like chat - parsing data?
Im trying to get my server to recognize '/nick newnick' but i cant figure it out. I tried Left, right and mid functions but i still cant do it, hes part of the code

Code:
Winsock1.GetData Data
If InStr(Data, "/nick") Then
Nick = Mid(Data, 6, 9)
txtChat.Text = txtChat.Text & "Nickname changed to " & Nick & vbCrLf

But it doesnt work. does anyone know why? i can post more of the code if u need
 
IRC like chat - parsing data?
Im trying to get my server to recognize '/nick newnick' but i cant figure it out. I tried Left, right and mid functions but i still cant do it, hes part of the code

Code:
Winsock1.GetData Data
If InStr(Data, "/nick") Then
Nick = Mid(Data, 6, 9)
txtChat.Text = txtChat.Text & "Nickname changed to " & Nick & vbCrLf

But it doesnt work. does anyone know why? i can post more of the code if u need
How about some details.

"Does not work" usually doesn't cut it if you're asking for help.
 
IRC like chat - parsing data?
When someone types '/nick newnick' without the quotes i want it to get the text after the /nick part. So if someone typed '/nick Peter' i want it to set their nickname to Peter but i cant figure out how to parse the text after the /nick part
 
IRC like chat - parsing data?
Code:
nick = Trim(Mid(Data, 6))
or
Code:
nick = Trim(Replace(Data, "/nick", vbNullString))
And I could go on. There are many ways of grabbing the text, those two are just simple ones
 
IRC like chat - parsing data?
Well to start with, do you want it to change the user's nickname when THEY type "/nick Covey" or do you want it to DISPLAY that someone has changed their nick (a person not using your client).

If you want it to DISPLAY the nickname change when someone else changes their nick i think (using my dodgy memory) the RAW data you are looking for is something like:
Code:
:<CURRENT_NICK> <HOSTMASK> NICK: <NEW_NICK>:

But if you want to change someone's nickname who IS using your client you will have to search the textbox that they type in, for example:
Code:
public sub CheckNickChange(strData as string)
    strdata = ltrim(strdata)
    if mid(ucase(strdata),a,6) = "/NICK " then
        'do stuff here
    end if
end sub
 
Runescape Gamblingrunescape gambling
Back
Top