mIRC Homepage
Posted By: CronTV Points System Auto-Points - 09/07/13 06:23 PM
Hi guys! I'm fairly new to the mirc language so I was wondering if someone could help me in finishing my script? I want to be able to activate this through a timer when someone joins. So the person gets Points every 10minutes and then for the timer to end when they leave the irc.

Code:
on *:join:#:{
  var %points $addPoints(1)
}


I would also like to add a new command to my script to allow the addition of points to people in the irc by typing !points add user and !points remove user.

Please could you help?


The full script is here

Thanks
CronTV
Posted By: flipper Re: Points System Auto-Points - 09/07/13 07:08 PM
Have a look over this:
if you don't want mirc to display when the timers are started and stopped, prefix them with a .

Is this what you were looking for ?

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 *:join:#:{
var %points $addPoints(1)
timer $+ $nick 0 5 doaddpoints $chan $nick 1
}

on *:part:#:{
timer $+ $nick off
}

on *:text:!points:#:{
var %points $lookUpPoints
msg $chan $nick has %points total points.
if ($2 == add) { doaddpoints $chan $3 1 }
if ($2 == remove) { dorempoints $chan $3 }
}

on *:text:!points *:#:{
if ($2 == add) { doaddpoints $chan $3 1 }
if ($2 == remove) { dorempoints $chan $3 }
}
Posted By: CronTV Re: Points System Auto-Points - 09/07/13 08:41 PM
Thanks a lot man, works perfectly. Now i just need to sort out the raffle system and trading points.
Posted By: CronTV Re: Points System Auto-Points - 09/07/13 11:08 PM
Also i don't think the add and remove commands are working, could be wrong..
Posted By: Deega Re: Points System Auto-Points - 10/07/13 01:41 AM
Try this instead
Code:
on *:text:!points:#:{
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total points.
}
on $*:text:/!points (add|remove)/Si:#:{
  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))
}
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 300 add.pts $+(#,.,$nick)
  add.pts $+(#,.,$nick)
}
on !*:part:#:$+(.timerpoints.,#,.,$nick) off
alias -l add.pts {
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

!points
!points add user ..................... Adds 1 point to user
!points add user (number).......... Adds (N) points to user
!points remove user.................. Removes 1 point from user
!points remove user (number)...... Removes (N) points from user
Posted By: CronTV Re: Points System Auto-Points - 10/07/13 03:17 PM
Thanks deega, worked much better, still got one small problem though in that the removal of points doesn't work. I changed the script slightly to only work for moderators and to display a message. Any suggestions?

Code:
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. }
  }
}


Edit: Nevermind i fixed it, it was my changing that broke it.
Code:
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. }
}

Posted By: Deega Re: Points System Auto-Points - 11/07/13 12:46 AM
smile
You should remove the braces from this line.
{ msg $chan $3 now has $readini(Points.ini,$+(#,.,$3),Points) total points. }
Code:
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. }
}

Posted By: CronTV Re: Points System Auto-Points - 11/07/13 12:58 AM
Any suggestions for the use of a !give <user> <amount> command? To allow users to give others points and the points to be removed from their current balance?

Edit: Also is while i'm here is there any sort of socket or something I can use to see if a person is subscribed to a youtube? That way they can earn points for subscribing if they do something like !youtube <their youtube>. Don't know how well that would work. Could anyone point me in the right direction?
© mIRC Discussion Forums