Code: Select all
Sub Event_Chat
/declare price local
/declare item local
/declare cleanstr local
/declare l1 local
/declare l2 local
/varset l1 0
/varset l2 0
/if "@Param0"=="tell" {
/mqlog I was told @Param2 by @Param1
/if "@Param2"~~"I'll give you " {
/if "@Param2"~~"absolutely nothing" /return
/mqlog past "give you" check
/if "@Param2"~~" per " {
/mqlog stackable item price
/varset price $mid(15,$calc($instr(" per ",@Param2)-1),@Param2)
/varset l1 $calc($instr(" per ", @Param2)+5)
/varset item $mid(@l1,$calc($strlen(@Param2)-@l1),@Param2)
/mqlog calling ParseAndCheckPrice @price @item
/call ParseAndCheckPrice @price @item
} else /if "@Param2"~~" for the " {
/mqlog Unstackable item price
/varset cleanstr "$mid(14,$calc($strlen("@Param2")-14),"@Param2")
/mqlog cleanstr is @cleanstr
/varset l2 $instr("for","@cleanstr")
/varcalc l1 @l2-1
/mqlog l1 is @l1 should be length of price string
/varset price "$left(@l1,"@cleanstr")"
/mqlog price is "@price"
/varset l2 "$instr("the", "@cleanstr")"
/mqlog l2 is @l2
/varcalc l1 @l2+5
/mqlog l1 is @l1 should be start of Item Name
/varset item "$mid(@l1,$calc($strlen("@cleanstr")-@l1-1),"@cleanstr")"
/mqlog calling ParseAndCheckPrice @price @item
/call ParseAndCheckPrice @price @item
}
}
}
/return

