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 

Simple TCL Script
Goto page Previous  1, 2
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3740
Location: Mint Factory

PostPosted: Tue Jun 10, 2003 10:18 am    Post subject: Reply with quote

Is $user not $nick. Pay attention, don't sleep in class. Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
ReaLz
Op


Joined: 19 Oct 2002
Posts: 121
Location: Athens, Greece

PostPosted: Tue Jun 10, 2003 2:16 pm    Post subject: Reply with quote

and add the
Code:
return 0
after the
Code:
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»
Back to top
View user's profile Send private message Send e-mail
kevie
Voice


Joined: 10 Jun 2003
Posts: 12

PostPosted: Tue Jun 10, 2003 11:59 pm    Post subject: Reply with quote

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:

## 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
}
Back to top
View user's profile Send private message
ReaLz
Op


Joined: 19 Oct 2002
Posts: 121
Location: Athens, Greece

PostPosted: Wed Jun 11, 2003 1:19 am    Post subject: Reply with quote

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:
## 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»
Back to top
View user's profile Send private message Send e-mail
Papillon
Owner


Joined: 15 Feb 2002
Posts: 724
Location: *.no

PostPosted: Wed Jun 11, 2003 4:31 am    Post subject: Reply with quote

Code:
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:
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:
proc voiceUser {nick uhost hand channel rest} {
  putserv "MODE $channel +v :$nick"
  saveUser $nick $uhost $hand $channel $rest
  return
}


Code:
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:
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
Back to top
View user's profile Send private message MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3740
Location: Mint Factory

PostPosted: Wed Jun 11, 2003 4:44 am    Post subject: Reply with quote

better [list saveUser $nick $uhost $hand $channel $rest]
_________________
Once the game is over, the king and the pawn go back in the same box.


Last edited by caesar on Wed Jun 11, 2003 4:57 am; edited 1 time in total
Back to top
View user's profile Send private message
Papillon
Owner


Joined: 15 Feb 2002
Posts: 724
Location: *.no

PostPosted: Wed Jun 11, 2003 4:48 am    Post subject: Reply with quote

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 Very Happy
_________________
Elen sila lúmenn' omentielvo
Back to top
View user's profile Send private message MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3740
Location: Mint Factory

PostPosted: Wed Jun 11, 2003 4:57 am    Post subject: Reply with quote

Oups, yes, forgot to remove them Smile
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
Papillon
Owner


Joined: 15 Feb 2002
Posts: 724
Location: *.no

PostPosted: Wed Jun 11, 2003 4:58 am    Post subject: Reply with quote

tsk... that's what they all say Laughing
_________________
Elen sila lúmenn' omentielvo
Back to top
View user's profile Send private message MSN Messenger
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3740
Location: Mint Factory

PostPosted: Wed Jun 11, 2003 5:01 am    Post subject: Reply with quote

I'm not in that list Razz
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
kevie
Voice


Joined: 10 Jun 2003
Posts: 12

PostPosted: Wed Jun 11, 2003 11:53 am    Post subject: Reply with quote

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:

## 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 }
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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