socket problem

By cessil on Jan 25, 2009

it will only post the map type or Players not both. I tried this on mirc 6.16 and 6.35

on *:text:*cb1*:#: {
  if $1 == !cb1 {
set %searchply $2
sockopen cb1 www.game-monitor.mobi 80
set %cbchan $chan
}
}
on *:sockopen:cb1: { 
  sockwrite -n $sockname GET /GameServer/39272051/ HTTP/1.1
  sockwrite -n $sockname Host: www.game-monitor.mobi
  sockwrite -n $sockname Connection: Keep-Alive
  sockwrite -n $sockname $crlf
}
on *:sockread:cb1: {
  sockread %temp
  if (Players: isin %temp) { set %Players $nohtml(%temp) }
  if (Map: isin %temp) { set %map $nohtml(%temp) | msg %cbchan %Players %map | $clrst | sockclose cb1 }
}
alias nohtml { var %x,%y = $regsub($1-,/(<[^>]+>)/g,$null,%x) | var %x = $replace(%x,&nbsp;,$chr(32),&#176;,$chr(176),&deg;,$chr(176)) | return %x }
alias clrst { 
unset %cbchan
unset %temp
unset %players
unset %map
unset %searchply
}

Comments

Sign in to comment.
cessil   -  Jan 26, 2009

all fixed I had another script interfering. thanks napa182

 Respond  
napa182   -  Jan 26, 2009

[10:04:pm] <~napa182> !cb1
[10:04:pm] <&Sick0> Players:69/125 Map:Las Venturas (8)

seems to show both for me

 Respond  
cessil   -  Jan 26, 2009

@kirby, It wouldn't post it would go to a blank page but didn't post. sorry
@napa that doesn't work it just shows the map, did you also test it?

 Respond  
napa182   -  Jan 25, 2009

next time use the forum to get help.
no real point in the set %searchply $2 part cuz you only have it looking up CrazyBob's Cops And Robbers

on $*:text:/^!cb1$/iS:#: {
  if ($sock(cb1)) sockclose cb1
  sockopen cb1 www.game-monitor.mobi 80
  sockmark cb1 #
}
on *:sockopen:cb1: {
  sockwrite -nt $sockname GET /GameServer/39272051/ HTTP/1.1
  sockwrite -nt $sockname Host: $+(www.game-monitor.mobi,$str($crlf,2))
}
on *:sockread:cb1: {
  var %cb1 | sockread %cb1
  if ($regex(%cb1,/<b>(Players:)<\/b><br\/>(.+)<br\/>/)) { sockmark cb1 $sock(cb1).mark $+($regml(1),$regml(2)) }
  if ($regex(%cb1,/<b>(Map:)<\/b><br\/><a href=".+">(.+)<\/a><br\/>/)) { msg $sock(cb1).mark $+($regml(1),$regml(2)) | sockclose cb1 }
}
 Respond  
Kirby   -  Jan 25, 2009

Your snippet will be deleted if you break any of the following rules:

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.