mIRC Home    About    Download    Register    News    Help

Print Thread
#255207 29/09/15 06:40 PM
Joined: Jan 2015
Posts: 10
M
Mandarb Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jan 2015
Posts: 10
Hello,

I think I'm to dense to get my scripts to listen to and act upon raw data. Yes, it has to do with Twitch whisper functions. I know how to send a whisper back to twitch, and I can also see whispers send to my bot in that @raw window ( //window -e @raw | debug @raw )

On of those messages looks like that in the moment:

<- @color=#008000;display-name=Doctor_Mandarb;emotes=;message-id=45;thread-id=40900786_63581763;turbo=0;user-id=40900786;user-type= :doctor_mandarb!doctor_mandarb@doctor_mandarb.tmi.twitch.tv WHISPER nurse_bot :!Test

What I'd love my script do to, is to pick up on the !Test and continue to run whatever it is I script into it laugh

I hope somebody has found a way to listen and act upon that debug window data. Otherwise, my Bot will have to listen to normal send text commands, and answer back with a whisper to keep the chat a bit less spammed laugh

Thanks a lot,
Mandarb

Mandarb #255208 29/09/15 07:38 PM
Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
mIRC recently added a new event, on parseline, it triggers for any line sent and received by/to the IRC server, you are forced to use that since the whisper message are not part of the IRC protocol.

Basic stuff:

Code:
on *:parseline:in:* WHISPER *:{
echo -s rcvd: $parseline
}


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Wims #255226 01/10/15 05:07 AM
Joined: Jan 2015
Posts: 10
M
Mandarb Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jan 2015
Posts: 10
Good morning,

sorry for takeing so long to get back. I did implement your answer into mIRC and it worked. But... now I've got 2 more questions.

Currently I load a variable with the rcvd: $parseline and store that data as a string. Then I perform some string manipulation ... count, search etc ... to get 2 information out of that string: display-name=Doctor_Mandarb and !Test

While the display-name is then discarded with some more string manipulation... I'm wondering if there is a more effective & efficient way to get to that data (without lines and lines of string manipulation???

That was the 1. question, now the 2nd question.

on *:parseline:in:* WHISPER *:{

I'm looking for WHISPER within the parseline (raw data) and it works... however is there a way to look for WHISPER and another word, in this case the !test ???

I didn't have much time yesterday to try anything on that part, and now I'm back at work. But before I run into a wall of my own clumsiness in scripting, I thought I ask if looking for WHISPER & !Test is actual possible. Perhaps some form of wildcard match?

Thanks for your time, and keep up the good work!

Greetings,
Mandarb

Mandarb #255227 01/10/15 08:02 AM
Joined: Oct 2014
Posts: 35
M
Ameglian cow
Offline
Ameglian cow
M
Joined: Oct 2014
Posts: 35
For the 1st one you can use $msgtags(display-name).key to get the display-name.(I think that's what you were asking about :P)

For the 2nd you can use; on *:parseline:in:*whisper*!test*:


Matti
MattiSony #255228 01/10/15 10:13 AM
Joined: Jan 2015
Posts: 10
M
Mandarb Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jan 2015
Posts: 10
Thanks,
I'll try it out tonight. From the looks of it, I'm sure it will work smile I'll let you know how it turned out smile

Mandarb #255229 01/10/15 10:37 AM
Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
A script that completely handles twitch's whispers for the user:

http://hawkee.com/snippet/16489/


I am SReject
My Stuff
FroggieDaFrog #255236 01/10/15 06:10 PM
Joined: Jan 2015
Posts: 10
M
Mandarb Offline OP
Pikka bird
OP Offline
Pikka bird
M
Joined: Jan 2015
Posts: 10
Thank you all for your help.

I'm sure Froggie that your script will run fine, I didn't test it yet, because with Matti's solution my scripts run well enough right now:

On Text

on *:TEXT:!Test:#doctor_mandarb: {
if ($nick == doctor_mandarb) {
; Whatever the command is doing
}
}

On Whisper

on $*:PARSELINE:in:*WHISPER*!test*:{
var %nick $msgtags(display-name).key
if (%nick == doctor_mandarb) {
; Whatever the command is doing
}
}

Since it's only 1 extra line to grab the nick (when it's a whisper command), I don't need to rewrite a lot and can keep my scripts more or less how they are.

Not that I'm going to change to much, but a few of those bot reactions did spam to much on my channel.

Thanks again to Wims for rcvd: $parseline !!! That one does come in handy too, when looking for certain other things within the string.

Again much thanks to all for the quick answers. That did save me some time, and now I can use the weekend to focus on the scripts and commands themself.

Greetings,
Mandarb


Link Copied to Clipboard