| View previous topic :: View next topic |
| Author |
Message |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Jul 13, 2020 10:08 am Post subject: massmode not working proper |
|
|
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 |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Mon Jul 13, 2020 11:28 am Post subject: Re: massmode not working proper |
|
|
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 |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Jul 13, 2020 11:44 am Post subject: |
|
|
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 |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Mon Jul 13, 2020 2:04 pm Post subject: |
|
|
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.
| 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 |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Jul 13, 2020 2:45 pm Post subject: |
|
|
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 |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Mon Jul 13, 2020 2:51 pm Post subject: |
|
|
| 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 |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Jul 13, 2020 3:15 pm Post subject: |
|
|
some times im gettin this error :
Tcl error [parsemode]: can't read "modechar": no such variable |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Mon Jul 13, 2020 4:50 pm Post subject: |
|
|
| thx willyw it works fine now |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Mon Jul 13, 2020 4:57 pm Post subject: |
|
|
| simo wrote: | | thx willyw it works fine now |
Good to hear.
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 |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Tue Jul 14, 2020 9:16 pm Post subject: |
|
|
| 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 |
|
 |
|