mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Oct 2016
Posts: 14
F
Pikka bird
OP Offline
Pikka bird
F
Joined: Oct 2016
Posts: 14
I have a variable in vars.ini that is:
Code:
%#channel.currency_name gem

and I'm trying to make it so that the events related to the currency change depending on that:

Just so each channel can name their currency differently

Code:
alias -l curr return $($+(%,$chan,.,currency_name),2)

; This does return gem as it should

; $(! $+ $($curr) $+ s)
; does return !gems as it should .. but the chat only reacts
; to !s .. the gem part is not included

ON *:TEXT:$(! $+ $($curr) $+ s):#:{
  var %topic $+($chan,.,$nick)
  msg # $nick has $readini(Points.ini,%topic,Points) total $curr $+ s.
}

Am I going about this the wrong way?

Joined: Oct 2016
Posts: 14
F
Pikka bird
OP Offline
Pikka bird
F
Joined: Oct 2016
Posts: 14
I found out that I could not use a dynamic variable as the search text in ON (from what I understand), but it is fine to compare things to it in if statements, so I managed to make a workaround:
Code:
; OP can change currency name for this channel or clear it without using an argument
ON *:TEXT:!currency*:#:{
  if ( $nick !isop $chan ) halt
  if ( $2 == $null ) {
    unset %currency_name. [ $+ [ $chan ] ]
    echo -a currency reset to default
  }
  else {
    set %currency_name. [ $+ [ $chan ] ] $2
    echo -a currency set to $2
  }
}

;just so you can get the currency name with $curr at any time
alias -l curr return %currency_name. [ $+ [ $chan ] ]

ON *:text:*:#:{
  ;get the point name for this channel, if $null then use the default "points"
  var %curr $curr
  if ( %curr == %null ) %curr = points
  
  if ( $( ! $+ %curr ) == $1 ) {

    if ( $2 == $null ) {
      msg $chan $nick got $lookUpPoints %curr
    }
    elseif ( ($2 == add) || ($2 == remove) ) {
      ;command <add|remove> user value
      $pointsValue( $2 , $3 , $4 )
    }
  }
}


Just posting the code in case someone else want to do something like this (if there is some better way to do this then please tell)

Last edited by FoxInABox; 27/10/16 02:20 AM.
Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Code:
%null
prob $null.
Why not to make a single on-text instead of 2 or more?
Code:
isop
can cause some errors at Twitch.


Dont give a fish - teach to fish!
Joined: Oct 2016
Posts: 14
F
Pikka bird
OP Offline
Pikka bird
F
Joined: Oct 2016
Posts: 14
Thanks, will fix that typo right away.

Well, I could merge all of them, making a lot of if checks for the strings, but I don't know if it is better or worse, have not seen anyone else that have taken that approach so far, so why should I merge them? .. I only had a few commands that needed to check for the currency name.

Hm, isop seem to work fine so far, but to be safe I guess I can swap it out with:
Code:
$nick == $right( $chan , -1 )


I'm a bit new to this, but I got a goal that I'm working towards ^^ so any input is much appreciated.

EDIT: seems that if one ON text triggers, then none of the below ON text's will do so..

Last edited by FoxInABox; 27/10/16 07:30 PM.
Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Code:
$right( $chan , -1 )
is only for streamer, while "isop" was for moderators too. Check this: https://discuss.dev.twitch.tv/t/twitch-ircv3-tags/4450


Dont give a fish - teach to fish!

Link Copied to Clipboard