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 

.chanset or .set on channel/pm

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
nobody
Voice


Joined: 03 Apr 2020
Posts: 11

PostPosted: Fri Apr 03, 2020 10:11 pm    Post subject: .chanset or .set on channel/pm Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
nobody
Voice


Joined: 03 Apr 2020
Posts: 11

PostPosted: Sun Apr 05, 2020 6:36 am    Post subject: Update on ".chanset/.set" Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sat Apr 18, 2020 8:25 am    Post subject: Reply with quote

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. Wink

ps: i got BlackShadow to modify his blacktools clonescanner into a seperate script Very Happy
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nobody
Voice


Joined: 03 Apr 2020
Posts: 11

PostPosted: Tue Apr 21, 2020 1:01 am    Post subject: Reply with quote

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. Wink

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



good to know, im not really familiar with blacktools since im using "netgate.tcl" to control my bots in DALnet.. but yeah its good
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Tue Apr 21, 2020 9:41 am    Post subject: Reply with quote

cool Very Happy 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 Wink

ps if you like you can share the channel name and i can help you out i hang out at dalnet also Very Happy
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Fri Jun 26, 2020 10:55 pm    Post subject: Reply with quote

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

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Wed Dec 15, 2021 10:23 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Dec 16, 2021 9:02 am    Post subject: Reply with quote

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

Code:



       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."
     }
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Dec 16, 2021 2:11 pm    Post subject: Reply with quote

i tried this but i keep gettin error:

Quote:
Tcl error [pub:chanset]: Unknown channel setting.



Code:

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 "
  }
}
 
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Fri Dec 17, 2021 9:31 am    Post subject: Reply with quote

i even tried without the settings part in the added code

Code:

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
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Fri Dec 17, 2021 10:29 am    Post subject: Reply with quote

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.
_________________
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: Fri Dec 17, 2021 12:17 pm    Post subject: Reply with quote

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

Quote:
Unknown channel setting



only now i get odd outputs for example:


Quote:
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
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Fri Dec 17, 2021 12:55 pm    Post subject: Chanset TCL by BLaCkShaDoW Reply with quote

From https://tclscripts.net/community/tcl-snippets/chanset-tcl/

Code:

#
#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"


_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.


Last edited by SpiKe^^ on Sat Dec 18, 2021 12:53 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri Dec 17, 2021 2:26 pm    Post subject: Reply with quote

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:

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.
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Fri Dec 17, 2021 2:48 pm    Post subject: Reply with quote

thanks spike^^ ceasar
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 -> Script Requests 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