1. probably not your problem, but you have match text parameter listed like

:*!ban*:

This means it matches even if the string is not the 1st word, and even if the string is the first word, could be matching !bank tali!ban etc. You probably want to match:

:!ban & *:

... which requires the 1st word be !ban and requires there be at least 2 words. If it needs to be exactly 3 words, change that * to another ampersand.

2. Incorrect syntax with the /set command resulting in "/set %foobar = test" the contents of %foobar containing the equals sign. Valid syntax styles include:

set %foobar test
var %foobar test
var %foobar = test
%foobar = test

Without the -l or -g switches, the existence of local var %foobar causes /set to update the local var without altering the global var of the same name. I dislike the last one, because it disguises whether the intent was to create/update a local or global var.

if "var %foobar string1" were to precede "set %foobar string2", the /set command is altering the local variable, and the change vanishes as soon as the alias/event ends.

3. When debugging a script, it's often needed to add debug messages so you can see what you really told the script to do when the command contains $identifiers or %variables. If you have a command that's not working, add a debugging echo to the status window so a no-action or an error message are preceded by the debug message. You can also precede the if() conditional with the items being compared, to see why the condition didn't branch correctly. So in your case, your script would be edited to contain 1 or more of these debug lines:

Code:
on *:text:*!ban*:#troyl:{
echo -s line $scriptline script $script debug: $nick vs # line: $1-
  if (($nick isOP $chan)) {
echo -s line $scriptline script $script debug command: msg $chan /ban $2 $3
echo -s line $scriptline script $script debug: % $+ banned contains: %banned
    msg $chan /ban $2 $3
    set %banned = $2 
  }
}

on *:text:*:#troyl:{
echo -s line $scriptline script $script debug: $nick vs %banned line: $1-
  if ($nick == %banned) {
echo -s line $scriptline script $script debug: if() conditional branched $true
    msg $chan /ban $nick You have been put on the permanent ban list on TroyBot. A manual unban can not be done. If you have a question regarding why you were banned please contact a moderator.. 
  }
}


This can create a lot of clutter while you're debugging, but can save a lot of time figuring out what's wrong, and just as important can tell you where the problem is NOT. The mention of the script line and name makes it easier to see status window messages for debug messages which should have been removed after something is fixed.

In your example, the %banned variable containing "= nickname" would never match because a nick will never begin with an equals and a space.

Sometimes fixing the problem doesn't make everything work, it can merely expose a different problem which had not been executed due to the first problem.

4. some items have more detailed help and examples for them at the Wikichip link on the help page. There's a box at the right side of every page containing links that can take you to the entire wiki within a couple links. There's a page for every variable and identifier, as well as general topics such as "variables". Also just as important are the links at the bottom of the pages that may include helpful links to other relevant commands.

5. Beware that twitch chose not to conform to the IRC standard, so there might be a few commands such as /msg requiring different syntax. At a 'real' server, the command 'msg $chan /ban $2 $3' would result in a chat message being displayed into channel where the first word is "/ban" including the slash. For example I have no idea whether you're really using the right syntax for the server command "ban".

6. The way you're using /set the %banned variable can only ever contain 1 nick, as if only 1 person can be banned. You can use $addtok and $deltok to add and remove nicks from a list of nicks without touching all the other nicks.

Last edited by maroon; 09/01/19 07:16 AM.