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 

[Solved]Need Help with dccsimul

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Zohaib
Voice


Joined: 18 May 2011
Posts: 22

PostPosted: Tue Apr 21, 2020 6:13 am    Post subject: [Solved]Need Help with dccsimul Reply with quote

Hello Everyone,
I am trying to make public commands for changing settings for Allprotection without DCC chat As now a days most of the time I dont have access to my Laptop and cannot use DCC chat directly from phone.
here are few things i have tried but they didnt work.

I was Using this Code to Enable Disable Scripts using Public Command
for example !enable/disable gseen youtube and other scripts
Code:
proc dcc_enable {nick uhost hand chan text} {
   set chan1 [lindex $text 0]
   set cmdschar [lindex $text 1]
   channel set $chan1 +$cmdschar
   puthelp "privmsg $chan : Enabled $cmdschar on Channel $chan1 ." 
}


so i tried editing it for All Protection stuff


Code:
proc dcc_chanset {nick uhost hand chan text} {
   set chan1 [lindex $text 0]
   set cmdschar [lrange [split $text] 1 end]]
   channel set $chan1 $cmdschar
   puthelp "Notice $nick : Channel $chan1 Settings Changed to $cmdschar" 
}


But i m getting this error
Quote:
Tcl error [dcc_chanset]: illegal channel option: ap:reset"


so instead using
Quote:
channel set $chan1 $cmdschar

I changed it to
Code:
proc dcc_chanset {host idx text} {
   set chan1 [lindex $text 0]
   set cmdschar [lrange $text 1 end]
   dccsimul $idx ".chanset $chan1 $cmdschar"
   puthelp "privmsg $chan : Channel $chan1 Settings Changed to $cmdschar" 
}


but i am getting this error
Quote:
Tcl error [dcc_chanset]: wrong # args: should be "dcc_chanset host idx text"


Can anyone guide me how I achieve my goal here

P.S i m noob in scripting.

Thanks in Advance
_________________
<Zohaib>


Last edited by Zohaib on Sun May 10, 2020 11:39 am; edited 1 time in total
Back to top
View user's profile Send private message
Zohaib
Voice


Joined: 18 May 2011
Posts: 22

PostPosted: Thu Apr 23, 2020 4:34 am    Post subject: Reply with quote

any body?
_________________
<Zohaib>
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Thu Apr 23, 2020 4:50 am    Post subject: Reply with quote

the ap:reset is not a known value, so it's normal you got an error. (.chaninfo #yourchan to list the available values).
Try your dcc_enable proc with a standard value, like seen or greet.

For your use of dccsimul, the error message seems clear:
Code:
dccsimul $host $idx ".chanset $chan1 $cmdschar"

_________________
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
caesar
Mint Rubber


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

PostPosted: Thu Apr 23, 2020 5:41 am    Post subject: Reply with quote

Here's something i threw together really quick:
Code:

namespace eval ChanSet {

   bind pub n|n .chanset [namespace current]::chanset
   
   proc chanset {nick uhost hand chan text} {
      if {[scan $text {%s%s} mode value] < 1} {
         puthelp "NOTICE $nick :Error, usage: $::lastbind +/-<channel mode> \[value\]"
         return
      }
      if {![string last - $mode]} {
         set what [string map {- ""} $mode]
      } else {
         set what [string map {+ ""} $mode]
      }
      if {[catch {channel get $chan $what} err]} {
         puthelp "NOTICE $nick :Error, \002$what\002 is an unkown channel setting."
         return
      }
      if {[info exists value]} {
         channel set $chan $mode $value
         puthelp "NOTICE $nick :Channel mode $what has been set to $value"
      } else {
         channel set $chan $mode
         puthelp "NOTICE $nick :Channel mode $what has been set to [expr {[string first + $mode] > -1 ? "enabled" : "disabled"}]."
      }
   }
}

_________________
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
Zohaib
Voice


Joined: 18 May 2011
Posts: 22

PostPosted: Fri Apr 24, 2020 1:40 am    Post subject: Reply with quote

Thanks a lot guys. I m going to give it a go. I really appreciate you guys your help means a lot to us. Thanks once again
_________________
<Zohaib>
Back to top
View user's profile Send private message
Zohaib
Voice


Joined: 18 May 2011
Posts: 22

PostPosted: Fri Apr 24, 2020 3:29 am    Post subject: Reply with quote

caesar wrote:
snip


thanks for your help.
there was a small problem for me as it was working for mode value of 2 digits only

Quote:
<@Zohaib> .set #me ap:limit +3
-XmIRC- Channel mode for #me ap:limit has been set to +3


But when i tried it for a bigger value command i.e
Quote:
<@Zohaib> .set #me ap:cjoin 3:2 120 kb 2
-XmIRC- Channel mode for #me ap:cjoin has been set to 3:2

it was not reading and setting the whole value for it so i modified it a bit
Code:

namespace eval ChanSet {

   bind pub n|n .set [namespace current]::chanset
   
   proc chanset {nick uhost hand chan text} {
   set chan [lindex $text 0]
   set mode [lindex $text 1]
   set value [lrange [split $text] 2 end]
      if {![string last - $mode]} {
         set what [string map {- ""} $mode]
      } else {
         set what [string map {+ ""} $mode]
      }
      if {[catch {channel get $chan $what} err]} {
         puthelp "NOTICE $nick :Error, \002$what\002 is an unkown channel setting."
         return
      }
      if {[info exists value ]} {
         channel set $chan $mode $value
         puthelp "NOTICE $nick :Channel mode for $chan $what has been set to $value"
      } else {
         channel set $chan $mode
         puthelp "NOTICE $nick :Channel mode for $chan $what has been set to [expr {[string first + $mode] > -1 ? "enabled" : "disabled"}]."
      }
   }
}


And now it is working like a Charm

thanks a lot for your help. Now problem is with the enable disable option and i m trying to fix it. i will post the next update as i fix it thanks once again
_________________
<Zohaib>
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Fri Apr 24, 2020 4:37 am    Post subject: Reply with quote

Here's a quick fix for the previous code to work with 'ap:cjoin 3:2 120 kb 2' or whatever you want to throw at it:
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."
      }
   }
}

Edit: Added some extra stuff. Wink
_________________
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
Zohaib
Voice


Joined: 18 May 2011
Posts: 22

PostPosted: Fri Apr 24, 2020 6:27 am    Post subject: Reply with quote

Now this looks yummy 😋 😋
_________________
<Zohaib>
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