MIRC Simple Score/Point Giver/Keeper

By abitterblu on Dec 06, 2014

Here is a SUPER simple Points/Award script I put together. There is nothing too incredibly complex about this, it simply allows you to award a user for the sake of awarding them, and keeps track of how many points each user on the list is up to. In this particular case, I was giving out "internets" as an award, because who doesn't like winning internets?!

You can of course replace internetz with whatever (e.g. points, trophies, manna, balls of earwax (eww)) and the script will work, just edit the lines where you see the var %awardtype.

It does require you to make a .txt file for you to keep track of points. Name this whatever you like, just make sure that you specify the text file in the var %scorefile . Also make sure this is in your MIRC program directory, not in the script directory.

At this time, the only way for users to be added to the game/score keeping file is to manually add them, but the format is simple. I may or may not update this in the future with a way to add users, if you have a snippet you can add to it that will allow OPs only to do so, I'm all ears.

Hope you enjoy and find useful, and appreciate your constructive feedback.

Score Keeping TXT file Format:

1 username
1 username
1 username

The code will act funny if you add additional stuff, so try to stick to that simple format unless you plan on editing/improving upon the code. And always start with 1 when you add a user.

Usage:

.award (username)
Awards a user 1 additional point.

.myscore
Returns YOUR score.

.scores
Reads the ENTIRE list of scores from the text file.

;abitterblu started this... feel free to edit, have fun, do no harm, and respect works by others.
;other contributors: (add your name here if you make additions or edits)

on *:TEXT:.myscore*:#:{

  ;Enter the score keeping file here
  var %scorefile = internetz.txt

  ;enter the name of your award here
  var %awardtype = internetz

  if isfile(%scores) { 
    var %score = $read(%scorefile, nr, $nick)
    var %scorenumb = $remove(%score, $nick, 32)
    if (%scorenumb !isnum) { msg $chan no %awardtype for you... yet... }
    if (%scorenumb isnum 0-) { msg $chan You currently have %scorenumb %awardtype . Congratulations. }

  }
}

on *:TEXT:.award*:#:{
  ;Enter the score keeping file here
  var %scorefile = internetz.txt

  ;enter the name of your award here
  var %awardtype = internetz

  var %scored = $read(%scorefile, nr, $$2)
  var %score2 = $remove(%scored, $$2, 32)
  var %scoreplus = $calc(%score2 + 1)
  if ($$2 == $me) { msg $chan I am flattered but I don't deserve any %awardtype ... Do you have a bot snack? | halt }
  if ($$2 == $nick) { msg $chan $nick you can't give yourself internetz! I should subtract 1 for that! Everyone point and laugh at the cheater who tried to up their own score!!! | halt }
  if ($$2 !isin %scored) { msg $chan who is $$2 ? You want in, you talk to the boss and be added to the list. | halt }
  if (%score2 !isnum) { msg $chan Please check the spelling of the name you entered. | halt }
  if (%score2 isnum 0-) { 
    $+ write $+(-l, $readn) %scorefile $+(%scoreplus,$chr(32),$$2) 
  $+ msg $chan Congratulations $$2 you just scored 1 %awardtype ! You now have %scoreplus %awardtype ! }

}

on *:TEXT:.scores*:#:{

  ;Enter the score keeping file here
  var %scorefile = internetz.txt

  play $chan %scorefile
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.