mIRC Homepage
Posted By: Khonor Help with !uptime command. - 06/06/15 08:06 PM
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.
}
Posted By: splinny Re: Help with !uptime command. - 06/06/15 08:17 PM
Shows correct uptime for me.
Posted By: splinny Re: Help with !uptime command. - 06/06/15 08:26 PM
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).
Posted By: westor Re: Help with !uptime command. - 06/06/15 08:47 PM
Or you can use /sockmark command and $sock(SOCKNAME).mark after /sockopen command.

/help /sockmark
Posted By: Khonor Re: Help with !uptime command. - 06/06/15 09:02 PM
Thanks I'll see how to do to fix it.
Posted By: Khonor Re: Help with !uptime command. - 07/06/15 05:07 PM
You could help me fix it splinny? Because I did not find the way back.
Posted By: splinny Re: Help with !uptime command. - 07/06/15 05:33 PM
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.
Posted By: Khonor Re: Help with !uptime command. - 07/06/15 06:22 PM
If to work on many channels.
© mIRC Discussion Forums