mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jun 2015
Posts: 84
F
Babel fish
OP Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
Alright, so what I have here is the attempt at overturning the changes to hosting recently by Twitch.

I was wondering if it's possible to call specific variables by the alias provided below.

Code:
alias targetStatus {
  if (!$1) { return }
  var %j = targetStatus
  JSONOpen -ud %j https://api.twitch.tv/kraken/streams/ $+ $1 $+ ?= $+ $ticks
  var %targetStatus = $json(%j,stream)
  if (%targetStatus) { set %gTargetStatus Online }
  if (!%targetStatus) { unset %gTargetStatus | /timer[TARGET_STATUS] off | msg %hostChan .unhost | unset %host*  }
  return %targetStatus
}


I want to call that variable on a per channel basis, specifically if this is running in multiple channels so it would have

Code:
%hostChan.#chan1 #chan1
%hostChan.#chan2 #chan2
ect.


So I want to check if the host of #chan1 is offline, and it is, so I need to send an .unhost to #chan1.

Can I call specific channels like that?

Also, in my current code (rough form) I'm aware that /unset %host* will unset all the %host variables.

If I can get pointed in the right direction I can make it all work, it's more of an understanding thing on my part.

Joined: Apr 2010
Posts: 969
F
Hoopy frood
Offline
Hoopy frood
F
Joined: Apr 2010
Posts: 969
It depends on where this is getting called from.

If its coming from an on join, on part or on text event $chan/# is available from within the alias.

If the variable(s) are set a global variables they are also available


I am SReject
My Stuff
Joined: Jun 2015
Posts: 84
F
Babel fish
OP Offline
Babel fish
F
Joined: Jun 2015
Posts: 84
Yes, I was wanting to call it from a global variable on a timed event where I run a target channel via that, and if the channel was offline, send a message to the channel of the hoster to unhost.

Example
I host MANvsGAME and he keeps streaming.
My script runs and checks to see if he's offline or not.
He eventually goes offline and my scripts reads as so.
I have it where I can checks the channel just fine.
My issue is needing to send the message to my channel from the variable.

Global variables would be
%hostChan.#fonic_artes #fonic_artes
%hostTarget.#fonic_artes manvsgame

It can call %hostTarget.#fonic_artes fine, but I'm not entirely sure on how to make it call %hostChan.#fonic_artes to send the unhost message.

That's what I just need a little help with to get into the right direction. I can then just make it work in a way to unset only the variables of that channel.


Link Copied to Clipboard