mIRC Home    About    Download    Register    News    Help

Print Thread
Any idea what is wrong with this script? #259228 18/10/16 06:59 PM
Joined: Jan 2015
Posts: 168
P
powerade661 Offline OP
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
on *:text:!leave:#: {
These two are the parts that aren't working.
---> $remtok(%botchans, #, 1, 32)

if ($nick isin %botchans) {
msg $chan Leaving channel: $nick

---> elseif (%chan !isin %botchans) {
msg $chan I have already left your channel.
.part $chr(35) $+ $nick

Thank you for any help you can give me with this.

Re: Any idea what is wrong with this script? [Re: powerade661] #259286 28/10/16 01:54 PM
Joined: Aug 2016
Posts: 36
ruprecht Offline
Ameglian cow
Offline
Ameglian cow
Joined: Aug 2016
Posts: 36
This script isn't fixable as it doesn't make sense. There are syntax errors, and the code in the elseif section will never execute as the bot won't see the text if it's not in the channel. This is a rewrite based on what I believe you require:
Code:
on *:text:!leave:#: {
  if ($chan isin %botchans) {
    %botchans = $remtok(%botchans, $chan, 1, 32)
    msg $chan Leaving channel: Requested by $nick
    .timer 1 1 part $chan
  }
}


When someone types !leave in a channel if the channel is in the %botchans list the bot will remove the channel from the list and leave the channel.

Re: Any idea what is wrong with this script? [Re: ruprecht] #259300 02/11/16 08:32 AM
Joined: Aug 2008
Posts: 4
V
Vladabgd Offline
Self-satisified door
Offline
Self-satisified door
V
Joined: Aug 2008
Posts: 4
Shouldn't there be a check, who can issue command to a bot?
eg.
Code:
if (($chan isin %botchans)&&($nick isop $chan))

Re: Any idea what is wrong with this script? [Re: Vladabgd] #259304 03/11/16 02:16 AM
Joined: May 2015
Posts: 249
splinny Offline
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
or
Code:
if ($nick == $right($chan,-1))


Dont give a fish - teach to fish!