Particle Posted October 4, 2007 Share Posted October 4, 2007 ok well i'm completely stumped right now. i've been working that that clien/server chat program i found on these forums kind of beefing it up to be a nice little chat program for my friends and i. so far everything has been goin well untill the emote part...for those who may not know... to Emote means to give expression. so in the chat usually when u talk it's like:Particle > hey supPookie > nothin...but i want an emote feature so i can do stuff like:Particle is bored>heres some experiemental code that i tried but did not work(the comments are the different ways i tried but failed):CLIENT PART$me = GUICtrlCreateButton("Emote", 155, 40, 50, 20) GUICtrlSetOnEvent($me, "_Emote") Func _Emote() If not GUICtrlRead($input) Then Return 0 ;TCPSend($sock, GUICtrlRead($input), Chr(1), "emote", Chr(2), "") ;TCPSend($sock, Chr(1), "emote", Chr(2), "") ;TCPSend($sock, Chr(1), "", Chr(2), "emote") ;TCPSend($sock, StringReplace(StringReplace(GUICtrlRead($input), Chr(1), "emote"), Chr(2), "")) ;TCPSend($sock, StringReplace(StringReplace(GUICtrlRead($input), Chr(1), ""), Chr(2), "emote")) GUICtrlSetData($input, "") Return 1 EndFuncSERVER PARTexpandcollapse popupFunc _CheckConn() Local $recv = "" For $i = 0 to 16 If $list[$i][0] Then $recv = TCPRecv($list[$i][0], 2048) If @error Then ; disconnect client TCPCloseSocket($list[$i][0]) _SendAll(Chr(1) & "deluser" & Chr(2) & $list[$i][1]) $list[$i][0] = 0 $list[$i][1] = "" Else If $recv Then ; parse the command(s) $recv = StringSplit($recv, Chr(1)) For $j = 1 to $recv[0] $temp = StringSplit($recv[$j], Chr(2)) Switch $temp[1] Case "bye" TCPCloseSocket($list[$i][0]) _SendAll(Chr(1) & "deluser" & Chr(2) & $list[$i][1]) $list[$i][0] = 0 $list[$i][1] = "" Case "kick" _Kick($temp[2]) Case "PM" _PM($temp[2], $temp[3], $list[$i][1]) Case "emote" _Emote($temp[2]) Case Else If $recv[$j] Then _SendAll($recv[$j], $list[$i][1]) EndSwitch Next EndIf EndIf EndIf Next EndFunc Func _Emote($str, $from = "", $except = 0 ) ; send a message to all users For $i = 0 to 16 If $list[$i][0] and $list[$i][0] <> $except Then If $from and StringLeft($str, 1) <> Chr(1) Then TCPSend($list[$i][0], $from & $str & " > ") Else TCPSend($list[$i][0], $str) EndIf EndIf Next EndFuncI know my code for emoting is probably completely wrong, but i'm trying my best and i want to learn more...please help? Link to comment Share on other sites More sharing options...
Particle Posted October 4, 2007 Author Share Posted October 4, 2007 no help at all? Link to comment Share on other sites More sharing options...
i542 Posted October 4, 2007 Share Posted October 4, 2007 Well, maybe you can make a menu named "Emotions" and there will be "Happy", "Sad", etc and when user clicks on one of them a code sends. Then the client part (hopefully) recognizes the code and writes "Odie is Happy", "Garfield is in love" etc. I can do signature me. Link to comment Share on other sites More sharing options...
Particle Posted October 4, 2007 Author Share Posted October 4, 2007 i want to give the users ability to make their own emotes, have u ever played on battle.net? you would know what i mean. Link to comment Share on other sites More sharing options...
i542 Posted October 4, 2007 Share Posted October 4, 2007 i want to give the users ability to make their own emotes, have u ever played on battle.net? you would know what i mean.No...I played Club Penguin...hmm... but I know what you meanThis is a little complicated because of fact that the emote registered on one client is not registered on another clientbut if you send for example "registerEmote='waddles around'" and then "callRegisterEmote" to another client he would register "waddles around" and on "callRegisterEmote" it would say "i542 waddles around"... i542 I can do signature me. Link to comment Share on other sites More sharing options...
Particle Posted October 4, 2007 Author Share Posted October 4, 2007 no it's really not complicated, it's just reconfiguring some code around but i don't know how to reconfig the right way. if no one desides to help me i'm sure i'll eventually figure it out, but help would be appreciated... Link to comment Share on other sites More sharing options...
Particle Posted October 5, 2007 Author Share Posted October 5, 2007 c'mon someone has to know. i'm only posting here so the post will go back up top and someone smart enough will read and help :-\ Link to comment Share on other sites More sharing options...
Particle Posted October 5, 2007 Author Share Posted October 5, 2007 Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 5, 2007 Share Posted October 5, 2007 (edited) Bumping will only get you flamed. I think i542 had the right idea. When your client sends a "/me farts loudly" into the client, replace /me with a specialized character ... say CHR(199)... the server reads CHR(199) as an emote and strips the ">" prompt from in front of the user's name and then echoes the stripped text back to the entire chat network. Simple. Edited October 5, 2007 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Particle Posted October 5, 2007 Author Share Posted October 5, 2007 jesus christ u guys are not listenin to me....i don't want that crap that i542 said. i want to do what i asked help for. Link to comment Share on other sites More sharing options...
Blue_Drache Posted October 5, 2007 Share Posted October 5, 2007 Ok, forget getting help. Kthxsbai. Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
Glyph Posted October 5, 2007 Share Posted October 5, 2007 (edited) ;EMOTE OMG Func _Emote($str, $from = "", $except = 0 ) ; send an emote to all users For $i = 0 to 16 If $list[$i][0] and $list[$i][0] <> $except Then If $from and StringLeft($str, 1) <> Chr(1) Then $from2 = StringTrimRight($from,2) TCPSend($list[$i][0], $from2 & " " & $str & " >" & @LF) Else TCPSend($list[$i][0], $str) EndIf EndIf Next EndFunc;==>Emote Func _SendAll( $str, $from = "", $except = 0 ) ; send a message to all users For $i = 0 to 16 If $list[$i][0] and $list[$i][0] <> $except Then If $from and StringLeft($str, 1) <> Chr(1) Then TCPSend($list[$i][0], $from & " " & $str & @LF) Else TCPSend($list[$i][0], $str) EndIf EndIf Next EndFunc blha, i didnt test it. hold on. Edited October 5, 2007 by BackStabbed tolle indicium Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now