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 

pub modes command sets odd banmasks

 
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: Tue Mar 15, 2022 6:08 am    Post subject: pub modes command sets odd banmasks Reply with quote

im using this code for a while and cant figure out why it sets weird banmasks
on certain nicks i was told on eggdrop support channel not to use split but even after consulting the docs i couldnt figure it out

this is the code :

Code:

bind pubm n|n "#% +?*" pub:massmodez317
bind pubm n|n "#% -?*" pub:massmodez317

proc pub:massmodez317 {nick host hand chan text} {
   set modex [join [lindex [split $text] 0]]
  set restmodes [lrange [split $text] 1 end]
  if { [onchan [string map {+ "" - ""} $modex] $chan] } { return 0 }
   if { [llength [split $text]] == 2 } {
      putnow "MODE $chan $modex $restmodes"
   } else {  return 0  }
}


for example when i set a ban on a nick like [somenick] or {somenick} like this

+b [somenick]
+b {somenick}

it sets it as +b {{[somenick]}}
it sets it as +b {{{somenick}}}

i was told it has to do with the split that was used
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Tue Mar 15, 2022 8:09 am    Post subject: Reply with quote

Use join to get a string rather than a list: split creates a list, lrange works on list. You want text.
_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Mar 15, 2022 9:15 am    Post subject: Reply with quote

thanks CC for your response but im kinda lost how to use it proper

would you have an examples ?
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Tue Mar 15, 2022 10:15 am    Post subject: Reply with quote

Simple method:
Code:
bind pubm n|n "#% +?*" pub:massmodez317
bind pubm n|n "#% -?*" pub:massmodez317

proc pub:massmodez317 {nick host hand chan text} {
   set modex [join [lindex [split $text] 0]]
  set restmodes [join [lrange [split $text] 1 end]]
  if { [onchan [string map {+ "" - ""} $modex] $chan] } { return 0 }
   if { [llength [split $text]] == 2 } {
      putnow "MODE $chan $modex $restmodes"
   } else {  return 0  }
}


Better method:
Code:
bind pubm n|n "#% +?*" pub:massmodez317
bind pubm n|n "#% -?*" pub:massmodez317

proc pub:massmodez317 {nick host hand chan text} {
   if {[llength [split $text]]!=2} { return 0}
   set modex [join [lindex [split $text] 0]]
   if { [onchan [string map {+ "" - ""} $modex] $chan] } { return 0 }
   set restmodes [join [lrange [split $text] 1 end]]
   putnow "MODE $chan $modex $restmodes"
}

_________________
https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community.
Back to top
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Tue Mar 15, 2022 12:25 pm    Post subject: Reply with quote

thanks CC both seem to work well , any reason why the second would be more proper ?
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