mIRC Home    About    Download    Register    News    Help

Topic Options
#245444 - 21/04/14 06:49 PM Point System Distribution Problem
Razreaper Offline
Nutrimatic drinks dispenser

Registered: 21/04/14
Posts: 7
I'm new to this forum and I started another post this morning on another issue so I'm hoping it's not a problem to have two post dealing with two separate scripts on this forum. If I need to combine both posts let me know and I will do that.

The reason for this post is dealing with my Point Distribution System. I found a script that will set up a system where when a user joins my chat they get 1 point (token) for every 900 seconds (15min) they are in chat. This portion of the code works great.

The problem is whenever a user enters the chat they get 1 point then 1 point every 15min. What I need is a way for them not to get 1 point until the first 15min is up. Otherwise they would be able to leave chat and come back over and over and farm points. Is there a way to delay the first point until after the first 15min.

If not what would be the best way of removing the added point every time they join.

Here is all my code for the point (token) script.

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:!tokens:#:{
  if ((%floodpoints) || ($($+(%,floodpoints.,$nick),2))) { return }
  set -u10 %floodpoints On
  set -u30 %floodpoints. $+ $nick On
  msg # $nick has $readini(Points.ini,$+(#,.,$nick),Points) total tokens.
}

on $*:text:/!tokens (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 tokens. }
  }
  else { msg $chan This command is only available to moderators. }
}
on !*:join:#:{
  $+(.timerpoints.,#,.,$nick) 0 900 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)
}

Top
#245445 - 21/04/14 07:01 PM Re: Point System Distribution Problem [Re: Razreaper]
Loki12583 Offline
Hoopy frood

Registered: 22/01/04
Posts: 1244
Take out the part that gives them points when they join.

Quote:
on !*:join:#:{
$+(.timerpoints.,#,.,$nick) 0 900 add.pts $+(#,.,$nick)
add.pts $+(#,.,$nick)
}

Top
#245446 - 21/04/14 07:28 PM Re: Point System Distribution Problem [Re: Loki12583]
Razreaper Offline
Nutrimatic drinks dispenser

Registered: 21/04/14
Posts: 7
Thanks so much I tried that before and it didn't work but then i rebuilt the entire script and now it works like a charm.

Top
#245513 - 23/04/14 11:11 PM Re: Point System Distribution Problem [Re: Razreaper]
Bramzee Offline
Vogon poet

Registered: 22/04/14
Posts: 170
is there a way to turn this points system on/off or pause it for when I'm not streaming? To make sure people don't earn points by just afking while I'm offline?

Top
#245516 - 24/04/14 02:37 AM Re: Point System Distribution Problem [Re: Bramzee]
blessing Offline
Vogon poet

Registered: 03/04/14
Posts: 191
How to know you were offline / not streaming?

Top
#245539 - 24/04/14 08:12 PM Re: Point System Distribution Problem [Re: blessing]
Bramzee Offline
Vogon poet

Registered: 22/04/14
Posts: 170
yes, like a way to add a !pointsoff or !pointson? I've been trying to figure it out myself but can't seem to get it correct... and after I think I came close, I had to do a system restore on my computer smirk I guess I COULD turn my bot off when I'm not streaming, but it's easier to just leave it running all the time. So an on/off command would be ideal.


Edited by Bramzee (24/04/14 09:55 PM)

Top
#245548 - 25/04/14 02:32 AM Re: Point System Distribution Problem [Re: Bramzee]
blessing Offline
Vogon poet

Registered: 03/04/14
Posts: 191
It would be like this:
Code:
on $*:text:/^!point (on/off)/:#:{
  if $nick != YOURNICKHERE { return }
  if $2 == off { 
    set -e %point.off 1 
    msg # Points turn off 
  }
  else { 
    unset %point.off 
    msg # Points turn on 
  }
}

Note: change YOURNICKHERE with yourusername.

!point off to disable point system
!point on to enable.

And replace add.pts alias with this one:
Code:
alias -l add.pts {
  if %point.off { return }
  writeini -n Points.ini $1 Points $calc($readini(Points.ini,$1,Points) + 1)
}

Top
#245558 - 25/04/14 12:17 PM Re: Point System Distribution Problem [Re: blessing]
blessing Offline
Vogon poet

Registered: 03/04/14
Posts: 191
Just notice typo of this line. on/off should be on|off
Code:
on $*:text:/^!point (on/off)/:#:{

should be
Code:
on $*:text:/^!point (on|off)/:#:{

Top
#245594 - 29/04/14 12:04 AM Re: Point System Distribution Problem [Re: blessing]
Bramzee Offline
Vogon poet

Registered: 22/04/14
Posts: 170
Thanks. Figured out something that works, but it was a lot longer than that ha.

Top