|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
I dont know how to insert ignore in this, someone have an idea? "CTCP is ignored in my script", i couldent get $ulevel to work, nether could i add a user in a %var with: %no. [ $+ [ $v.nick ] ] 1, then i tryed to inc that variable, and after the user got 3 he/she should be ignored.
alias v.chan return $iif(%vchanger.target ischan,%vchanger.target)
alias v.target return %vchanger.target
alias v.nick return %vchanger.nick
alias v.fulladdress return $remove(%vchanger.fulladdress,%vchanger.nick)
alias v.cid return %vchanger.cid
alias -l v.void
on *:SIGNAL:nctcp: {
if ($timer(.CTCP)) return
else if (VERSION == $1) {
.ctcpreply $v.nick VERSION $eval(%vreply,2)
echo -a Recieved a $lower($1) from $vc.nick from adress: * $+ $v.fulladdress on $network
return
}
else if (TIME == $1) {
echo -a Recieved a $lower($1) from $v.nick from adress: * $+ $v.fulladdress on $network
.ctcpreply $v.nick TIME $eval(%tireply,2)
return
}
else {
.notice $vc.nick $1 is unknown to me.
.timer.CTCP 1 5 vc.void
}
}
No one that have a idea?
Last edited by sparta; 07/06/07 08:36 PM.
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Dec 2002
Posts: 503
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 503 |
How/Where are you triggering this signal? Show that code too.
|
|
|
|
Joined: Feb 2003
Posts: 3,432
Hoopy frood
|
OP
Hoopy frood
Joined: Feb 2003
Posts: 3,432 |
alias vchanger.s {
if (!$hget(vchanger.s)) { hmake vchanger.s 10 | .timer 1 0 vchanger.s myown 1 }
if ($isfile($+(",$scriptdirvchanger.dat,"))) && ($hget(vchanger.s,myown) == $null) {
hload -bo vchanger.s $+(",$scriptdirvchanger.dat,")
}
if (!$1) return 1
if ($isid) return $hget(vchanger.s,$$1)
else {
if ($1 == -s) hsave -bo vchanger.s $+(",$scriptdirvchanger.dat,")
else { hadd vchanger.s $$1 $2- }
}
}
alias vchanger {
if ($1) {
.timer..vchanger -iom 0 300 vchanger.checkctcps
}
else {
.timer..vchanger off
var %cid = 1, %cid.cnt = 0
if (!$scid(0)) return
while (%cid.cnt < $scid(0)) {
if ($scid(%cid)) { inc %cid.cnt
scid %cid
.debug off
.ignore -rtw *!*@*
window -c $+(@verch.,%cid)
}
inc %cid
}
}
}
alias vchanger.ignore {
if ($ignore(*!*@*)) { .ignore -rtw *!*@* | .timer 1 0 scid $cid .ignore -tw *!*@* | return $ignore($1-).type }
else { return $ignore($1-).type }
}
alias vchanger.checkctcps {
var %cid = 1, %cid.cnt = 0, %tmpwin, %i, %line, %ctcp, %addr, %verch
if (!$scid(0)) return
%cid.cnt = $scon(0)
.ignore -tw *
while (%cid.cnt) {
%cid = $scon(%cid.cnt)
dec %cid.cnt
if ($scid(%cid)) {
if (!$window($+(@verch.,%cid))) {
window -h $+(@verch.,%cid)
scid %cid .debug $+(@verch.,%cid)
}
%verch = @verch. $+ %cid
%i = 1
while ($line(%verch,%i)) {
tokenize 32 $ifmatch
if ($1 == <-) && ($3 == PRIVMSG) && (** iswm $left($5,2)) && ( == $right($gettok($1-,-1,32),1)) {
%ctcp = $remove($5-,)
%addr = $remove($2,:)
if (*ctcp* !iswm $vchanger.ignore(%addr)) && (*ACTION !iswm $gettok(%ctcp,1,32)) {
set -u0 %vchanger.cid %cid
set -u0 %vchanger.fulladdress $mid($2,2)
set -u0 %vchanger.nick $gettok(%vchanger.fulladdress,1,$asc(!))
set -u0 %vchanger.target $4
scid %cid
.signal -n newctcp $mid(%ctcp,2)
}
}
inc %i
}
dline %verch 1-
}
elseif ($window($+(@verch.,%cid))) { window -c $+(@verch.,%cid) }
}
}
Then its a on start event, not much to show here.
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }
|
|
|
|
Joined: Dec 2002
Posts: 503
Fjord artisan
|
Fjord artisan
Joined: Dec 2002
Posts: 503 |
I had this whole thing typed out about.. well, no matter.. It wasn't right. Assuming a few renames happened which caused the non-matching signals and aliases (signal 'newctcp' and the 'on *:SIGNAL:nctcp:', '$vc.nick' and 'alias v.nick', '.timer.CTCP 1 5 vc.void' and 'alias -l v.void'), I can't actually see anything majorly wrong with this code. (by the way, you'll want to change the v.fulladdress alias to 'return $gettok(%vchanger.fulladdress, 2, 33)'). It's doing a 5-second ignore on unknown CTCP's, but I take it you want to throw an ignore on 3 CTCP's in general.. It's pretty simple. You just need to: on *:SIGNAL:nctcp: { if ($($+(%, no., $v.nick), 2) > 2) { return } inc $+(%, no., $v.nick) .timer 1 10 unset $+(%, no., $v.nick) ...
It's not the neatest way, but it works just fine. (yes, un-named timer as you may have multiple nick's).
|
|
|
|
|