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.

!female gets an auto +v

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
a
avatar132
Voice
Posts: 21
Joined: Sat Dec 17, 2005 12:20 am

!female gets an auto +v

Post by avatar132 »

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

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"
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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

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

 tag when posting logs, code
a
avatar132
Voice
Posts: 21
Joined: Sat Dec 17, 2005 12:20 am

i think im doing something wrong

Post by avatar132 »

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

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

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]
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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

 tag when posting logs, code
a
avatar132
Voice
Posts: 21
Joined: Sat Dec 17, 2005 12:20 am

got it working

Post by avatar132 »

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 :)
a
avatar132
Voice
Posts: 21
Joined: Sat Dec 17, 2005 12:20 am

new format

Post by avatar132 »

tried this, but it didnt seem work, im had a couple people test it:

Code: Select all

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"
a
avatar132
Voice
Posts: 21
Joined: Sat Dec 17, 2005 12:20 am

Post by avatar132 »

Code: Select all

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

-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
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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

 tag when posting logs, code
a
avatar132
Voice
Posts: 21
Joined: Sat Dec 17, 2005 12:20 am

Post by avatar132 »

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?
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

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

 tag when posting logs, code
Post Reply