mIRC Homepage
Posted By: sopia msg $chan not working - 15/08/04 08:26 AM
on *:text:!ping:#:{ ctcp $nick ping }
on *:ctcpreply:*ping*:{
if ($2 == $null) { halt }
var %pt = $ctime - $2
if (%pt < 0) { %pt = 0 }
msg $chan $nick 4Your Ping reply is: [12 $+ $duration(%pt) $+ 4] I'm your ping servant.
}
The msg $chan doesn't work.( I want the msg to shoot in the channel where the user type in the word !ping) What could be wrong?
Help please.
Posted By: whatsthedillio Re: msg $chan not working - 15/08/04 09:09 AM
The ctcp reply is not in the channel so you cant use $chan
use #channelname
and you should put some extra brackets in
_____________________________________________________
on *:text:!pingme:#:{ ctcp $nick ping } }
on *:ctcpreply:*ping*:{
if ($2 == $null) { halt }
var %pt = $ctime - $2
if (%pt < 0) { %pt = 0 }
.msg
#channel $nick 4Your Ping reply is: [12 $+ $duration(%pt) $+ 4] I'm your ping servant.
}

}
__________________________________________________
____
parts in red are the changes
Posted By: sopia Re: msg $chan not working - 15/08/04 10:10 AM
The ctcp reply is not in the channel so you cant use $chan
use #channelname <-- this is my problem, If i'm in another channel then the user who type in the word !ping, the reply would not shoot in that other channel , instead it will shoot in the #channelname. Is there a way around to do this? I dont want to add many #channelname , just one $chan will do. Is it possible.
Posted By: Coolkill Re: msg $chan not working - 15/08/04 10:36 AM
You would need to set a variable with the persons channel.


on *:text:!ping:#:{ ctcp $nick ping | hadd -m pings $nick $chan }

Then,

on *:ctcpreply:*ping*:{
if (($2) && ($hget(pings,$nick))) {
var %pt = $ctime - $2
if (%pt < 0) { %pt = 0 }
msg $hget(pings,$nick) $nick 4Your Ping reply is: [12 $+ $duration(%pt) $+ 4] I'm your ping servant.
.hdel pings $nick
}
}

Try something like that.

Eamonn.
Posted By: whatsthedillio Re: msg $chan not working - 15/08/04 10:39 AM
code:
_____________________________________________________________
[color:blue:]on *:text:!ping:#:{ set[/color] %channel $chan | .ctcp $nick ping } }
on *:ctcpreply:*ping*:{
if ($2 == $null) {
unset %channel | halt }
var %pt = $ctime - $2
if (%pt < 0) { %pt = 0 }
.msg
%channel $nick 4Your Ping reply is: [12 $+ $duration(%pt) $+ 4] I'm your ping servant.
}
}

____________________________________________________________
Hope That Works Ok
laugh
oops
some1 beat me to it lol
use his it prolly works better
Posted By: Coolkill Re: msg $chan not working - 15/08/04 10:48 AM
Yours would work to a degree, if only one person at a time used the script, if person1 typed !ping in #chan1, and person2 typed it in #chan2 at the same time, both replies would goto #chan2.


Eamonn.
Posted By: sopia Re: msg $chan not working - 15/08/04 11:28 AM
hehe you guys, it doesn't matter whose work better, the point is that you guys are willing to help. Thank you both for the help...
© mIRC Discussion Forums