| View previous topic :: View next topic |
| Author |
Message |
gembels Voice
Joined: 07 Jul 2012 Posts: 26
|
Posted: Wed Jul 31, 2013 8:07 pm Post subject: Ignore nick when .. |
|
|
Hi,
I am using this snippet
| Code: | proc throttled {id time} {
global throttled
if {[info exists throttled($id)]} {
return 1
} {
set throttled($id) [clock sec]
utimer $time [list unset throttled($id)]
return 0
}
} |
Example
| Code: | if {[throttled $nick 30]} {
tggamemsgd3 $nick "$nick, please try again in 30 seconds"
} else {
tggamemsgd2 $chan "$text: test success"
} |
I forgot where the source come from, anyway, there is any way to optimize this code, because this what happen:
[09:55] <Grievers> 111
[09:55] <Grievers> 222
[09:55] <%bots> 222: test success
the first text, always be ignored by bot, only the second one bot will be start counting. I have no idea why that happen. After "222" it start counting 30s , but why not on "111" ? why the bot didn't reply on 111 ?
If new nick type something, the first text also have problem.
or there is anyway to stop ppl doing flood !rank on game ? without kick or banned them.
Thanks in advance |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
|
| Back to top |
|
 |
gembels Voice
Joined: 07 Jul 2012 Posts: 26
|
Posted: Thu Aug 01, 2013 12:07 am Post subject: Re: Ignore nick when .. |
|
|
| you are right, its from there .. there is no solution ? they don't have this problem |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Thu Aug 01, 2013 2:43 am Post subject: |
|
|
The snippet is indeed from one of user's posts, and from what I can see it's correct. The only thing that pop-out is the fact that to send that message you use two different messaging processes (tggamemsgd2 and tggamemsgd3) and have two different destinations: first is sent to nick and the second is sent to the channel.
Why don't you replace them with a simple puthelp like:
| Code: |
if {[throttled $nick 30]} {
puthelp "PRIVMSG $chan :$nick, please try again in 30 seconds"
} else {
puthelp "PRIVMSG $chan :$text: test success"
}
|
and see what happens. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
gembels Voice
Joined: 07 Jul 2012 Posts: 26
|
Posted: Thu Aug 01, 2013 5:35 am Post subject: |
|
|
even without any puthelp or anything, same problem occur..
| Code: |
proc tggamemsgd2 {tgchan what} {
putserv "PRIVMSG $tgchan :$what"
}
proc tggamemsgd3 {nick what} {
putserv "PRIVMSG $nick :$what"
} |
actually in the real code I didn't put any puthelp or putserv just for triggering something .. anyway I try you code, same problem occur... |
|
| Back to top |
|
 |
|