mIRC Home    About    Download    Register    News    Help

Print Thread
need a little help plz #1430 13/12/02 02:43 AM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
hey, i need to sort through some text i recieve from a raw on my server, now i have a pretty good idea this will be done with $regex or $regsub, but i cant quite get it, this is an EXAMPLE of the text i have to sort:

Code:
 :G,U,MY,.₤ờяđЖŘąΰэא H,U,MY,Dec2 G,U,PX,.Dec H,U,PY,.฿łã¢ҜŞãЂЂãŧђ H,U,MY,.™ÐÈÇÓÐÊR¿



and the end result needs to look something like:

[color:red]
Code:
.₤ờяđЖŘąΰэא Dec2 .Dec .฿łã¢ҜŞãЂЂãŧђ .™ÐÈÇÓÐÊR¿
[/color] 


Note: there wont always be a . beside each name, and also note that i am trying to make this information be processed and sorted as FAST as possible, so i guess you can say i am looking to have the info processed with one call to something, without any loops or anything, IF its possible, and i know it must be smile

Re: need a little help plz #1431 13/12/02 08:40 PM
Joined: Dec 2002
Posts: 208
C
Cobra Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
ok first of all, your asking us to write the script for you rather than give u help on a script your trying to make for it...

second of all, you gave us only 1 example, without knowing the different ways the string could vary we dont know which parts are constant and which are varable, so theres no posible way we can make a working identifer to parse out what u want without this information in the first place.

u showed us what u wanted out of the first example but u didnt explain why that bit was sugnificant, just like your mind is able to look at it and see .. ok this is the part i want, you have to tell a script how to recnoize which parts to grab and which to leave .. to do this you have to define rules

I could just simply guess at what other strings may look like and return similar data .. but it would only be a guess not probly not 100% accurate.

so alot more detail would be apricated :P

Cobra^

Re: need a little help plz #1432 13/12/02 08:49 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
Well its hard to say the exact details, or i would have, but it all depends on what room i join, and how many ppl are in them, cause those are pplz names, the data will always look SIMILAR to that,, with different names, . befor name if owner status, @ if op status, nothing if participant, and then the H,GU,Y those are never the save, they vary per person, i can give many example, like the one i gave up there, but the best part of info i can give, is that infront of each name, there is always going to be the *,*,*,namehere

along with the fact that there wont alway be 6 names, or 5 names, or 2 names or whatever, but no matter how many names will be there, and whatever the names are, it will always be something like:

*,*,*,NICKNAME *,*,*,.OWNERNICKNAME *,*,*,@OPNICKNAME

not in any specific order

Re: need a little help plz #1433 13/12/02 08:52 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
here are a few example of the whole string i get from the server:

Code:
 
:TK2CHATCHATA01 353 -NightChillz- = %#!!!!!Botz :H,U,MX,.-NightChillz- H,U,RX,VASH_666 H,U,RX,[Mayhem] H,U,MY,@βŁŬ€ĴÃ¥ک_ЯŲĻЄ7 G,U,MY,Alkaholik Scripta



:TK2CHATCHATA01 353 -NightChillz- = %#!!!!!Botz :H,U,PX,M3th0d` G,U,MX,.NightChillz H,U,MY,§møkie G,U,MX,.₪§ċäйизя₪ H,U,MY,@Dec2



:TK2CHATCHATA01 353 -NightChillz- = %#!!!!!Botz :G,U,PX,.Dec H,U,MY,.™ÐÈÇÓÐÊR¿
 



Re: need a little help plz #1434 13/12/02 09:10 PM
Joined: Dec 2002
Posts: 208
C
Cobra Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
i know u didnt want a loop, but i dont do regex sorry, maybe someone else will make a regex version if they feel like it, but beings we are just makeing you one thing already, maybe u can take it opnon yourself to learn from it and learn regex to figure out how to do it the other way :P

Code:
NC.names {
  var %ctr = 0, %tot = $matchtok($1-,$chr(32),0,44), %names
  while (%ctr < %tot) {
    inc %ctr | var %names = %names $gettok($matchtok($1-,$chr(32),%ctr,44),1,32)
  }
  var %names = %names $gettok($1-,-1,44)
  return %names
}


what i noticed in your example is that all nicknames were parts of tokens containing a space if tokenized by chr 44 (,) so i used $matchtok to grab all tokens with spaces in them and echoed the first part of each token, then outside the loop i added the last nickname (as its the only one that doesnt fit this rule)

i tested it with your example and it worked, although if you go to test it do not just //echo $NC.names(*,*,...) set the string to a var first and then do $NC.names(%var) this is because the string contains ',' 's although for your script the infomration will already be in $1- or somethign of that sort so it will work anyways

hope this is helpful

Cobra^

Re: need a little help plz #1435 13/12/02 09:12 PM
Joined: Dec 2002
Posts: 208
C
Cobra Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
for future refrence .. when asking for help

dont show examples like that with such weird nicnames

from your first post i had no clue u were pulling out nicknames, as they must be in some other language .. them are some funky lookin chrs :P

instead just change them to nick1 nick2 nick3 .. and we will be able to understand what your trying to do beter smile, the *,*,* nick .. string u posted was a good way of explaning this problem smile

Cobra^

Re: need a little help plz #1436 13/12/02 10:07 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
yeah, sorry i didnt explain myself better b4, but i few things i forgot to mention, i already have one that works with a while loop, lol, and i do know a bit about $regex and $regsub but not enough to sort that with one call, if its possible which i think it MIGHT be, this is the while loop i made:

Code:
  
tokenize 32 %read
 var %a = 6, %b 
while (%a <= $0) {
        %b = %b $remove($gettok($gettok($1-,%a,32),4,44),:)
        inc %a
      } 
      dowrite ncpxc1mirc : $+ $1-5 : $+ %b 
      .halt
    }




where %read is set to the whole line i showed you above, and dowrite write to the specified socket...etc

But like i had said, sometimes it does take a while to send all the data as it has to loop over and over, and when joinning, that data is sent to many X number of times, as it only send 6 nicknames at a time, so if there are 100 ppl in room, i will be calling that loop MANY times, which WILL lag and possibly flood me out of the room.....see where i am heading with this...?

again sorry i forgot to mention that b4 smile

Re: need a little help plz #1437 13/12/02 10:20 PM
Joined: Dec 2002
Posts: 208
C
Cobra Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
i must have missed something here.

i asumed u were receiving this string from the server, and parseing it just for your own display, in which case the loop i made should be very fast at doing.

who or what are us ending the data to, and why, and howoften .. what trigers it .. more info :P

basicly u can skip all those questions if this universaly aplyable idea helps you, if you are re transmiting data to other users (i'm guessing that your makeing yourself a server or a gateway, or emulating a proxie or something .. hard to say

then simply keep a maintained list for yourself and simply edit the list as needed, that way your not re parseing the data each time u wish to transmit it, you save for yourself a copy of the parsed data .. and u edit that as required (joins/parts seen etc) .. then simply transmit your copy of the parsed data

in perhaps simplier terms

keep a hash table or ini file (or var, although i recomend u use hash) of the nicks in the channel, so u could use my identifer to creat an entry in a hash table of the nicks in that channel, then when u see a join, edit the hash table acordingly instead of re parseing everything, same for part, then wehn you need to transmit the data simply transmit your saved already parsed copy

well i tryed to put it in simpler terms .. thats not my strong point :P .. if you need it explained in greater detail ask and ill spell it all out line for line ..

hope this is helpful

if not .. more information as to what you need to do is required

Cobra^

Re: need a little help plz #1438 13/12/02 10:30 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
lol, heres more info:

what i have to do is "filter" the nicks like i am doing with the while loop i made, then i have to send them to the socket thats connected to the server, so when then channel window opens, i get the nicknames in the nicklist, JUST the nicknames, if i dont "filter" them, then my nicklist looks like:

H,U,GY,nickname

etc

so i am looking for a "faster" way then my while loop to "filter" and send the names back to the server, (thats what it is, the raw for /names) cause these while loops, when joining a room with alot of ppl, has ALOT of names to "filter" so i am trying to find a faster way to filter them then a loop...

understand what i mean now, or need more info :P

Re: need a little help plz #1439 13/12/02 10:39 PM
Joined: Dec 2002
Posts: 208
C
Cobra Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
maybe i'm just dumb but there are a few things that just dont make sence

first off .. why is the server sending u such a jacked up names raw,

second, why on earth would you need to send the names list back to the server??

Cobra^

Re: need a little help plz #1440 13/12/02 10:47 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
ok, i will try to explain a little better:

to connect to the server, i have to listen and open a few sockets and read them,

so i read from one server, which returns alot of info, some info being who is on the channel, and this server shows their location and other info with their name (H,U,GY = Some kinda info related to location and something else)
along with their name, so when i read that from one socket, i have to write it to the other socket that is JOINING the room, but like i said, i have to "filter" the data or my nicklist will be messed up, lol.....

so basically i am listening/reading from a socket, and writing that data to another socket, the one that is taking me into the room i want to join....

understand..?

Re: need a little help plz #1441 13/12/02 10:59 PM
Joined: Dec 2002
Posts: 208
C
Cobra Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
ok, if i understand you correctly then

it seems as though you have scripted a router type deal .. where the socket script makes the connection to the server, and your mirc connects to the socket, and the socket script parses the data sent from the server so that mirc can understand it. *sigh* .. basicly a smart proxie

clearly this is not a normal irc server else u wouldnt need to even parse the data, BUT regardless, you should only ever have to parse the names raw 1 time for each time you join the channel .. so i dont see where the HUGE problem is

your socket script connects tot he server, your mirc connects to the socket script, mirc issues a join command, the socket script relays the command to the server, the server responds back with the names list, the socket script parses it and sends it to mirc, .. the socket script should not have to re send this names list unless you rejoined the channel ..

if i'm way off here .. then there is a communication problem between us .. i'm either just not understanding you, or your just not understanding me .. in either event i'm sorry. perhaps someone else can figure out what your asking and shed some more light on the subject .. i'll keep checking back


Cobra^

Re: need a little help plz #1442 13/12/02 11:11 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
well no, you pretty much right with the sockets there, but it doesnt send the info 1 time per join

lets say that basically it is a RAW i am getting from the server...the raw will only send a MAXIMUM of SIX(6) names at a time, so if there is 36 ppl in the room, then i will get that raw SIX times when i join ONCE, and have to call the loop also SIX times, you see what i mean with that one, so if i join a room with 100 ppl in it, then i will get that raw like 18 times or watever, so then i call that loop 18 times also, and lets say that each time the loop goes through(each time i call the loop and complete the loop) it loops through itself atleast SIX times also, so if i call the loop 18 times, and for each time i call it it loops 6 times, then sends the result, thats looping like 108 times with a fair amount of data.....

do you better see what i mean now and how its working.....and WHY i am trying to find a faster way to get the info(result) i need, like a single call to $regex/sub,

so if i had a command like that, if the data was send 18 times, then it is processed 18 times, not 108 times. see...?

Re: need a little help plz #1443 13/12/02 11:24 PM
Joined: Dec 2002
Posts: 208
C
Cobra Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
i dont use regex and thereforei dont know it sorry

all i can help with is that which i know .. if someone else comes that knows it great .. but untill then all i can do is offer the best advice i can come up with.

that jacked up server might only send 6 nicks per line but mirc can read alot more than that, i sugest u maintain a hash table with the list of nicks in it, parse each one (with the loop)
after parseing the 3rd one, send all the nicks u have to mirc in 1 socket, then restart the list, and after 3 again send, and repeat untill the end raw is sent then just send whatever u heave left over

that will speed it up some ? .. not as much as u might like but its beter than nothing.

sorry i cant be more help, but i'd be suprized if regex was all that much faster.. it wont take mirc all to long to parse 6 nics out of a string .. and u will have to call the identifer the same number of times even if u used $regex .. although $regex may be faster than the loop .. i doubt that the difference will be that noticable personaly but its hard to say

Cobra^

Re: need a little help plz #1444 13/12/02 11:42 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
yes and no, if i use the while loop, it will be called 6 time for one call to the loop, EG:



call to while, var =:

nick1
nick1 nick2
nick1 nick2 nick3
nick1 nick2 nick3 nick4
nick1 nick2 nick3 nick4 nick5
nick1 nick2 nick3 nick4 nick5 nick6

send to server nick1 nick2 nick3 nick4 nick5 nick6


now the call to while there went throug ONCE, but had to process it 6 times, then send all the nicks to the server, now if i could make a $regex call that parse the whole line then it would like like:


var set to:

nick1 nick2 nick3 nick4 nick5 nick6

send to server nick1 nick2 nick3 nick4 nick5 nick6



see what i mean with that, it would be alot faster with one call to $regex/sub then doing a loop,

and as a commecn to your statement of adding to has table 3 time then send to server, it wouldnt really be faster, actually it would be slowed if anything,:


way it is now:

do while loop
send server



way it would be with hash table:

do while loop
add to hash
do while loop
add to hash
do while loop
add to hash

send to server

Re: need a little help plz #1445 13/12/02 11:52 PM
Joined: Dec 2002
Posts: 208
C
Cobra Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
i understand your point

but as i said, i dont know regex .. so therefore i cant help u with regex

and the number of visible processes doesnt always determin speed, you see by useing $regex .. all your doing is passing hte parseing to mirc .. it still has to loop though to evaluate the regular expresion and do other things, where as you can do it externaly

now obviously compiled code runs alot faster than scripted code .. as the scripted code itself also has to be parsed by mirc .. but u get the point

also, although it takes more steps, it is posible that sending fewer sockets would be faster .. u'd have to test it to know for sure. its not always the most commands that are the slowest but which commands .. some commands take longer than others .. so u gota kinda balance it out .. i could be way off on this .. but i'd try it anyways just to see :P

Cobra^

Re: need a little help plz #1446 13/12/02 11:58 PM
Joined: Dec 2002
Posts: 271
N
NightChillz Offline OP
Fjord artisan
OP Offline
Fjord artisan
N
Joined: Dec 2002
Posts: 271
Well, we will see if we can find someone on here that is fluent in $regex/sub that may be able to help, and if we can find something liek what i am looking for, then i will compare the two of them to see what works better, (someone like qwerty or nimue from old board if their still around, lol)

but i would like to that you for you time and trying to help me with this, and just discussing it, thanks smile

(btw, if you would like to maybe learn some $regex and stuff, there is a fairly good tutorial HERE you may like to take a look at smile )

Re: need a little help plz #1447 14/12/02 12:06 AM
Joined: Dec 2002
Posts: 208
C
Cobra Offline
Fjord artisan
Offline
Fjord artisan
C
Joined: Dec 2002
Posts: 208
yeah, i know Trystan personaly lol

but i've far to many other things on my todo list that are more pressing.


Cobra^