egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

!female gets an auto +v

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
avatar132
Voice


Joined: 17 Dec 2005
Posts: 21

PostPosted: Mon Dec 26, 2005 1:17 am    Post subject: !female gets an auto +v Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Dec 26, 2005 5:07 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
avatar132
Voice


Joined: 17 Dec 2005
Posts: 21

PostPosted: Mon Dec 26, 2005 11:51 am    Post subject: i think im doing something wrong Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Dec 26, 2005 1:21 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
avatar132
Voice


Joined: 17 Dec 2005
Posts: 21

PostPosted: Mon Dec 26, 2005 2:40 pm    Post subject: got it working Reply with quote

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 Smile
Back to top
View user's profile Send private message
avatar132
Voice


Joined: 17 Dec 2005
Posts: 21

PostPosted: Mon Dec 26, 2005 3:22 pm    Post subject: new format Reply with quote

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
View user's profile Send private message
avatar132
Voice


Joined: 17 Dec 2005
Posts: 21

PostPosted: Mon Dec 26, 2005 3:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Dec 26, 2005 4:10 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
avatar132
Voice


Joined: 17 Dec 2005
Posts: 21

PostPosted: Mon Dec 26, 2005 4:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
demond
Revered One


Joined: 12 Jun 2004
Posts: 3073
Location: San Francisco, CA

PostPosted: Mon Dec 26, 2005 8:08 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber