| View previous topic :: View next topic |
| Author |
Message |
avatar132 Voice
Joined: 17 Dec 2005 Posts: 21
|
Posted: Mon Dec 26, 2005 1:17 am Post subject: !female gets an auto +v |
|
|
Hi, i currently run a channel that gets 26-48 users on a daily bases, I've wrote up an simple tcl script (im a beginner in tcl, but learnning), to auto voice anyone that types !female using undernets X bot, my question is: is it possable for a script to be written to have it auto-voice someone after 3 times of typing !female ? included will be the short code i wrote..thanks!
| Code: |
bind pub - !female pub2
proc pub2 {nick uhost hand chan text} {
if {[isop $nick $chan]==0 && [isvoice $nick $chan]==0} {
putserv "PRIVMSG X :voice $chan $nick" }
}
putlog "Loaded femalevoice.tcl"
|
|
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Mon Dec 26, 2005 5:07 am Post subject: |
|
|
yes
hint: learn about Tcl arrays and use an array to store the count of issued public commands; your array would be indexed by nick; so when someone types that command, you check the array against his/her nick:
| Code: |
if ![info exists ::count($nick)] {
set ::count($nick) 1 ;# initialize
} elseif {$::count($nick) < 3} {
incr ::count($nick) ;# increment
} else {
unset ::count($nick) ;# reset
# ...and finally, voice $nick
}
|
_________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
avatar132 Voice
Joined: 17 Dec 2005 Posts: 21
|
Posted: Mon Dec 26, 2005 11:51 am Post subject: i think im doing something wrong |
|
|
thank you for the code!
however i tried to insert your code into the tcl, and i am coming up with an error msg
| Code: |
[09:44] wrong # args: should be "proc name args body"
while executing
"proc pub2 {nick uhost hand chan text} "
(file "scripts/femalevoice.tcl" line 2)
invoked from within
"source scripts/femalevoice.tcl"
|
i am just a beginner, and i am unsure what that msg needs me to do, since it did work before i inserted the code, thanks again
| Code: |
bind pub - !female pub2
proc pub2 {nick uhost hand chan text}
if ![info exists ::count($nick)] {
set ::count($nick) 1 ;# initialize
} elseif {$::count($nick) < 3} {
incr ::count($nick) ;# increment
} else {
unset ::count($nick) ;# reset
if {[isop $nick $chan]==0 && [isvoice $nick $chan]==0} {
putserv "PRIVMSG X :voice $chan $nick" }
}
putlog "Loaded femalevoice.tcl"
| [/code] |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Mon Dec 26, 2005 1:21 pm Post subject: |
|
|
you missed proc's opening brace, after the argument list _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
avatar132 Voice
Joined: 17 Dec 2005 Posts: 21
|
Posted: Mon Dec 26, 2005 2:40 pm Post subject: got it working |
|
|
thanks, that fixed it, i ran it and tested it but i think the perpuse of the script i must of not been clear on, if that is the case i am sorry....
i wanted it to +v on !female, but after 3 times someone has typed it it adds it automaticly to maybe a list so it automatly voices when the user comes back into the room, they dont have to type !female ever again after 3 times(for regulars)
i'll try to mess with it some more, but i was curious to find out what you might of come up with, i've read alot of posts in here. and some of the scripting is amazing  |
|
| Back to top |
|
 |
avatar132 Voice
Joined: 17 Dec 2005 Posts: 21
|
Posted: Mon Dec 26, 2005 3:22 pm Post subject: new format |
|
|
tried this, but it didnt seem work, im had a couple people test it:
| Code: |
bind pub - !female pub2
proc pub2 {nick uhost hand chan text} {
if {[isop $nick $chan]==0 && [isvoice $nick $chan]==0} {
putserv "PRIVMSG X :voice $chan $nick" }
if ![info exists ::count($nick)] {
set ::count($nick) 1 ;# initialize
} elseif {$::count($nick) < 3} {
incr ::count($nick) ;# increment
} else {
unset ::count($nick) ;# reset
if {[isop $nick $chan]==0 } {
putserv "PRIVMSG X :adduser $chan $nick 1"
putserv "PRIVMSG X :modinfo $chan automode $nick voice" }
} }
putlog "Loaded femalevoice.tcl" |
|
|
| Back to top |
|
 |
avatar132 Voice
Joined: 17 Dec 2005 Posts: 21
|
Posted: Mon Dec 26, 2005 3:41 pm Post subject: |
|
|
| Code: | [2:33pm] <CrystalX> [13:33] <<WyldZ>> !wyldz! !female
[2:33pm] <CrystalX> [13:33] <<WyldZ>> !wyldz! !female
[2:33pm] <CrystalX> [13:33] <<WyldZ>> !wyldz! !female
|
| Code: | -X (cservice@undernet.org)- I don't know who WyldZ is.
-X (cservice@undernet.org)- I don't know who WyldZ is. |
that doesnt seem to work, i think what might have to happen is to keep track of a userfile or something.. cause i forgot x doesnt autovoice by nick it autovoices by registered usernames
but the code does work |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Mon Dec 26, 2005 4:10 pm Post subject: |
|
|
well, in such case you should read about [adduser] and [chattr] commands and use them
and of course, be aware that there is that +v userflag thing _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
avatar132 Voice
Joined: 17 Dec 2005 Posts: 21
|
Posted: Mon Dec 26, 2005 4:19 pm Post subject: |
|
|
| i know about those settings, *adduser and chattr* but i didnt want to add the users to the bot, i was thinking of after three times it adds to a txt file, then everytime that user enters it will read the txt and auto +v, or do u tink adduser would be the best way to go? |
|
| Back to top |
|
 |
demond Revered One

Joined: 12 Jun 2004 Posts: 3073 Location: San Francisco, CA
|
Posted: Mon Dec 26, 2005 8:08 pm Post subject: |
|
|
eggdrop's userfile is meant to serve the purpose of storing & managing user records
of course, you are free to implement your own user management system, in a text file, database or maybe your cell phone - whatever suits you best _________________ connection, sharing, dcc problems? click <here>
before asking for scripting help, read <this>
use [code] tag when posting logs, code |
|
| Back to top |
|
 |
|