mIRC Home    About    Download    Register    News    Help

Print Thread
#141888 13/02/06 08:22 PM
Joined: Jun 2005
Posts: 127
H
HAMM3R Offline OP
Vogon poet
OP Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
Hey. Im working with sockets and trying to get 2 pieces of text from a site. One is distinguishable in the html, so i can use if(*blah* iswm %blah). But the other isnt, however it will always be 3 lines down from the first item. Sow how can i get the 1st item, then get the text 3 lines down from it?


-- HAMM3R (aka: alhammer)
http://www.HAMM3R.net
#141889 13/02/06 08:52 PM
Joined: May 2005
Posts: 449
Fjord artisan
Offline
Fjord artisan
Joined: May 2005
Posts: 449
$readn + 3? That would work if you were using $read. Now that I think about it more, you probably don't have this in a text file. That's one possibility though.

#141890 14/02/06 01:00 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
The only thing I can think of (and I know this probably isn't the greatest), is to read the site storing into a text file, then use $read to find your "fixed" data, and $calc($readn + 3) to find your second piece.

#141891 14/02/06 01:55 AM
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
What do you mean by 'it's 3 lines down'? Do you mean that one sockread will return the recognizable text, and then 3 sockreads later the desired text will be sent? If that's the case, then you just need to use a simple variable counter.

Code:
on *:SOCKREAD:sockname:{
  var %s
  sockread %s
  tokenize 32 %s

  if (*recognized line* iswm $1-) set %counter 1
  elseif (%counter == 3) {
    ;do something with $1-
    unset %counter
  }
  elseif (%counter > 0) inc %counter
}

(untested)

If this doesn't work with your situation, then you need to provide more information (an example).

-genius_at_work


Link Copied to Clipboard