Star Awards

By Pangaea on Dec 25, 2009

Hi. just a little code i made for giving out wise guys stars for witt

I found myself "/me gives a gold star to.." alot when ppl cracked good jokes, and silver for ok jokes, bronze for terrible jokes.. so decided to make a script that will give and keep a record of how many stars give my any giver. You must state a nick after the command, the nick dosent have to be exact, beacuse i like to make up my own names for ppl (more personal) for example i know a nick called "sharon". i call her shaz, so shaz will do. I have also used a star symbol that may not be compatible with some systems, you can edit that out.

The commands are

!gold-star (nick)
!silver-star (nick)
!bronze-star (nick)

Example:

was that joke funny then? !silver-star shaz * Anubis gives shaz a Silver Star ✩ (star symbol) for effort. Pangaea has given out 5 Silver Star awards. ```mirc on *:text:!gold-star *:#:{ inc %starg.peeps. $+ $nick 1 describe $chan gives $2 a Gold Star 8,2 ✩  for excellence. $nick has given out %starg.peeps. [ $+ [ $nick ] ] Gold Star awards. } on *:text:!silver-star *:#:{ inc %stars.peeps. $+ $nick 1 describe $chan gives $2 a Silver Star 0,2 ✩  for effort. $nick has given out %stars.peeps. [ $+ [ $nick ] ] Silver Star awards. } on *:text:!bronze-star *:#:{ inc %starb.peeps. $+ $nick 1 describe $chan gives $2 a Bronze Star 7,2 ✩  for at least trying. $nick has given out %starb.peeps. [ $+ [ $nick ] ] Bronze Star awards. } ```

Comments

Sign in to comment.
Jethro   -  Dec 25, 2009

You are welcome, Pangaea, and Merry Christmas to you too! Oh, I edited it again. I've just realized I could have simply used:

on $*:TEXT:/((?<=\41)\w+)-star\s(\S+)/iS:#: {

:P

 Respond  
Pangaea   -  Dec 25, 2009

DarkCoder thanks for the initial suddgestions.. was going to implment it in the new year, but then Jethro_ (you lengend) posted

endless thanks jethro & co.

happy xmas & new year to ya`all

 Respond  
DarkCoder   -  Dec 25, 2009

ty ghost-writer :>, jeth, good job to i guess, and i missed out on a little colours, big deal :<.

 Respond  
Jethro   -  Dec 25, 2009

I've basically converted the original code into one text event, demonstrating what regex can do in my version. The script may look bigger, but is clear to see than using lots of $iifs, which, as RusselB has suggested, take more resources. /inc is more suitable than using hash tables in this case. Last but not least, the original code intends to show different colors for each star award.

 Respond  
Ghost-writer   -  Dec 25, 2009

wow wow wow jethro_, slow down, with all those ifs your basically not really helping the code as you are making it longer. Putting it all in 1 on text event, thats fine but come on. your making it no better than the orig. I say good job to the scripter to darkcoder, he made it shorter even if it does take longer to process and its harder to read.

 Respond  
Jethro   -  Dec 25, 2009

Improved a bit to show the singular and plural form of the award and awards.

 Respond  
Jethro   -  Dec 25, 2009

Here is my version:

on $*:TEXT:/((?<=\41)\w+)-star\s(\S+)/iS:#: {
  if ($regml(2) ison #) {
    if ($regml(1) = gold) { inc $+(%,$regml(1),$nick)
      .describe # gives $regml(2) a $regml(1) Star 8,2 ✩  for excellence. $&
        $nick has given out $iif($($+(%,$regml(1),$nick),2) = 1,$v1 $regml(1) Star award.,$v1 $regml(1) Star awards.)
    }
    if ($regml(1) = silver) { inc $+(%,$regml(1),$nick)
      .describe # gives $regml(2) a $regml(1) Star 0,2 ✩  for effort. $&
        $nick has given out $iif($($+(%,$regml(1),$nick),2) = 1,$v1 $regml(1) Star award.,$v1 $regml(1) Star awards.)
    }
    if ($regml(1) = bronze) { inc $+(%,$regml(1),$nick)
      .describe # gives $regml(2) a $regml(1) Star 7,2 ✩  for at least trying. $&
        $nick has given out $iif($($+(%,$regml(1),$nick),2) = 1,$v1 $regml(1) Star award.,$v1 $regml(1) Star awards.)
    }
  }
}

Using multiple $iif()s is going to make a mess and that color codes may not display correctly. The regular if statements are cleaner and clear to see. The usage is the same as Pangaea's.

 Respond  
Jethro   -  Dec 25, 2009

Yeah I agree. The use of /inc %var should suffice to compliment the regex. By using hash tables you have to hsave your info on exit and hload it on start or connect.

 Respond  
FordLawnmower   -  Dec 25, 2009

This hash table stuff is getting way out of control. There are lots of obvious uses for hash tables. Sadly, counting stars is not one of them ;/

 Respond  
Jethro   -  Dec 25, 2009

DarkCoder, it's a capitalized /S, not /s flag to strip out control codes for mirc. If you want to use hash tables, why not make the use of it by using $hfind($regml(1),$nick) to refer to the nick (item) whom you're giving the stars to.

 Respond  
DarkCoder   -  Dec 25, 2009

describe $chan gives $2 a $regml(1) Star 0,2 ✩ for $+($iif($Regml(1) == gold,excellence,$iif($regml(1) == silver,effort,at least trying)),.) $nick has given out $hget($regml(1), $nick) $regml(1) Star awards.
^replace that, ie is currently sucking so i cant edit.

 Respond  
DarkCoder   -  Dec 25, 2009

Hash table could be used here, And you could use regex and $regml to make this all 1 command and work the same :).

on $*:TEXT:/^[.!@](Gold|Bronze|Silver)-Star/si:#: {
  hinc -m $regml(1) $nick
  describe $chan gives $2 a $regml(1) Star 0,2 ✩  for effort. $nick has given out $hget($regml(1), $nick) $regml(1) Star awards.
}
 Respond  
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.