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.

TCL Code help...

Old posts that have not been replied to for several years.
Locked
o
oldmagic

TCL Code help...

Post by oldmagic »

Hello ppls, i need some help with a tcl script...

this is an example:

bind msg * "!test" test

proc test { nick host handle args } {
global botnick
set number <first text>
set text <secound text>
}

this means...like:
/msg BOTNICK !test 0456 hello

i think you see how i want it...

Hope you can help me out!
M
Moo_Moo

TCL code help

Post by Moo_Moo »

Here's what you asked for. This script will run everytime someone sends your bot a message with !test as it's first word. Remember that if whatever follows the number is made up of multiple words, the second method presented is useless.

Code: Select all

bind msg - !test test

proc test {nick uhost hand chan text} {

   # Now we've got to extract the first word from the
   # text variable and put it into our number variable.

   # This is the most commonly used approach:
   set text [split $text]
   set number [lindex $text 0]
   set text [lrange $text 1 end]

   # However, if the text following the number does 
   # not contain further words, an alternative one-liner
   # would be as following:
   foreach {number text} [split $text] { break }
}
Example usage would be:
/msg botname !test 42 white
o
oldmagic

flood...

Post by oldmagic »

Hello agine. Thanx for helping last time i asked for help..

this time i need a "anti flood system"

So users only can use that command 5times/day

If someone can help me out! pls post a message.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Try looking at the flood-msg settings in the bots .conf file. :mrgreen:
Set that to 5 times in less than bla bla seconds you want ;)

And take a look at this thread as well:
http://forum.egghelp.org/viewtopic.php?t=7750
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
o
oldmagic

Post by oldmagic »

hehe okey :)

But can i set that timer to 24hrs?
So the bot 'ignores' the users for 24hrs?
When thay have type the command 5times?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

Yes you can set the ignore for 24hrs. See the 'newignore' command in tcl-commands.doc and change the ignore time as you wish. :roll:

As, 1hr = 60 mins
24hrs = 24x60mins = 1440mins

Then you will need to set 1440 to make it 24hrs.
As for the 5 times yes you can set that too.

See the 'flood-msg' variable in the .conf file.
The format of this is:
NUMBER_OF_LINES:SECONDS

Example: '5:3'
Meaning if, 5 lines of text are sent by a single host to the bot in less than 3 seconds then the bot will ignore that user for the defined amount of time set. :wink:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
o
oldmagic

Post by oldmagic »

hehe, hello agine & agine :]

do you think this script i'v made will help me out?

------------------------------------------------------------

set count 5
set seconds 82800
set channel #test

bind msg * "!test" floodprot

proc floodprot { nick uhost hand } {
global botnick livesaver channel seconds count
if {$nick == $botnick} {return 0}
if {[isop $nick $channel]} {return 0}
lappend livesaver($uhost:$nick) 1
utimer $seconds "expire livesaver($uhost:$nick)"
if {[llength $livesaver($uhost:$nick)] >= $count} {
putserv "PRIVMSG $nick :You have used the command 5times this day"
}
}


--------------------------------------------------------
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

You have to give it a test to see that out.

Personally I think the eggdrops internal settings are more better and faster than tcl scripts as they are coded in C, which makes them more effective! :mrgreen:
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
K
KevKev
Halfop
Posts: 67
Joined: Fri Oct 03, 2003 5:15 am

Post by KevKev »

awyeah wrote:You have to give it a test to see that out.

Personally I think the eggdrops internal settings are more better and faster than tcl scripts as they are coded in C, which makes them more effective! :mrgreen:
problem is if you completely ignore the user for 24 hours he can't trigger other binds :P

I think the requestor wanted to allow a user to use a command only 5 times every 24 hours, not completely ignore the user after the user issues any msg to the bot 5 times
Locked