Grats script

By Mfoust on Jan 22, 2011

I got bored and decided to make my first gratz script, i didn't put that much effort into it so don't full on troll me.

Your thoughts are kindly welcome tho

This script is like 7 months old so bare with it

on $*:TEXT:/^[@!.]grat[zs]/Si:#: {
  if ($2 isnum 1-99) && ($lvls($3)) { msg $chan  11,1 ^9/4¤9\4¤9/4¤9\4¤11^ 9CONGRATULATIONS 11 on 4 $2 13 $lvls($3) 8 $nick 11^9/4¤9\4¤9/4¤9\4¤11^ }
}
on $*:TEXT:/^[@!.]congratulations/Si:#: {
  if ($2 isnum 1-99) && ($lvls($3)) { msg $chan  11,1 ^9/4¤9\4¤9/4¤9\4¤11^ 9CONGRATULATIONS 11 on 4 $2 13 $lvls($3) 8 $nick 11^9/4¤9\4¤9/4¤9\4¤11^ }
}
alias lvls {
  if ($regex($1,/^(att|atk|attack)$/Si)) { Return Attack }
  if ($regex($1,/^(str|strenth|strength)$/Si)) { Return Strength }
  if ($regex($1,/^(def|defend|defence)$/Si)) { Return Defence }
  if ($regex($1,/^(hp|hits|hitpoints|hit|constitution)$/Si)) { Return Hitpoints }
  if ($regex($1,/^(Ranged|Range|Archer|Archery)$/Si)) { Return Range }
  if ($regex($1,/^(pray|prayer|praying)/Si)) { Return Prayer }
  if ($regex($1,/^(mage|magic)$/Si)) { Return Magic }
  if ($regex($1,/^(cook|cooking)$/Si)) { Return Cooking }
  if ($regex($1,/^(wc|wood|woodcut|woodcutting)$/Si)) { Return Woodcutting }
  if ($regex($1,/^(fletch|fletching)$/Si)) { Return Fletching }
  if ($regex($1,/^(Fishing|fishing|fish)$/Si)) { Return Fishing }
  if ($regex($1,/^(fm|fire|firemaking)$/Si)) { Return Firemaking }
  if ($regex($1,/^(craft|crafting)$/Si)) { Return Crafting }
  if ($regex($1,/^(smithing|smith)$/Si)) { Return Smithing }
  if ($regex($1,/^(Mine|mining)$/Si)) { Return Mining }
  if ($regex($1,/^(Herb|Herblore)$/Si)) { Return Herblore }
  if ($regex($1,/^(Agil|agi|Agility)$/Si)) { Return Agility }
  if ($regex($1,/^(Theif|theiv|thiev|theiving|thieving)$/Si)) { return Thieving }
  if ($regex($1,/^(slay|Slayer)$/Si)) { Return Slayer }
  if ($regex($1,/^(farm|Farming)$/Si)) { Return Farming }
  if ($regex($1,/^(rc|runecrafting|runecraft)$/Si)) { Return Runecrafting }
  if ($regex($1,/^(hunt|hunting|hunter)$/Si)) { return Hunter }
  if ($regex($1,/^(cstruct|con|construct|construction)$/Si)) { return construction }
  if ($regex($1,/^(sumonning|sumo|sumon|sum)$/Si)) { return Summoning } 
  if ($regex($1,/^(dung|dun|dungeoneering)$/Si)) { return dungeoneering }
}

Comments

Sign in to comment.
poborski   -  May 31, 2011

if u type !gratz 120 dungeoneering it wont show any mensage so guess we need to add something like this

($2 <= 120) && ($2 > 1) && ($skill == Dungeoneering)

 Respond  
Jethro   -  Jan 22, 2011

This is called regex overkill. You only have to use one $regex with $regml(1) to reference to the match for the calling return. You can get rid of the repetitions by using the grouping method. Your first two regex events can be combined into one as such:

on $*:text:/^[@!.](con)?(grat)?(z|s|gratulations)\s(\b[1-9][0-9]?)\b/Si:#:{ 
  if $lvls($3) {
    msg $chan 11,1 ^9/4¤9\4¤9/4¤9\4¤11^ 9CONGRATULATIONS 11 on 4 $2 13 $v1 8 $nick 11^9/4¤9\4¤9/4¤9\4¤11^ 
  }
}

You don't have to repeat $lvls($3) again by using $v1.

 Respond  
_Teen_   -  Jan 22, 2011

just giving an advice you can use this

if $regex($1,/^sum(onning|o|on)$/Si) { return Summoning } 
 if $regex($1,/^f(m|ire|iremaking)$/Si) { Return Firemaking }
if $regex($1,/^h(p|its|itpoints|it)$/Si) { Return Hitpoints }
 if $regex($1,/^R(anged|ange)|Arche(r|ry)$/Si) { Return Range }
if $regex($1,/^mag(e|ic)$/Si) { Return Magic }
if $regex($1,/^def(end|ence)$/Si) { Return Defence }
if $regex($1,/^pra(y|yer|ying)/Si) { Return Prayer }
 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.