Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
rule formulas essentially equate to either true or false depending on the functions and arguments you give. false means an item didn't match, true means it did and will be assigned to that rule.
the default formula starts out as
false, you don't need to keep that in your own rule formula, it's just a place holder so that a "blank" rule can be saved but wont match any item.
don't forget that there are system categories for the basic stuff, ie trash, skills, class, etc, which you can specifically assign an item to, so you shouldn't create a rule for the basic stuff unless you have a very specific reason.
when creating a rule formula, try to keep it as simple and short as possible, eg;
type( "armor" ) and subtype( "cloth" ) or subtype( "leather" ) or subtype( "mail" )
this does 3 separate calls to the subtype function. you should always try and compress any same function or comparisons down to a single function call where possible. eg;
type( "armor" ) and subtype( "cloth","leather","mail" )
this would be quicker (although that particular function is pretty fast anyway), but some functions, like
outfit( ), are fairly intensive so calling them as little as possible is good.
function names are case sensitive, they need to be lowercase
the Lua logic operators
notneed to be in lowercase
the arguments passed to a function are normally case insensitive (converted to lower case for matching purposes), unless that function specifically requires an exact case match (eg periodictable)
leading and trailing spaces are trimmed from all arguments
code changes can cause a rule to become "damaged", it that happens then any rule using it will be flagged as damaged and will not be used until it is corrected and re-saved
where a function takes multiple arguments it acts as an explicit or. eg
name( "scroll", "elixir", "potion" )is equivalent to
name( "scroll" ) or name( "elixir" ) or name( "potion" )
- Account Bound, Soul Bound, Bound
- Id (removed)
- Item Type, Item SubType
- Item Level (stat), Item Level (use)
- Item Stat
- Equip Location
- Periodic Table
- Character Level Range
- Vendor Price Under, Vendor Price Over
- Item Family
- TSM, TSM Group
- Pet Type, Pet Can Battle, Pet Is Wild
- Mount Type
Third Party Rule Functions
Other players can write their own rule functions that you can download and use. They work the same way as the system provided rule functions the only difference being that if you disable their mod then any rules using their function will become "damaged" and cannot be used until you either remove their rule function from the formula, or re-enable their mod.
Some example rules can be found here