This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.
For more information, see this announcement post . Click the X in the top right-corner of this box to dismiss this message.
Help for those learning Tcl or writing their own scripts.
Online
simo
Revered One
Posts: 1078 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Fri Jul 31, 2020 7:35 am
i was wondering why this sets like:
+k jhjhas
and like +o nick nick nick
but wont set like:
+l 22
+J 10
Code: Select all
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 {[onchan [string trimleft [split $modex 0] "+-"] $chan]} { return 0 }
if {![llength [split $nickz]]} {
pushmode $chan $modex
return 0
} else { foreach user [split $nickz] {
pushmode $chan $modex $user
}
}
flushmode $chan
}
CrazyCat
Revered One
Posts: 1236 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Fri Jul 31, 2020 8:22 am
Well, peharps do you play too much with list/string conversions...
And you call pushmode2, what is this procedure ?
finally, what is exactly doing
Code: Select all
if {[onchan [string trimleft [split $modex 0] "+-"] $chan]} { return 0 }
Here is how I think your proc must be:
Code: Select all
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 [join [lindex [split $text] 0]]
if { [llength [split $text]]==1 } {
pushmode $chan $modex
} else {
foreach user [lrange [split $text] 1 end] {
pushmode $chan $modex $user
}
}
flushmode $chan
}
Online
simo
Revered One
Posts: 1078 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Fri Jul 31, 2020 8:36 am
tnx for your reply crazycat
the : if {[onchan [string trimleft [split $modex 0] "+-"] $chan]} { return 0 }
is to check if the first parameter doesnt contain a nick wich is on channel
and the pushmode2 was a typo should be pushmode
i tried your code it works for +l 22 but not for like +J 10
CrazyCat
Revered One
Posts: 1236 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Fri Jul 31, 2020 8:45 am
Ok, I was guessing something like that...
But $modex is just the mode, so don't complicate things:
Code: Select all
if { [onchan [string map {+ "" - ""} $modex] $chan] } { return 0 }
simo wrote: i tried your code it works for +l 22 but not for like +J 10
Does pushmode only accept RFC modes ? I'll have a look on that
Online
simo
Revered One
Posts: 1078 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Fri Jul 31, 2020 8:52 am
yes thommey told me pushmode only excepts RFC modes
but even using the custom pushmode thommey wrote for me doesnt seem to take it so it must be something else
CrazyCat
Revered One
Posts: 1236 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Fri Jul 31, 2020 8:55 am
I'm to lazzy to search, can you paste the custom pushmode you have plz ?
Online
simo
Revered One
Posts: 1078 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Fri Jul 31, 2020 8:59 am
would there be a way to use without the pushmode to evade all these issues with RFC
like using user's massmode code:
Code: Select all
proc massmode {chan mode arg} {
scan $mode {%[-+]%[bov]} p m
set j [llength $arg]
set k [expr {${::modes-per-line}-1}]
set out "";
for {set i 0} {$i<$j} {incr i} {
set args [lrange $arg $i [incr i $k]]
append out "MODE $chan $p[string repeat $m [llength $args]] [join
$args]\n"
}
putnow $out
}
http://forum.egghelp.org/viewtopic.php? ... t=massmode
caesar
Mint Rubber
Posts: 3776 Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory
Post
by caesar » Fri Jul 31, 2020 2:45 pm
Why do you bother with
[matchattr [nick2hand $nick] o|o $chan] when:
1. you already got the user's account in the hand variable;
2. you should change the bind to
bind pubm o|o directly and drop this part.
What issues you got with
massmode ? Apart it not seeing other flags apart than bov obviously?
Once the game is over, the king and the pawn go back in the same box.
Online
simo
Revered One
Posts: 1078 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Fri Jul 31, 2020 3:52 pm
oh euhm yea true didnt see that part thnx caesar heh
also the thing is if we use bind pubm o|o
it wont recognize like chanops and chanhalfops
as some may not have the flag set on them and there is no need to if they are chanops halfops
what would be the proper way to check if flag o is set on a nick to give it access to this command while also allowing regular chanops halfops access as well
Online
simo
Revered One
Posts: 1078 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sat Aug 01, 2020 10:41 am
would there be any other method to have this set any channel mode instead of being restricted ?
these are the available channel modes on the ircd :
IXbegwkBEFHJLQWdfjlxACDGKMNOPRSTUVcimnprstuz
CrazyCat
Revered One
Posts: 1236 Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:
Post
by CrazyCat » Sat Aug 01, 2020 11:47 am
Read what caesar said and your proc:
Code: Select all
proc massmode {chan mode arg} {
scan $mode {%[-+]%[bov]} p m
set j [llength $arg]
set k [expr {${::modes-per-line}-1}]
set out "";
for {set i 0} {$i<$j} {incr i} {
set args [lrange $arg $i [incr i $k]]
append out "MODE $chan $p[string repeat $m [llength $args]] [join $args]\n"
}
putnow $out
}
It appears that "bov" are in the first line, so try correcting it using:
Code: Select all
scan $mode {%[-+]%[IXbegwkBEFHJLQWdfjlxACDGKMNOPRSTUVcimnprstuz]} p m
Online
simo
Revered One
Posts: 1078 Joined: Sun Mar 22, 2015 2:41 pm
Post
by simo » Sat Aug 01, 2020 1:35 pm
tnx crazycat i already figured that part but not sure how to use it with the code i posted