mIRC Homepage
Posted By: TheCanadian Need Help Points system. - 11/11/14 01:22 AM
My points system for a twitch bot does not seem to be working the commands are, I've also created a "Points.ini" file. I've checked several other points systems to try and figure out my problem but none of them work. I have a feeling it's to do with the join timer, but I could be wrong.
I'm running mIRC 7.36 on a windows 7 OS.

'''
;------------------------
;Points
;------------------------
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:!points:#:{
if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
set -u10 %floodpoints On
set -u30 %floodpoints. $+ $nick On
msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
}
on $*:text:/!points (add|remove)/Si:#:{
if ($nick isop #) {
if ($0 < 3) { msg # Insufficient parameters: Use !points <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 points. }
}
else { msg $chan This command is only available to moderators. }
}
on !*:join:#:{
$+(.timerpoints.,#,.,$nick) 0 120 add.pts $+(#,.,$nick)
add.pts $+(#,.,$nick)
if ((%floodjoin) || ($($+(%,floodjoin.,$nick),2))) { return }
set -u10 %floodjoin On
set -u30 %floodjoin. $+ $nick On
msg $chan $nick has joined and is now earning points.
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
if ((%floodpart) || ($($+(%,floodpart.,$nick),2))) { return }
set -u10 %floodpart On
set -u30 %floodpart. $+ $nick On
msg $chan $nick has left the channel and is no longer earning points.
}
'''
Posted By: westor Re: Need Help Points system. - 11/11/14 11:59 AM
Try using this code:

Code:
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:!points:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $iif($readini(Points.ini,$+(#,.,$nick),Points),$v1,0) total points.
}
on $*:text:/!points (add|remove|del)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <add|remove|del> <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 points. 
  }
  else { msg $chan This command is only available to moderators. }
}

ON !*:JOIN:#: {
  $+(.timerpoints.,#,.,$nick) 0 120 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
  if ((%floodjoin) || ($($+(%,floodjoin.,$nick),2))) { return }
  set -eu10 %floodjoin On
  set -eu30 %floodjoin. $+ $nick On
  msg $chan $nick has joined and is now earning points.
}

ON *:KICK:#: {
  if ($knick !== $me) {
    $+(.timerpoints.,#,.,$knick) off
    if ((%floodkick) || ($($+(%,floodkick.,$knick),2))) { return }
    set -eu10 %floodkick On
    set -eu30 %floodkick. $+ $nick On
    msg $chan $knick has left the channel and is no longer earning points.
  }
}

ON !*:QUIT: {
  $+(.timerpoints.,#,.,$nick) off
  if ((%floodquit) || ($($+(%,floodquit.,$nick),2))) { return }
  set -eu10 %floodquit On
  set -eu30 %floodquit. $+ $nick On
  msg $chan $nick has left the channel and is no longer earning points.
}

ON !*:PART:#: {
  $+(.timerpoints.,#,.,$nick) off
  if ((%floodpart) || ($($+(%,floodpart.,$nick),2))) { return }
  set -eu10 %floodpart On
  set -eu30 %floodpart. $+ $nick On
  msg $chan $nick has left the channel and is no longer earning points.
}

alias add.pts { if ($1) { writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1) } }


Also added when the user quit from IRC to stop point him and when the user kicked from the channel too.

NOTE: This kind of help is an script help so you have posted on an wrong forum next time please use the correct place to post.
Posted By: Nillen Re: Need Help Points system. - 11/11/14 02:55 PM
Twitch does not support features like QUIT and KICK. When you exit the application, it takes about 30 seconds until the channel registers that you're gone and triggers a PART event.

Just for reference smile
Posted By: TheCanadian Re: Need Help Points system. - 11/11/14 05:38 PM
A lot of people have this script and it works fine for them.
Posted By: westor Re: Need Help Points system. - 11/11/14 05:41 PM
Originally Posted By: TheCanadian
A lot of people have this script and it works fine for them.


Did you try the code i gave you is working ?

Nillen: thanks for definition did not know it :P
Posted By: TheCanadian Re: Need Help Points system. - 11/11/14 05:45 PM
The code works, But the timer isn't. after the 120 second timer is up they should have a point.

I checked my "Points.ini" file and nothing is happening there.
Posted By: westor Re: Need Help Points system. - 11/11/14 06:07 PM
On me it's working perfect, try use this code, i am sure that you have a duplicate of an alias.

Code:
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:!points:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $iif($readini(Points.ini,$+(#,.,$nick),Points),$v1,0) total points.
}
on $*:text:/!points (add|remove|del)/Si:#:{
  if ($nick isop #) {
    if ($0 < 3) { msg # Insufficient parameters: Use !points <add|remove|del> <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 points. 
  }
  else { msg $chan This command is only available to moderators. }
}

ON !*:JOIN:#: {
  $+(.timerpoints.,#,.,$nick) 0 120 adding.pts $+(#,.,$nick)
  adding.pts $+(#,.,$nick)
  if ((%floodjoin) || ($($+(%,floodjoin.,$nick),2))) { return }
  set -eu10 %floodjoin On
  set -eu30 %floodjoin. $+ $nick On
  msg $chan $nick has joined and is now earning points.
}

ON *:KICK:#: {
  if ($knick !== $me) {
    $+(.timerpoints.,#,.,$knick) off
    if ((%floodkick) || ($($+(%,floodkick.,$knick),2))) { return }
    set -eu10 %floodkick On
    set -eu30 %floodkick. $+ $nick On
    msg $chan $knick has left the channel and is no longer earning points.
  }
}

ON !*:QUIT: {
  $+(.timerpoints.,#,.,$nick) off
  if ((%floodquit) || ($($+(%,floodquit.,$nick),2))) { return }
  set -eu10 %floodquit On
  set -eu30 %floodquit. $+ $nick On
  msg $chan $nick has left the channel and is no longer earning points.
}

ON !*:PART:#: {
  $+(.timerpoints.,#,.,$nick) off
  if ((%floodpart) || ($($+(%,floodpart.,$nick),2))) { return }
  set -eu10 %floodpart On
  set -eu30 %floodpart. $+ $nick On
  msg $chan $nick has left the channel and is no longer earning points.
}

alias adding.pts { if ($1) { writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1) } }
Posted By: TheCanadian Re: Need Help Points system. - 11/11/14 06:18 PM
Still doesn't work. When I run the commands I get this "[username] has 0 total points." after the 120 seconds. I even made a new "Points.ini" file. I copied and pasted the code that you posted.
Posted By: westor Re: Need Help Points system. - 11/11/14 06:21 PM
Copy paste the code i gave you before, rejoin on the channel and after 5 minutes use !points command to the channel and report here the results also when you report here the results report and the points.ini file (its working fine on me)
Posted By: TheCanadian Re: Need Help Points system. - 11/11/14 06:41 PM
I did what you said, The part script is working "[username] has left the channel and is no longer earning points." but the join script isn't working, could it be because of this? And nothing is being added to the "Points.ini" file.

;------------------------
;Join message
;------------------------

on 1:JOIN:#:/msg $chan Welcome $nick to the channel! For a list of commands type !help.
Posted By: westor Re: Need Help Points system. - 11/11/14 06:45 PM
Try to paste the code i gave you on an new file (empty) and retry.
Posted By: TheCanadian Re: Need Help Points system. - 11/11/14 06:57 PM
It works now, It was because of my join script that I had, It was interfering with the join script for the points system.

Thanks.
Posted By: Nillen Re: Need Help Points system. - 11/11/14 09:32 PM
Absolutely, I used the exact same script, well aside from the fact that I added my leave message to the actual part event and not in the add.pts alias when I started mSL scripting for a twitch bot. However, my comment was directed towards Westor, a non-twitch user who was adding features to the script which isn't supported by twitch in the first place. So I was just letting him know that smile
© mIRC Discussion Forums