mIRC Home    About    Download    Register    News    Help

Print Thread
(Twitch) Help with $msgtags #257939 25/05/16 03:43 AM
Joined: Apr 2016
Posts: 86
B
Bestpeff Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2016
Posts: 86
How do I replace $msgtags(display-name).key in so that it could register another string as like $1 , $2 , $3 , etc....? Like $1($msgtags(display-name).key) ?

Re: (Twitch) Help with $msgtags [Re: Bestpeff] #257940 25/05/16 03:50 AM
Joined: May 2015
Posts: 249
splinny Offline
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Not sure if i understand you correctly, but try "/tokenize 32 bla bla something". That will return $1 and $2 as "bla", and $3 as "something".


Dont give a fish - teach to fish!
Re: (Twitch) Help with $msgtags [Re: splinny] #257941 25/05/16 03:53 AM
Joined: Apr 2016
Posts: 86
B
Bestpeff Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2016
Posts: 86
For scripts I replace $nick with $msgtags(display-name).key so it can display the right Twitch username with the correct capitalization (looks a bit more professional). But I was wonder how to do the same with $1 , $2 , $3 , etc....

Re: (Twitch) Help with $msgtags [Re: Bestpeff] #257946 25/05/16 02:35 PM
Joined: Jul 2006
Posts: 3,829
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,829
The same what? That you use $msgtags() to get the twitch username instead, that's making a lot of sense and that's fine, but about $1 etc, you are not making any sense, please elaborate, eventually gives some examples


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: (Twitch) Help with $msgtags [Re: Wims] #257956 26/05/16 04:36 AM
Joined: Apr 2016
Posts: 86
B
Bestpeff Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Apr 2016
Posts: 86
If you're trying to target a user like for instance this script right here:

on 1:connect: { raw CAP REQ :twitch.tv/membership }

on 1:text:*subscribed*:#mattachewowns:{
if ( $nick == twitchnotify ) && ($istok($1-,subscribed to,32)) halt
elseif ($nick == twitchnotify) && ( $4 == $null ) { describe $chan chewH $1 has just subscribed! chewHype }
elseif ($nick == twitchnotify) && ( $4 isnum ) { describe $chan chewH $1 has subscribed for $4 months in a row! chewHype }
}


I need the $1 to have the right $msgtag but have no idea how. I did $msgtag with replacing $nick but don't know how to do it with replacing $1

Re: (Twitch) Help with $msgtags [Re: Bestpeff] #257957 26/05/16 04:40 AM
Joined: Jun 2015
Posts: 84
F
Fonic_Artes Offline
Babel fish
Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
In your example there, twitchnotify already does proper capitalization.

In this case, trying to target a user won't always get a $msgtag, but instead I'd make an API call for it.

Code:
 alias displayName {
  var %j = followUser_ $+ $ticks
  JSONOpen -ud %j https://api.twitch.tv/kraken/channels/ $+ $1 $+ ?= $+ $rand(1,1000000)
  var %displayName = $json(%j,display_name)
  return %displayName
}


When you want to use it, just do $displayName($nick) or anything that needs to go in that spot in place of $nick.

Re: (Twitch) Help with $msgtags [Re: Fonic_Artes] #257961 26/05/16 02:27 PM
Joined: Dec 2008
Posts: 1,512
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,512
You've forget to add 'nocache' into the calling url, if i saw correctly.

Use:
Code:
JSONOpen -ud %j https://api.twitch.tv/kraken/channels/ $+ $1 $+ ?nocache= $+ $ticks


Need Online mIRC help or an mIRC Scripting Freelancer? -> https://irc.chathub.org <-
Re: (Twitch) Help with $msgtags [Re: westor] #257964 27/05/16 04:00 AM
Joined: Jun 2015
Posts: 84
F
Fonic_Artes Offline
Babel fish
Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
Odd, it's worked fine for me when I've done it like that, but I'll make the changes.

Re: (Twitch) Help with $msgtags [Re: westor] #257967 27/05/16 02:12 PM
Joined: Apr 2010
Posts: 966
F
FroggieDaFrog Offline
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 966
AFAIK twitch usernames do not change often, a cached copied is fine (and probably preferred*) for this scenario. Though really, as long as the URL has some randomness to it a cached copy will not be used.

Each of the following are valid, assuming there aren't more parameters after
Code:
http://example.com?1234
http://example.com?=1234
http://example.com?nocache=1234


*: Cuts done on bandwidth and speeds things up because a local, cached, copy will be used if present

Last edited by FroggieDaFrog; 27/05/16 02:15 PM.

I am SReject
My Stuff