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. } ```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.
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.
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.
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.
}