Karma Game

By NickLeStrange on Jan 11, 2013

After browsing some of the snippets in the wee hours of this morning, I saw a post called Karma Bot (http://www.hawkee.com/snippet/9621/#c99876).

Now, earlier in #vampyres_cathedral there was quite a bit of talk about Guild Wars 2 and the Karma that you earn whilst doing Dailies. So inspiration struck, and I quickly coded a first dirty draft of The Karma Game. This is my own version of the Karma Bot, which makes use of INI files to track user progress and such.

Scripted from scratch.

Here's the info: (paste)

Basically, whenever you chat in the channel, you get what's called Karma Points for every sentence that you type. Don't try to jippo the system, because there is flood protection enabled, and you will get banned if you flood.

Once you acquire 10 000 Karma Points you will be allowed to remove as much karma points from anyone else in the channel as long as it doesn't set their scores to below 0. There is a catch, for every such action 2000 Karma Points will be removed from your score as well. Yup, what goes around, comes around.

Here's what you need to know.

To check your score, type !karma in main.
To check the score of someone else, type !karma nickname in main.
To remove karma points, pvt Red_Queen, and type !removekarma nickname amount
Of course substituting nickname for an actual nickname, and the amount with positive numbers.

** Edit the person will be sent a memo via memoserv when you remove Karma Points from them. With their old and new values.

You cannot remove more than what the person has available, so no negative score will be allowed. The least amount of points that anyone can have is 0."

//snip

So this is an early beta version. Feel free to use it and change it.
I've done a direct copy and paste from my remotes, not changing anything.
*** If you change it, let me know. If you use it, spread the love and acknowledge.

Written for mirc 6.35 - as usual.

on 1:text:*:#vampyres_cathedral: {

  set %kfilename $nick $+ .ini
  set %kname $nick
  set %karma $readini(%kfilename, %kname, karma)

  if ($1 == !karma) && ($2 != $null) { goto SeeKarma }
  elseif ($1 == !karma) { goto ScoreKarma }
  else { goto AddKarma }

  :AddKarma 
  set %addkarma %karma + 1
  if ($exists(%kfilename)) { writeini %kfilename %kname karma %addkarma }
  else writeini %kfilename %kname karma 1
  .echo %kfilename %kname karma %addkarma
  halt

  :ScoreKarma
  set %karmavalue $readini(%kfilename, %kname, karma)
  if (%karmavalue < 100) { .describe $chan Come on %kname $+ , you have to work harder. Your karma is currently %karmavalue }
  elseif (%karmavalue > 100) { .describe $chan $nick is raking in those karma points. Current karma for $nick is %karmavalue }
  elseif (%karmavalue > 1000) { .descibe $chan $nick $+ 's current karma is sitting at %karmavalue $+ . Grats $nick $+ ! }
  elseif (%karmavalue > 10000) { .descibe $chan $nick $+ 's current karma is sitting at %karmavalue $+ . $nick is allowed to remove as many points from any 1 person, while also sacrificing 2000 karma points. }
  halt

  :SeeKarma
  set %Getkfilename $2 $+ .ini
  set %Getkname $2
  if ($exists(%Getkfilename)) { set %Getkarmavalue $readini(%Getkfilename, %Getkname, karma) | goto SayKarmaScore }
  else { .msg $chan Sorry $nick $+ , but I have no record of %Getkname $+ . | halt }

  :SayKarmaScore
  .describe $chan %Getkname $+ 's karma score is %Getkarmavalue $+ .
  halt

}

on 1:text:!removekarma*:?: {
  set %Getkfilename1 $nick $+ .ini
  set %Getkname1 $nick
  if ($exists(%Getkfilename1)) { set %Getkarmavalue1 $readini(%Getkfilename1, %Getkname1, karma) | goto IsUserElligible }
  else { .msg $chan Sorry $nick $+ , but I have no record of %Getkname $+ . | halt }

  :IsUserElligible
  if (%Getkarmavalue1 >= 10000) { goto Elligible }
  else { .msg $nick Sorry %Getkname1 $+ , but you don't have 10000 or more points in order to remove karma from $2. | halt }

  :Elligible
  set %Getkfilename2 $2 $+ .ini
  set %Getkname2 $2
  if ($exists(%Getkfilename2)) { set %Getkarmavalue2 $readini(%Getkfilename2, %Getkname2, karma) | goto CalcKarma }
  else { .msg $chan Sorry $nick $+ , but I have no record of %Getkname $+ . | halt }

  :CalcKarma
  set %CurKarma %Getkarmavalue2
  set %RemKarmaValue $3
  set %NewKarmaValue %CurKarma - %RemKarmaValue
  set %YKarmaValue %GetKarmavalue1 - 2000
  if %RemKarmaValue < 0 { .msg $nick Cannot use negative numbers. Try again. }
  elseif (%NewKarmaValue < 0) { .msg $nick Cannot set %Getkname2 $+ 's karma points to lower than 0 once you subtract your specified amount. Try again. | halt }
  else { 
    writeini %Getkfilename2 %Getkname2 karma %NewKarmaValue  
    writeini %Getkfilename1 %Getkname1 karma %YKarmaValue 
    .msg $nick %Getkname2 $+ 's new karma point amount is %NewKarmaValue 
    .msg $nick Your new karma value is %YKarmaValue
    .msg memoserv send %Getkname2 $nick has just removed karma points from your score. It was %CurKarma $+ , now it is %NewKarmaValue $+ .
    halt
  }
}  

Comments

Sign in to comment.
cptpan   -  Oct 12, 2013

This doesn't work?

NickLeStrange  -  Oct 12, 2013

You can't use it in your own remotes. You have to use it in a bot's remotes. Also, I recommend that you edit this to add your own special stuff, as this was just my brain spilling out, though it worked okay in this basic form.

Edit: This is brand new, coded it tonight (right through the night up until 4am this morning).
It should be easier to use and edit for anyone.

Link: http://www.hawkee.com/snippet/10059/

cptpan  -  Oct 16, 2013

Yea I used it in a bot. Will try the new one :3 Thx

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.