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 

[SOLVED] isvoice / isop help

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
MIODude
Voice


Joined: 09 Oct 2006
Posts: 32

PostPosted: Sat Oct 03, 2009 5:38 pm    Post subject: [SOLVED] isvoice / isop help Reply with quote

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


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Sat Oct 03, 2009 6:20 pm    Post subject: Reply with quote

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


Joined: 09 Oct 2006
Posts: 32

PostPosted: Sat Oct 03, 2009 6:36 pm    Post subject: SOLVED Reply with quote

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


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sat Oct 03, 2009 7:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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