This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Ignore nick when ..

Help for those learning Tcl or writing their own scripts.
Post Reply
g
gembels
Voice
Posts: 26
Joined: Sat Jul 07, 2012 9:31 pm

Ignore nick when ..

Post by gembels »

Hi,

I am using this snippet

Code: Select all

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: Select all

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
g
gembels
Voice
Posts: 26
Joined: Sat Jul 07, 2012 9:31 pm

Re: Ignore nick when ..

Post by gembels »

you are right, its from there .. there is no solution ? they don't have this problem
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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: Select all

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.
g
gembels
Voice
Posts: 26
Joined: Sat Jul 07, 2012 9:31 pm

Post by gembels »

even without any puthelp or anything, same problem occur..

Code: Select all

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...
Post Reply