mIRC Home    About    Download    Register    News    Help

Print Thread
Separating points in different channels [Twitch] #253563 20/06/15 08:13 AM
Joined: Feb 2015
Posts: 12
S
Scootycoolguy Offline OP
Pikka bird
OP Offline
Pikka bird
S
Joined: Feb 2015
Posts: 12
Hey

I know how to separate basic commands into different channels
Code:
 on *:TEXT:*:#:{
    if ($1 == !test) {
      if ($chan == #example1) {
        msg $chan example 1 test success
      }
      if ($chan == #example2) {
        msg $chan example 2 test success
      }
    }
  }

but my problem is that if I wanted to separate loyalty points from 2 different channels so they don't overlap, how would one go about doing so?

I was thinking making a completely new Points.ini, but that wont stop from both channels to add up both versions of points.


Everything I have tried has made it so the entire points system doesnt work at all.


I know this code is a bit outdated from the new twitch features, but I will deal with that later.

Click to reveal..

Code:
on !*:join:#:{
  var %not_nicks = dreightbit nightbot
  if ($istok(%not_nicks,$nick,32)) { return }
  $+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}
alias -l addPoints {
  if ($1 !isnum) { echo 2 -st $1 is not a number. It needs to be a number. | halt }
  var %topic $+($chan,.,$nick)
  var %points $calc($readini(Points.ini,%topic,Points) + $1)
  writeini -n Points.ini %topic Points %points
  return %points
}
alias -l lookUpPoints {
  var %topic $+($chan,.,$nick)
  var %points $readini(Points.ini,%topic,Points)
  return %points
}
alias doaddpoints {
  if ($3 !isnum) { echo 2 -st $3 is not a number. It needs to be a number. | halt }
  var %topic $+($1,.,$2)
  var %points $calc($readini(Points.ini,%topic,Points) + $3)
  writeini -n Points.ini %topic Points %points
  echo -a Added points for %topic
}
alias dorempoints {
  var %topic $+($1,.,$2)
  remini -n Points.ini %topic Points
  echo -a Removed points for %topic
}
on *:text:!rice:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  if ($readini(Points.ini,$+(#,.,$nick),Points) > 0) {
    msg # $nick has a total of $readini(Points.ini,$+(#,.,$nick),Points) grains of rice!
  }
  else { msg # Sorry but the bot could not find you any rice grains on file! }
}
on $*:text:/!rice (add|remove)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !rice <add|remove> <user> [number] | return }
    writeini -n Points.ini $+(#,.,$3) Points $calc($readini(Points.ini,$+(#,.,$3),Points) $iif($2 == add,+,-) $iif($4 isnum,$4,1))
    { msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total grains of rice! }
  }
  else { msg $chan This command is only available to moderators. }
}



Thanks.

Last edited by Scootycoolguy; 20/06/15 08:14 AM.
Re: Separating points in different channels [Twitch] [Re: Scootycoolguy] #253564 20/06/15 08:20 AM
Joined: May 2015
Posts: 249
splinny Offline
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Obviously, you need to use $chan as additional parameter for all user-related stuff (At least add $chan to timers names and store points for $chan in [$chan] section of .ini file, so you will need send $chan to aliases (like doaddpoint user1 #channel1) to make them know which section do they need to update for specified user).


Dont give a fish - teach to fish!
Re: Separating points in different channels [Twitch] [Re: splinny] #253565 20/06/15 09:08 AM
Joined: Feb 2015
Posts: 16
U
UnDeadPuff Offline
Pikka bird
Offline
Pikka bird
U
Joined: Feb 2015
Posts: 16
Code:
for convenience, i'll name channel 1 #chan1 and channel 2 #chan2

on *:TEXT:*:#:{
    if ($1 == !test) {
      if ($chan == #chan1) {
        msg #chan1 example 1 test success
      }
      if ($chan == #chan2) {
        msg #chan2 example 2 test success
      }
    }
  }


I think it works, not a mirc specialist at all.

Re: Separating points in different channels [Twitch] [Re: UnDeadPuff] #253566 20/06/15 09:43 AM
Joined: May 2015
Posts: 249
splinny Offline
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
Originally Posted By: UnDeadPuff
I think it works, not a mirc specialist at all.

You misread his problem, his example is same to yours but his problem is not about it.


Dont give a fish - teach to fish!