mIRC Home    About    Download    Register    News    Help

Print Thread
#253272 06/06/15 08:06 PM
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
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: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Shows correct uptime for me.


Dont give a fish - teach to fish!
Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
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).


Dont give a fish - teach to fish!
Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
Or you can use /sockmark command and $sock(SOCKNAME).mark after /sockopen command.

/help /sockmark


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
Thanks I'll see how to do to fix it.

Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
You could help me fix it splinny? Because I did not find the way back.

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
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.


Dont give a fish - teach to fish!
Joined: Jun 2014
Posts: 77
K
Khonor Offline OP
Babel fish
OP Offline
Babel fish
K
Joined: Jun 2014
Posts: 77
If to work on many channels.


Link Copied to Clipboard