mIRC Homepage
Posted By: Bestpeff (Twitch) Help with $msgtags - 25/05/16 03:43 AM
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) ?
Posted By: splinny Re: (Twitch) Help with $msgtags - 25/05/16 03:50 AM
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".
Posted By: Bestpeff Re: (Twitch) Help with $msgtags - 25/05/16 03:53 AM
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....
Posted By: Wims Re: (Twitch) Help with $msgtags - 25/05/16 02:35 PM
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
Posted By: Bestpeff Re: (Twitch) Help with $msgtags - 26/05/16 04:36 AM
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
Posted By: Fonic_Artes Re: (Twitch) Help with $msgtags - 26/05/16 04:40 AM
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.
Posted By: westor Re: (Twitch) Help with $msgtags - 26/05/16 02:27 PM
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
Posted By: Fonic_Artes Re: (Twitch) Help with $msgtags - 27/05/16 04:00 AM
Odd, it's worked fine for me when I've done it like that, but I'll make the changes.
Posted By: FroggieDaFrog Re: (Twitch) Help with $msgtags - 27/05/16 02:12 PM
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
© mIRC Discussion Forums