mIRC Home    About    Download    Register    News    Help

Print Thread
#225106 25/08/10 09:52 PM
Joined: Aug 2010
Posts: 2
F
Bowl of petunias
OP Offline
Bowl of petunias
F
Joined: Aug 2010
Posts: 2
I am looking for a script to use a point system in my chat I would like it to do something like this

bot awards 5 points to personA, total points 5
bot awards 5 points to personA, total points 10

but I want it to be saved in a file so when they want to know how many they have all they have to do is type something in.

Joined: Mar 2009
Posts: 74
K
Babel fish
Offline
Babel fish
K
Joined: Mar 2009
Posts: 74
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
}


Just create the appropriate triggers to access these commands. Note that I flagged them as local commands, this prevents another script from causing problems because of a command with a similar name. But, this also means you can't use the command except inside the script it was created for. Also, using either of these returns a value equal to the number of points added.

Code:
on 1:text:*:#:{
  var %points $addPoints(5)
  msg $chan Bot awards 5 points to $nick $+ , total points %points $+ .
}


This is just an example, I don't recommend doing your trigger exactly like that. But each time a person speaks, it will add 5 points to their total, and the command will actually look up the point total for the player, tack on the points, then return the total number. After that, the trigger just tells how many points were given to that player.

Code:
on 1:text:!points:#:{
  var %points $lookUpPoints
  msg $chan $nick has %points total points.
}


And this allows a person to type !points, and get their points total.

Joined: Aug 2010
Posts: 2
F
Bowl of petunias
OP Offline
Bowl of petunias
F
Joined: Aug 2010
Posts: 2
thanks that worked somewhat but their is still a problem,
when I give points to a user it says bot awards 5 points to ustreamer34,__total points
and if I use !points it says ustreamer34 has__total points.
the __ are just blank no point values.

Last edited by frencsday; 26/08/10 11:25 PM.

Link Copied to Clipboard