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.

.chanset or .set on channel/pm

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
n
nobody
Voice
Posts: 19
Joined: Fri Apr 03, 2020 10:01 pm

.chanset or .set on channel/pm

Post by nobody »

Hello,

Anyone have a script that allows .chanset or .set flags in the home channel instead of logging into telnet or via dcc chat?



---- i tried seaching the archive and this forum but maybe i am not too lucky to find maybe the exact name of the script.
---- i also find this feature in blacktools tcl but i am still hoping it has a separate script for that purpose alone.


Thank you
n
nobody
Voice
Posts: 19
Joined: Fri Apr 03, 2020 10:01 pm

Update on ".chanset/.set"

Post by nobody »

A scripter in undernet behind blacktools name: BLaCkShaDoW gave me the script already

chanset.tcl and it's working like a gold


18:33:02 <Janroe> !chanset +blackseen
18:33:03 -Puso- Setting +blackseen is already set.

BLaCkShaDoW @ tclscripts.net

Thank you
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

yeah blacktools already has this feature, But if you wanted to make the .chanset part a seperate script take a look in blacktools modules directory it would have it there. ;)

ps: i got BlackShadow to modify his blacktools clonescanner into a seperate script :D
ComputerTech
n
nobody
Voice
Posts: 19
Joined: Fri Apr 03, 2020 10:01 pm

Post by nobody »

ComputerTech wrote:yeah blacktools already has this feature, But if you wanted to make the .chanset part a seperate script take a look in blacktools modules directory it would have it there. ;)

ps: i got BlackShadow to modify his blacktools clonescanner into a seperate script :D

good to know, im not really familiar with blacktools since im using "netgate.tcl" to control my bots in DALnet.. but yeah its good
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

cool :D yeah download blacktools then if you like go to the modules folder and every option is their as a single script just need to slightly configure it ;)

ps if you like you can share the channel name and i can help you out i hang out at dalnet also :D
ComputerTech
User avatar
ComputerTech
Master
Posts: 399
Joined: Sat Feb 22, 2020 10:29 am
Contact:

Post by ComputerTech »

for those who want a script code that sets settings like ".chanset" try ths
found this somewhere on this forum :roll:

Code: Select all

bind pub n|n !chanset pub:chanset 

proc pub:chanset {nick uhost hand chan arg} { 
 foreach {set value} [split $arg] {break} 
 if {![info exists value]} { 
  catch {channel set $chan $set} error 
 } { 
  catch {channel set $chan $set $value} error 
 } 
 if {$error == ""} { 
  puthelp "privmsg $chan :Successfully set $arg" 
 } { 
  puthelp "privmsg $chan :Error setting $arg: [lindex $error 0]..." 
 } 
}
ComputerTech
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

I wonder how to edit this so check is a chanset is actually already set to report back its already set same with already unset
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i came up with this not sure how to integrate it tho

Code: Select all



       set setting [string trimleft [lindex [split $text] 0] "+-"]

      if {[channel get $chan $setting]} {
        putserv "NOTICE $nick :$setting is already enabled on $chan."
      } else { 
        channel set $chan $mode +$setting
        putserv "NOTICE $nick :$setting is now enabled."
}

      if {![channel get $chan $setting]} {
        putserv "NOTICE $nick :$setting is already disabled on $chan."
      } else {
	  channel set $chan $mode -$setting
        putserv "NOTICE $nick :$setting is now disabled."
     }
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i tried this but i keep gettin error:
Tcl error [pub:chanset]: Unknown channel setting.

Code: Select all

bind pub n|n .chanset pub:chanset

proc pub:chanset {nick uhost hand chan text} {
   set setting [string trimleft [lindex [split $text] 0] "+-"]
   set value [lassign [split $text] mode]
  if {![info exists value] || $value eq ""} {
  catch {channel set $chan $mode} error
  } else {
   catch {channel set $chan $mode $value} error
  }


if {[channel get $chan $setting]} {
        putserv "NOTICE $nick :$setting is already enabled on $chan."
      } else {
        channel set $chan $mode +$setting
        putserv "NOTICE $nick :$setting is now enabled."
}

      if {![channel get $chan $setting]} {
        putserv "NOTICE $nick :$setting is already disabled on $chan."
      } else {
     channel set $chan $mode -$setting
        putserv "NOTICE $nick :$setting is now disabled."
     }

   if {$error == ""} {
      putnow "NOTICE $nick :Successfully set $text"
  } else {
     putnow "NOTICE $nick :Error setting $text: $error "
  }
}
 
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

i even tried without the settings part in the added code

Code: Select all

bind pub n|n .chanset pub:chanset

proc pub:chanset {nick uhost hand chan text} {
   set setting [string trimleft [lindex [split $text] 0] "+-"]
   set value [lassign [split $text] mode]
  if {![info exists value] || $value eq ""} {
  catch {channel set $chan $mode} error
  } else {
   catch {channel set $chan $mode $value} error
  }


if {[channel get $chan $setting]} {
        putserv "NOTICE $nick :$setting is already enabled on $chan."
      } else {
        putserv "NOTICE $nick :$setting is now enabled."
}

      if {![channel get $chan $setting]} {
        putserv "NOTICE $nick :$setting is already disabled on $chan."
      } else {
        putserv "NOTICE $nick :$setting is now disabled."
     }

   if {$error == ""} {
      putnow "NOTICE $nick :Successfully set $text"
  } else {
     putnow "NOTICE $nick :Error setting $text: $error "
  }
}
 

only now i keep gettin odd outputs wich wich arent accurate
for example setting +youtube i get now disabled and now enabled
odd result outputs from the part in added
User avatar
CrazyCat
Revered One
Posts: 1304
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

If you get Unknown channel setting, it means this setting doesn't exists. Probably that the script which provides this setting is not loaded.

The scripts lacks a test to check if setting exists before doing anythingwith it.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thanks for your responce CC i dont get this error anymore:
Unknown channel setting

only now i get odd outputs for example:

17:16:35 (+Simo) : .chanset +youtube
17:16:37 -Hawk- : youtube is already enabled on #test.
17:16:37 -Hawk- : youtube is now disabled.
17:16:37 -Hawk- : Successfully set +youtube

17:16:58 (+Simo) : .chanset -youtube
17:16:58 -Hawk- : youtube is now enabled.
17:16:59 -Hawk- : youtube is already disabled on #test.
17:16:59 -Hawk- : Successfully set -youtube
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Chanset TCL by BLaCkShaDoW

Post by SpiKe^^ »

From https://tclscripts.net/community/tcl-sn ... anset-tcl/

Code: Select all

#
#Chanset TCL
#
# !chanset <+/-settting> ; setting <value>
#
#						BLaCkShaDoW Production
#############################################################################

set set_flags "nm|nm"

#############################################################################
bind pub $set_flags !chanset set:proc

proc set:proc {nick host hand chan arg} {
  set flag [lindex [split $arg] 0]
  set str [join [lrange [split $arg] 1 end]]
  set value ""
  set error 0
  if {$flag == ""} {
    puthelp "NOTICE $nick :use !set <+/-settting> ; setting <value>"
    return
  }
  if {[regexp {^[+-]} $flag]} {
    set rem_flag [string map {"+" "" "-" ""} $flag]
    set error [catch {channel get $chan $rem_flag} value]
  }
  if {$error == "1"} {
    puthelp "NOTICE $nick :Invalid channel setting."
    return
  }

  if {[regexp {^[+]} $flag]} {
    if {$value == "1"} {
      puthelp "NOTICE $nick :Setting \002$flag\002 is already set."
    } else {
      channel set $chan $flag
      puthelp "NOTICE $nick :Enabled \002$flag\002 setting."
    }
  } elseif {[regexp {^[-]} $flag]} {
    if {$value == "0"} {
      puthelp "NOTICE $nick :Setting \002$flag\002 is already disabled."
    } else {
      channel set $chan $flag
      puthelp "NOTICE $nick :Disabled \002$flag\002 setting."
    }

  } else {
    set error [catch {channel get $chan $flag} value]
    set rem_value [string map {" " ":"} $value]
    if {$error == "1"} {
      puthelp "NOTICE $nick :Invalid channel setting."
      return
    }
    if {$str == ""} {
      puthelp "NOTICE $nick :use !set <+/-settting> ; setting <value>"
      return
    }
    if {[string equal -nocase $rem_value $str]} {
      puthelp "NOTICE $nick :\002$flag\002 is already set to \002$str\002"
      return
    }
    channel set $chan $flag $str
    puthelp "NOTICE $nick :Set \002$flag\002 to \002$str\002"
  }
}

putlog "Chanset TCL by BLaCkShaDoW Loaded. For more TCLs visit WwW.TclScripts.Net"

Last edited by SpiKe^^ on Sat Dec 18, 2021 12:53 pm, edited 1 time in total.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

A little bit of forum search and could have seen this from yours truly that accepts whatever you want to throw at it to set:

Code: Select all

namespace eval ChanSet {

   bind pub n|n .set [namespace current]::chanset
   
   proc chanset {nick uhost hand chan text} {

      set pos [string first # $text]
      if {!$pos} {
         scan $text {%s%s} chan mode
      } else {
         scan $text {%s} mode
      }
      
      if {![info exists mode]} {
         puthelp "NOTICE $nick :Error, usage: $::lastbind \[channel\] <channel mode> \[value\]. For example $::lastbind #foo +enforcebans, $::lastbind $chan blah 1 2 3, $::lastbind foo 2:5"
         return
      }

      if {![string last - $mode]} {
         set what [string map {- ""} $mode]
      } else {
         set what [string map {+ ""} $mode]
      }
      
      if {![validchan $chan]} {
         puthelp "NOTICE $nick :Error, I'm not on $chan channel."
         return
      }
      
      if {[string equal $mode $what]} {
         set value [lrange $text [expr $pos +2] end]
      }      

      if {[catch {set now [channel get $chan $what]} err]} {
         puthelp "NOTICE $nick :Error, \002$what\002 is an unkown channel setting."
         return
      }

      if {[info exists value]} {
         if {[string equal -nocase $now $value]} {
            puthelp "NOTICE $nick :Channel mode $what is already set to $now."
            return
         }
         channel set $chan $mode $value
         puthelp "NOTICE $nick :Channel mode $what has been set to $value for $chan cahnnel."
      } else {
         scan [string map {+ 1 - 0} $mode] {%d} change
         if {[string equal $now $change]} {
            puthelp "NOTICE $nick :Error, channel mode $what is already [expr {$now ? "enabled" : "disabled"}] for $chan channel"
            return
         }
         channel set $chan $mode
         puthelp "NOTICE $nick :Channel mode $what has been [expr {[string first + $mode] > -1 ? "enabled" : "disabled"}] for $chan channel."
      }
   }
} 
Once the game is over, the king and the pawn go back in the same box.
s
simo
Revered One
Posts: 1108
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thanks spike^^ ceasar
Post Reply