mIRC Home    About    Download    Register    News    Help

Print Thread
#257939 25/05/16 03:43 AM
Joined: Apr 2016
Posts: 86
B
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) ?

Joined: May 2015
Posts: 249
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!
Joined: Apr 2016
Posts: 86
B
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....

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
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
Joined: Apr 2016
Posts: 86
B
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

Joined: Jun 2015
Posts: 84
F
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.

Joined: Dec 2008
Posts: 1,515
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,515
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 <-
Joined: Jun 2015
Posts: 84
F
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.

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

Link Copied to Clipboard