mIRC Home    About    Download    Register    News    Help

Print Thread
Need Help Points system. #249009 11/11/14 01:22 AM
Joined: Nov 2014
Posts: 17
T
TheCanadian Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Nov 2014
Posts: 17
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.
}
'''

Last edited by TheCanadian; 11/11/14 01:23 AM.
Re: Need Help Points system. [Re: TheCanadian] #249014 11/11/14 11:59 AM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
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.

Re: Need Help Points system. [Re: westor] #249016 11/11/14 02:55 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Re: Need Help Points system. [Re: Nillen] #249018 11/11/14 05:38 PM
Joined: Nov 2014
Posts: 17
T
TheCanadian Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Nov 2014
Posts: 17
A lot of people have this script and it works fine for them.

Re: Need Help Points system. [Re: TheCanadian] #249019 11/11/14 05:41 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
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

Re: Need Help Points system. [Re: westor] #249020 11/11/14 05:45 PM
Joined: Nov 2014
Posts: 17
T
TheCanadian Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Nov 2014
Posts: 17
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.

Last edited by TheCanadian; 11/11/14 05:50 PM.
Re: Need Help Points system. [Re: TheCanadian] #249021 11/11/14 06:07 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
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) } }

Re: Need Help Points system. [Re: westor] #249022 11/11/14 06:18 PM
Joined: Nov 2014
Posts: 17
T
TheCanadian Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Nov 2014
Posts: 17
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.

Re: Need Help Points system. [Re: TheCanadian] #249023 11/11/14 06:21 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
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)

Re: Need Help Points system. [Re: westor] #249024 11/11/14 06:41 PM
Joined: Nov 2014
Posts: 17
T
TheCanadian Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Nov 2014
Posts: 17
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.

Last edited by TheCanadian; 11/11/14 06:44 PM.
Re: Need Help Points system. [Re: TheCanadian] #249025 11/11/14 06:45 PM
Joined: Dec 2008
Posts: 1,511
westor Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2008
Posts: 1,511
Try to paste the code i gave you on an new file (empty) and retry.

Re: Need Help Points system. [Re: westor] #249026 11/11/14 06:57 PM
Joined: Nov 2014
Posts: 17
T
TheCanadian Offline OP
Pikka bird
OP Offline
Pikka bird
T
Joined: Nov 2014
Posts: 17
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.

Re: Need Help Points system. [Re: TheCanadian] #249029 11/11/14 09:32 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline
Hoopy frood
Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
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


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net