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 

how to solve this .chanset #chan +/-

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


Joined: 31 Jul 2010
Posts: 13

PostPosted: Thu Aug 19, 2010 10:54 am    Post subject: how to solve this .chanset #chan +/- Reply with quote

the syntax +/-bmotion is for example to this script and maybe used for other script too.
the use of this is just to msg the bot to do the chanset thing for the script to work on every channel..and no need to go to partyline or telnet the bot..

been bugging me for a couple of days but i can't get it to work.

Code:
#syntax:/msg bot chanset channel +/-bmotion



bind msg n set chan

proc chan {nick host hand text} {

   set chan [lindex split $text] 0]

   if {![string length $chan]} {

      putserv "PRIVMSG $nick :no specified channel."

   }

   if {[validchan $chan]} {

      if {[channel get $chan "active"]} {

         channel set $chan +bmotion

      }
     
     channel set  $chan +bmotion

      putserv "PRIVMSG $nick :$chan bmotion activated."

      return 0

   }

   

}


Last edited by Angel on Thu Aug 19, 2010 3:27 pm; edited 3 times in total
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Thu Aug 19, 2010 11:02 am    Post subject: Reply with quote

Okay, I see two issues right off the bat. First one is that you have named your proc the name of an already existing proc. I have done this several times myself. "Chanset" is already a dcc command, so that could very well be messing things up for you. Avoid using pre-existing command names for your procs.

Issues two I see is this:
Code:
channel chanset $chan


"Channel chanset" is not a tcl command. I assume you meant to do something like:
Code:
channel set $chan -/+setting
, like you did the first time, when you turned off inactive chanset.
Back to top
View user's profile Send private message
Angel
Voice


Joined: 31 Jul 2010
Posts: 13

PostPosted: Thu Aug 19, 2010 11:54 am    Post subject: Reply with quote

Code:
#syntax:/msg bot chanset channel +/-bmotion



bind msg n set chan

proc chan {nick host hand text} {

   set chan [join [lindex [split $text] 0]]

   if {![string length $chan]} {

      putserv "PRIVMSG $nick :no specified channel."

      return 0

   }

   if {[validchan $chan]} {

      if {[channel get $chan "inactive"]} {

         channel set $chan -inactive

         return 0

      }

      putserv "PRIVMSG $nick :$chan bmotion activated."

      return 0

   }

   channel set  $chan +/-setting

}


already edited but still error and not working Sad

got a headache now figuring out what is wrong

help please
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Aug 19, 2010 1:28 pm    Post subject: Reply with quote

A few more things to fix:
  • lindex returns a single list item, not a list. Don't use join here.
  • Whenever you call return, the proc will immediately exit without running the following code. Thus, if the channel is +inactive, it will be set -inactive, but the rest of the code will not be executed. If the channel is already -inactive, it will print the "bmotion activated" message and then exit, not executing the channel set command further down.
  • "+/-setting" is not a valid channel setting, enter the actual setting you are trying to alter (perhaps +bmotion ?).

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Angel
Voice


Joined: 31 Jul 2010
Posts: 13

PostPosted: Thu Aug 19, 2010 1:43 pm    Post subject: Reply with quote

so what will be the coding then?

Code:
#syntax:/msg bot chanset channel +/-bmotion



bind msg n set chan

proc chan {nick host hand text} {

   set chan [split $text] 0]]

   if {![string length $chan]} {

      putserv "PRIVMSG $nick :no specified channel."

   }

   if {[validchan $chan]} {

      if {[channel get $chan "active"]} {

         channel set $chan -inactive

         return 0

      }
     
     channel set  $chan +bmotion

      putserv "PRIVMSG $nick :$chan bmotion activated."

      return 0

   }

   

}



i hope i ddidn't screw the whole yet on this 1....
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Aug 19, 2010 1:48 pm    Post subject: Reply with quote

Code:
set chan [split $text] 0]]

You lost the lindex command, and you've got a stray ] at the end of the line:
Code:
set chan [lindex [split $text] 0]


Code:
if {[channel get $chan "active"]} {
  channel set $chan -inactive
  return 0
}

This will still cause the script to end before the channel is set +bmotion in case it's set +inactive. It is set -inactive however. I'm not sure if this is the behaviour you intended?
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Angel
Voice


Joined: 31 Jul 2010
Posts: 13

PostPosted: Thu Aug 19, 2010 3:28 pm    Post subject: Reply with quote

first post i edited....

deleted some return added lindex and +bmotion i hope it will do it
Back to top
View user's profile Send private message
Luminous
Op


Joined: 12 Feb 2010
Posts: 146

PostPosted: Thu Aug 19, 2010 3:39 pm    Post subject: Reply with quote

I was a tab unclear myself... looks like nml got it though.
Back to top
View user's profile Send private message
Angel
Voice


Joined: 31 Jul 2010
Posts: 13

PostPosted: Fri Aug 20, 2010 6:45 am    Post subject: Reply with quote

can someone pls post the final coding of this script please
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