mIRC Home    About    Download    Register    News    Help

Print Thread
#257939 25/05/16 03:43 AM
B
Bestpeff
Bestpeff
B
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) ?

Joined: May 2015
Posts: 245
S
Fjord artisan
Offline
Fjord artisan
S
Joined: May 2015
Posts: 245
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".

B
Bestpeff
Bestpeff
B
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....

Joined: Jul 2006
Posts: 4,020
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,020
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


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
B
Bestpeff
Bestpeff
B
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

F
Fonic_Artes
Fonic_Artes
F
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.

Joined: Dec 2008
Posts: 1,483
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,483
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

F
Fonic_Artes
Fonic_Artes
F
Odd, it's worked fine for me when I've done it like that, but I'll make the changes.

Joined: Apr 2010
Posts: 964
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 964
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.

Link Copied to Clipboard