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.

Simple TCL Script

Old posts that have not been replied to for several years.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Is $user not $nick. Pay attention, don't sleep in class. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
ReaLz
Op
Posts: 121
Joined: Sat Oct 19, 2002 5:33 am
Location: Athens, Greece

Post by ReaLz »

and add the

Code: Select all

return 0
after the

Code: Select all

putlog "I'm not oped in $::channel." 
as caesar said, if you haven't already done that.
«A fantastic spaghetti is a spaghetti that does not exist»
k
kevie
Voice
Posts: 12
Joined: Tue Jun 10, 2003 3:45 am

Post by kevie »

Hmm, I seem to be having lotsa probs now with this code, so maybe i would list out the code here to see where the prob lies, currently it seems, it doesnt voice certain users, and it devoices some users after like a few minutes say 10 minutes? And it seems like i cant get the message that says "you've been devoiced for not serving." to work too. would really appreciate to get it work again :wink: (PS. I'm sorry for being so slow, really just a newbie)

Code: Select all

## Settings 
set line "*Fserve Active*" 
set phrase "*Fserve Active*" 
set channel "#E-Hub" 

## Binds 
bind pubm - "*$line*" voiceUser 
bind time - "00 * * * *" time_proc 
bind time - "30 * * * *" time_proc 
bind pubm - "*$phrase" saveUser 

## Code 
proc voiceUser {nick uhost hand channel rest} { 
putserv "MODE $channel +v :$nick" 
return 
} 

proc time_proc {min hour day month year} {check_word} 

proc check_word {} { 
if {![botisop $::channel]} { 
putlog "I'm not oped in $::channel." 
return 0
} 
foreach user [chanlist $::channel] { 
if {[isvoice $user $::channel]} { 
set hand [nick2hand $user] 
if {[matchattr $hand S]} { 
chattr $hand -S
return 
} 
pushmode $::channel -v $user 
puthelp "NOTICE $nick :you've been devoiced for not serving."
} 
} 
} 

proc saveUser {nick chan hand idx args} { 
if {[validuser $hand]} { 
chattr $hand +S 
return 
} 
adduser $nick 
chattr $nick +S 
}
User avatar
ReaLz
Op
Posts: 121
Joined: Sat Oct 19, 2002 5:33 am
Location: Athens, Greece

Post by ReaLz »

yes I've seen some probs...
1) you have the same line and phrase so I will disable the phrase.
2) you still use $nick instead of $user as caesar told you.. i'll change it..

Code: Select all

## Settings 
set line "*Fserve Active*" 
set channel "#E-Hub" 

## Binds 
bind pubm - "$line" voiceUser 
bind time - "00 * * * *" time_proc 
bind time - "30 * * * *" time_proc 
bind pubm - "$line" saveUser 

## Code 
proc voiceUser {nick uhost hand channel rest} { 
putserv "MODE $channel +v :$nick" 
return 
} 

proc time_proc {min hour day month year} {check_word} 

proc check_word {} { 
if {![botisop $::channel]} { 
putlog "I'm not oped in $::channel." 
return 0 
} 
foreach user [chanlist $::channel] { 
if {[isvoice $user $::channel]} { 
set hand [nick2hand $user] 
if {[matchattr $hand S]} { 
chattr $hand -S 
return 
} 
pushmode $::channel -v $user 
puthelp "NOTICE $user :you've been devoiced for not serving." 
} 
} 
} 

proc saveUser {nick chan hand idx args} { 
if {[validuser $hand]} { 
chattr $hand +S 
return 
} 
adduser $nick 
chattr $nick +S 
} 
«A fantastic spaghetti is a spaghetti that does not exist»
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

Code: Select all

bind pubm - "$line" voiceUser 
bind time - "00 * * * *" time_proc 
bind time - "30 * * * *" time_proc 
bind pubm - "$line" saveUser
no need to have two equal pubm binds

Code: Select all

bind pubm - "$line" voiceUser 
bind time - "00 * * * *" time_proc 
bind time - "30 * * * *" time_proc 
just call the saveUser proc from within the voiceUser proc

Code: Select all

proc voiceUser {nick uhost hand channel rest} { 
  putserv "MODE $channel +v :$nick" 
  saveUser $nick $uhost $hand $channel $rest
  return 
}

Code: Select all

adduser $nick 
chattr $nick +S 
$nick is not the same as the saved handle on the bot.
when you add the user and the nick is to long, the eggdrop will "cut" the nick.
use this to get the correct handle

Code: Select all

adduser $nick 
chattr [nick2hand $nick] +S 
and finally, conserning the timing of devoicing... it has to do with the use of the time bind, it will not wait 30 mins to check the users. It executes every whole and half hour. ie.. 10.00, 10.30, 11.00 .... etc
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

better [list saveUser $nick $uhost $hand $channel $rest]
Last edited by caesar on Wed Jun 11, 2003 4:57 am, edited 1 time in total.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

if you insist on using list on it (which really is not needed) the drop the "" quotes, or else saveUser will be called with just one argument :D
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oups, yes, forgot to remove them :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

tsk... that's what they all say :lol:
Elen sila lúmenn' omentielvo
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I'm not in that list :P
Once the game is over, the king and the pawn go back in the same box.
k
kevie
Voice
Posts: 12
Joined: Tue Jun 10, 2003 3:45 am

Post by kevie »

Ok I've tried what Papillon said and got certain errors
1) [23:44] [gucci] [23:45] * Duplicate user record 'gucci'!
[23:44] [gucci] [23:45] Userfile loaded, unpacking...
[23:44] [gucci] [23:45] (!) I have an user record, but without +b
2) [23:46] [gucci] [23:47] Tcl error [voiceUser]: invalid command name " "

Code: Select all

## Settings 
set line "*Fserve Active*" 
set channel "#E-hub" 

## Binds 
bind pubm - "$line" voiceUser 
bind time - "00 * * * *" time_proc 
bind time - "30 * * * *" time_proc 

## Code 
proc voiceUser {nick uhost hand channel rest} { 
  putserv "MODE $channel +v :$nick" 
  saveUser $nick $uhost $hand $channel $rest 
  return 
}
proc time_proc {min hour day month year} {check_word} 

proc check_word {} { 
if {![botisop $::channel]} { 
putlog "I'm not oped in $::channel." 
return 0 
} 
foreach user [chanlist $::channel] { 
if {[isvoice $user $::channel]} { 
set hand [nick2hand $user] 
if {[matchattr $hand S]} { 
chattr $hand -S 
return 
} 
pushmode $::channel -v $user 
puthelp "NOTICE $user :you've been devoiced for not serving." 
} 
} 
} 
adduser $nick 
chattr [nick2hand $nick] +S }
Locked