on *:SockRead:Game*: {
set -u0 %Bytes 800
sockread %Bytes &newdata
if ($SockName == GameStats) {
bwrite $+( $SockName, .html) -1 -1 &newdata
if ( $gettok( $bvar(&newdata, 1, %Bytes).text, 1, 13) == HTTP/1.1 302 Found ) {
$iif( %GameMsgInfo == on, msg %GameSetChan, echo -s) You need to make the login $+ $chr(44) Automatic redirect to do it.
Sockclose Game*
SockOpen GameGetCookie xxxxxxx.xxx.xx 80
}
else {
window @Status 1 1 1135 200
window @OutputData 1 201 1135 200
; This if is the add the incomplete code missing that can“t be correct read btween the Sockread
if ($hget(DataIncomplecta, Estatisticas)) {
bset &data 1 $hget(DataIncomplecta, Estatisticas)
bcopy &data $bvar(&data, 0) &newdata 1 -1
hfree DataIncomplecta
}
else {
bcopy &data 1 &newdata 1 -1
}
var %open = 1
; While the beginning text "<td" is found
while ($bfind(&data, %open, <td)) {
%open = $v1
; If the final text "</td>" is found, then the output sentence is complete
if ($bfind(&data, %open, </td>)) {
var %close = $v1
var %len = $calc( %close + 5 - %open)
;This is where the output text is showed including all the html code, beguining in the "<td" search until the final "</td>"
var %celldata = $remove( $bvar( &data, %open, %len).text, $chr(9), $chr(10), $chr(13))
aline -p @Status 12 %TimeCount 3Complet %celldata 4<td in 12 %open and 4</td> in12 %close
aline -p @OutputData 12 %TimeCount %celldata
TextoSaida %celldata
inc %TimeCount
}
; If the final text "</td>" is NOT found, them the output sentence is NOT complete
else {
; Once the final text was not found, it will be necessary keep the rest of the sentence somewhere, in this case in hash tables
; It will keep all text from the beginning "<td" search until the end of sockread data
bcopy &incomplete 1 &data %open -1
hmake DataIncomplecta 10
noop $hget(DataIncomplecta, Estatisticas, &incomplete)
aline -p @Status 12 %TimeCount 4Incomplete $bvar( &incomplete, %open -).text 4<td in 12 %open
}
inc %open
}
}
}
}