| View previous topic :: View next topic |
| Author |
Message |
MIODude Voice
Joined: 09 Oct 2006 Posts: 32
|
Posted: Sat Oct 03, 2009 5:38 pm Post subject: [SOLVED] isvoice / isop help |
|
|
I just want a simple procedure to only be invoked if the user isn't an op or doesn't have voice...
| Code: |
proc procname {nick uhost hand chan args} {
if {{![isvoice $nick $chan]} || {![isop $nick $chan]}} {
putchan $chan "$nick, blah blah blah"
return 1
}
return 1
}
|
i've tried multiple variations - i get
expected boolean value but got "![isvoice $nick $chan]"
What am I doing wrong?
Last edited by MIODude on Sat Oct 03, 2009 6:37 pm; edited 1 time in total |
|
| Back to top |
|
 |
arfer Master

Joined: 26 Nov 2004 Posts: 436 Location: Manchester, UK
|
Posted: Sat Oct 03, 2009 6:20 pm Post subject: |
|
|
Logically you need && instead of || because you want to trigger if user is not op AND is not voice.
You are also using braces to seperate the two commands determining the logical result instead of parenthesis. Braces generally hinder variable, command and backslash substitution.
I'm not entirely sure what putchan means. Perhaps you mean one of the Eggdrop Tcl output commands putserv or putquick.
The argument 'args' has special meaning, do not use it in this context.
Generally I would use return 0 or even simply return at the conclusion of a proc, though there are special circumstances where you may want to deliberately return 1. Refer to 'return values' in tcl-commands.doc. In any case you don't need two such statements as per your code.
| Code: |
proc procname {nick uhost hand chan text} {
if {(![isvoice $nick $chan]) && (![isop $nick $chan])} {
putserv "PRIVMSG $chan :$nick, blah blah blah"
}
return 0
}
|
_________________ I must have had nothing to do
Last edited by arfer on Sat Oct 03, 2009 6:37 pm; edited 1 time in total |
|
| Back to top |
|
 |
MIODude Voice
Joined: 09 Oct 2006 Posts: 32
|
Posted: Sat Oct 03, 2009 6:36 pm Post subject: SOLVED |
|
|
Thanks! that did it..
I'm not sure about the putchan myself - it came with the original script that i was modifying |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Sat Oct 03, 2009 7:19 pm Post subject: |
|
|
The putchan command is provided by the alltools.tcl script provided with eggdrops.
As for the logics, you don't need those parenthesis, as the not-operator (!) has higher priority than either and-operator (&&) or or-operator (||). No harm in including them though. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
|