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 

massmode not working proper

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


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Jul 13, 2020 10:08 am    Post subject: massmode not working proper Reply with quote

any reason why the second if statement wont trigger if criteria is met in this?

the if {![info exists nickz]} {

Code:

bind pubm - "#% +?*" pub:massmodez316
bind pubm - "#% -?*" pub:massmodez316

proc pub:massmodez316 {nick host hand chan text} {
   if {![matchattr [nick2hand $nick] o|o $chan] && ![isop $nick $chan] && ![ishalfop $nick $chan]} { return 0 }

   set modex [lindex [split $text] 0]
   set nickz [join [lrange [split $text] 1 end]]
   foreach user $nickz {


      if {![info exists nickz]} {
         pushmode $chan $modex
      } else {
         pushmode $chan $modex $user
      }
   }
   flushmode $chan
}



for example this works fine +v nick nick nick nick nick nick nick nick

this on the other hand doesnt

+m
or +M or any other single param mode setting


Last edited by simo on Mon Jul 13, 2020 5:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Jul 13, 2020 11:28 am    Post subject: Re: massmode not working proper Reply with quote

This:
Code:

    set nickz [join [lrange [split $text] 1 end]]

*IS* setting nickz, isn't it? It's set, there's just nothing in it.

Thus, this:
Code:

if {![info exists nickz]}

doesn't trigger.

That's what I'm thinking, based on what you've said.

How about if instead you used ?:
Code:

if {![llength $nickz]}


By the way, look at this part too:
Code:

set nickz [join [lrange [split $text] 1 end]]
   foreach user $nickz {


The foreach command wants a list, and as it is $nickz is a string.
Why join it? Why not leave it as the string returned by the lrange command?
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Jul 13, 2020 11:44 am    Post subject: Reply with quote

thanks for your reply willyw i tried like this same effect it doesnt trigger single mode setting

Code:

bind pubm - "#% +?*" pub:massmodez316
bind pubm - "#% -?*" pub:massmodez316


proc pub:massmodez316 {nick host hand chan text} {
   if {!([matchattr [nick2hand $nick] o|o $chan] && [isop $nick $chan] && [ishalfop $nick $chan])} { return 0 }

   set modex [lindex [split $text] 0]
   set nickz [lrange [split $text] 1 end]
   foreach user $nickz {

     if {![llength $nickz]} {
         pushmode $chan $modex
      } else {
         pushmode $chan $modex $user
      }
   }
   flushmode $chan
}
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Jul 13, 2020 2:04 pm    Post subject: Reply with quote

Play with this. See what you think.

I tried to make minimal changes.

There is no checking to see if bot is even op'd, or if nick to set mode on is even on #channel. You can decide if you want to add such things in it. Smile




Code:


bind pubm - "#% +?*" pub:massmodez316
bind pubm - "#% -?*" pub:massmodez316

###
proc pub:massmodez316 {nick host hand chan text} {

        if {!([matchattr [nick2hand $nick] o|o $chan] && [isop $nick $chan] && [ishalfop $nick $chan])} {
                return 0
        }


        set modex [lindex [split $text] 0]
        set nickz [join [lrange [split $text] 1 end]]

        set nickz [string trim $nickz]



        if {![llength [split $nickz]]} {
                pushmode $chan $modex
                return 0
        }



        foreach user [split $nickz] {
                pushmode $chan $modex $user
        }

        flushmode $chan
}
###


_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Jul 13, 2020 2:45 pm    Post subject: Reply with quote

thanx for the reply willyw i tried your last posted code it gave me the same result this works fine:

+v nick nick nick nick nick nick nick nick nick nick

however this doesnt :

+M
+m
+i
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Jul 13, 2020 2:51 pm    Post subject: Reply with quote

simo wrote:
thanx for the reply willyw i tried your last posted code it gave me the same result this works fine:

+v nick nick nick nick nick nick nick nick nick nick

however this doesnt :

+M
+m
+i


I don't know why. I tried a few times, both with nicks and without. It worked fine for me.
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Jul 13, 2020 3:15 pm    Post subject: Reply with quote

some times im gettin this error :

Tcl error [parsemode]: can't read "modechar": no such variable
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Mon Jul 13, 2020 4:50 pm    Post subject: Reply with quote

thx willyw it works fine now
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Jul 13, 2020 4:57 pm    Post subject: Reply with quote

simo wrote:
thx willyw it works fine now



Good to hear. Smile


What was the solution though?
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Jul 14, 2020 9:16 pm    Post subject: Reply with quote

Oh sorry didn't see the last question only now i did the issue was with the access check i removed the !() and added! At each check
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