mIRC Home    About    Download    Register    News    Help

Print Thread
#253272 06/06/15 08:06 PM
K
Khonor
Khonor
K
I have this script and I was wondering if someone could help me, because from one moment to the other I leave to function the command and not know why.

Any help is appreciated!

Regards,
-Khonor



on *:TEXT:!uptime:#:{
set -u10 %target $iif($2,$2,$mid(#,2-))
set -u10 %channel #
uptime
}

alias uptime {
sockclose uptime
sockopen uptime nightdev.com 80
}

on *:sockopen:uptime:{
if ($sockerr) { sockclose $sockname | halt }
sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ %target HTTP/1.1
sockwrite -n $sockname Host: www.nightdev.com
sockwrite -n $sockname $crlf
}

on *:sockread:uptime:{
if ($sockerr) { sockclose $sockname }
var %data
sockread %data
tokenize 32 %data
if ($1 isnum) && ($2) { msg %channel %target has been streaming for $1- $+ . Since $date(dd) $date(mmm) $date(yyyy) at $asctime(hh:nn:ss) $+ . }
elseif (%data == The channel is not live.) msg %channel %target is currently not online.
}

Joined: May 2015
Posts: 245
S
Fjord artisan
Offline
Fjord artisan
S
Joined: May 2015
Posts: 245
Shows correct uptime for me.

Joined: May 2015
Posts: 245
S
Fjord artisan
Offline
Fjord artisan
S
Joined: May 2015
Posts: 245
But your way of saving data (#channel and stream_channel) is not reliable. If two users type !uptime for different channels at the same time it will probably return uptime for one of two channels twice. To avoid this you need not to save it at temp_variables (with -u10) but send it to uptime alias as parameters like "uptime $chan $iif($2,$2,$mid($chan,2))" and in /uptime-alias use "/sockmark uptime $1-" to send it again to on-sockopen event so you can use "tokenize 32 $sock($sockname).mark" to use those params no-matter-how-much-times simultaneously (after tokenize it will be $1 for $channel and $2 for stream).

Joined: Dec 2008
Posts: 1,483
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,483
Or you can use /sockmark command and $sock(SOCKNAME).mark after /sockopen command.

/help /sockmark

K
Khonor
Khonor
K
Thanks I'll see how to do to fix it.

K
Khonor
Khonor
K
You could help me fix it splinny? Because I did not find the way back.

Joined: May 2015
Posts: 245
S
Fjord artisan
Offline
Fjord artisan
S
Joined: May 2015
Posts: 245
It was working as i said, but why do you need it for many channels? Do it just for one which bot is assigned to.

K
Khonor
Khonor
K
If to work on many channels.


Link Copied to Clipboard