mIRC Home    About    Download    Register    News    Help

Print Thread
#264736 08/01/19 10:14 PM
Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
So whenever someone dose /me on Twitch it makes the text colored. But my bot doesnt pick up on any colored text and i dont know how to add that to "on *:text:*"

My other question is how do i do two " on *:text:" inside 1 bracket other wise it'll just underline the text in brown

TroyL #264737 08/01/19 10:52 PM
Joined: Nov 2009
Posts: 295
P
Fjord artisan
Offline
Fjord artisan
P
Joined: Nov 2009
Posts: 295
That's because /me isn't text, it's an action.

on *:action:*:#:

As for the second question I'm guessing you mean checking for two different bits of text. In that case you should use an if/elseif statement. Something like

on *:text:*:#: {
if ($1 == hello) /msg $chan hello $nick
elseif ($1 == bye) /msg $chan bye $nick
}

Last edited by pball; 08/01/19 10:55 PM.

http://scripting.pball.win
My personal site with some scripts I've released.
TroyL #264738 08/01/19 10:53 PM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
The event colors are shown in the alt+k window, where you can change which colors happen for different events.

By default, echo messages show in 'own' color, so they do the equivalent of:

//echo -tli2c own $chan $str(long message,30)

If you want a message to use the color for action, substitute 'action' in place of 'own'. (That parameter is valid here only with the -c switch)

If you want part of the message to be in a different color, you can use control codes as described here: /help Control Codes

If you want to put the color for the action event in the middle of a message, you can use $color(action).dd in place of the number you'd otherwise place following the Ctrl+K.

If you press Ctrl+U to place the underline or the other control codes into your message, that can be hard to see in the editor, so you sometimes people using $chr(number) instead of those hotkeys. You can find the correct number to use by putting the Ctrl+U symbol inside $asc() to find the ascii character, and find that the numbers to use can also be:

Ctrl+B -> $chr(2)
Ctrl+U -> $chr(31)
Ctrl+R -> $chr(22)
Ctrl+K -> $chr(3)
Ctrl+I -> $chr(29)
Ctrl+O -> $chr(15)

Edit: I should've said the default echo was 'normal' not 'own'

Last edited by maroon; 09/01/19 12:02 AM.
TroyL #264739 08/01/19 11:05 PM
Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
Awesome thank you both! Another question i have is how do i set a variable to someones nickname on twitch?

TroyL #264740 08/01/19 11:14 PM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
see /help /set

note that /set is for setting global variables that exist until deleted, while /var creates temporary variables that exist only within the alias where they're created.

maroon #264741 08/01/19 11:43 PM
Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
ok thank you and i know this is off topic but im working on a ban script where mods can use the !ban command to add it to the ban list on my bot but this isnt working so i was wondering why it isnt?

Code:
*// BAN LIST //*
on *:text:*!ban*:#troyl:{
  if (($nick isOP #)) {
    msg $chan /ban $2 $3
    /set %banned = $2 
    }
    }
    on *:text:*:#troyl:{
    if ($nick == %banned) 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.. 
}

TroyL #264742 08/01/19 11:52 PM
Joined: Feb 2011
Posts: 448
K
Pan-dimensional mouse
Offline
Pan-dimensional mouse
K
Joined: Feb 2011
Posts: 448
Fixed the syntax. You can't have events (OnText, OnAction, and others) inside of other events.

Code:
; *// BAN LIST //*
on *:text:*!ban*:#troyl:{
  if (($nick isOP $chan)) {
    msg $chan /ban $2 $3
    set %banned = $2 
  }
}

on *:text:*:#troyl:{
  if ($nick == %banned) {
    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.. 
  }
}

KindOne #264743 09/01/19 12:04 AM
Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
2 things

1. It Still isnt banning the person after using !ban then unbanning them and telling them to say something
2.How would i remove them from the ban list

Code:
on *:text:*!ban*:#troyl:{
  if (($nick isOP $chan)) {
    msg $chan /ban $2 $3
    set %banned = $2 
  }
}

on *:text:*:#troyl:{
  if ($nick == %banned) {
    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.. 
  }
}
on *:text:*!unban*:#troyl:{
  if (($nick isOP $chan)) {
    msg $chan /unban $2
    unset %banned $nick 
  }
}

TroyL #264746 09/01/19 03:04 AM
Joined: Dec 2018
Posts: 53
T
TroyL Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Dec 2018
Posts: 53
any help on this?

TroyL #264749 09/01/19 07:15 AM
Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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.

Link Copied to Clipboard