| View previous topic :: View next topic |
| Author |
Message |
Angel Voice
Joined: 31 Jul 2010 Posts: 13
|
Posted: Thu Aug 19, 2010 10:54 am Post subject: how to solve this .chanset #chan +/- |
|
|
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 |
|
 |
Luminous Op
Joined: 12 Feb 2010 Posts: 146
|
Posted: Thu Aug 19, 2010 11:02 am Post subject: |
|
|
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 |
|
 |
Angel Voice
Joined: 31 Jul 2010 Posts: 13
|
Posted: Thu Aug 19, 2010 11:54 am Post subject: |
|
|
| 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
got a headache now figuring out what is wrong
help please |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Aug 19, 2010 1:28 pm Post subject: |
|
|
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 |
|
 |
Angel Voice
Joined: 31 Jul 2010 Posts: 13
|
Posted: Thu Aug 19, 2010 1:43 pm Post subject: |
|
|
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 |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Aug 19, 2010 1:48 pm Post subject: |
|
|
| 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 |
|
 |
Angel Voice
Joined: 31 Jul 2010 Posts: 13
|
Posted: Thu Aug 19, 2010 3:28 pm Post subject: |
|
|
first post i edited....
deleted some return added lindex and +bmotion i hope it will do it |
|
| Back to top |
|
 |
Luminous Op
Joined: 12 Feb 2010 Posts: 146
|
Posted: Thu Aug 19, 2010 3:39 pm Post subject: |
|
|
| I was a tab unclear myself... looks like nml got it though. |
|
| Back to top |
|
 |
Angel Voice
Joined: 31 Jul 2010 Posts: 13
|
Posted: Fri Aug 20, 2010 6:45 am Post subject: |
|
|
| can someone pls post the final coding of this script please |
|
| Back to top |
|
 |
|