Results 1 to 1 of 1

Thread: Function to list all available modifiers

  1. #1
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Seoul, Korea

    Lightbulb Function to list all available modifiers

    It's much harder than expected to acquire a list of all available modifiers for a given type. There's a string modifier called "Modifiers" which I scraped for all 9,872 items to build this list to add to my script:

      foreach s in $strings[Familiar Weight, Monster Level, Combat Rate, Initiative, Experience, Item Drop, Meat Drop, Damage Absorption,
             Damage Reduction, Cold Resistance, Hot Resistance, Sleaze Resistance, Spooky Resistance, Stench Resistance, Mana Cost, Moxie, Moxie Percent,
             Muscle, Muscle Percent, Mysticality, Mysticality Percent, Maximum HP, Maximum MP, Weapon Damage, Ranged Damage, Spell Damage, Spell Damage Percent,
             Cold Damage, Hot Damage, Sleaze Damage, Spooky Damage, Stench Damage, Cold Spell Damage, Hot Spell Damage, Sleaze Spell Damage, Spooky Spell Damage,
             Stench Spell Damage, Underwater Combat Rate, Fumble, HP Regen Min, HP Regen Max, MP Regen Min, MP Regen Max, Adventures, Weapon Damage Percent,
             Hobo Power, Base Resting HP, Resting HP Percent, Bonus Resting HP, Base Resting MP, Resting MP Percent, Bonus Resting MP, Critical Hit Percent,
             PvP Fights, Volleyball, Sombrero, Fairy, Food Drop, Booze Drop, Hat Drop, Weapon Drop, Pants Drop, Accessory Drop, Slime Resistance, Slime Hates It,
             Spell Critical Percent, Muscle Experience, Mysticality Experience, Moxie Experience, Effect Duration, Candy Drop, DB Combat Damage, Sombrero Bonus,
             Familiar Experience, Sporadic Meat Drop, Sporadic Item Drop, Meat Bonus, Pickpocket Chance, Combat Mana Cost, Muscle Experience Percent, Mysticality Experience Percent,
             Moxie Experience Percent, Minstrel Level, Muscle Limit, Mysticality Limit, Moxie Limit, Song Duration, Prismatic Damage, Smithsness, Supercold Resistance,
             Reduce Enemy Defense, Pool Skill, Surgeonosity, Familiar Damage, Maximum Hooch, Water Level, Crimbot Outfit Power, Familiar Tuning Muscle,
             Familiar Tuning Mysticality, Familiar Tuning Moxie, Random Monster Modifiers, Luck] {
    Scraping all items and running split_string() on all of them seems quite expensive. Plus, if there are modifiers that don't appear on items they won't be present in the list. Also, if mafia adds another modifier to that list, I'll never know unless an error gets reported -- not likely given that this particular script is mostly informative and errors of omission would likely not be noted.

    Also, if for whatever reason the modifier name is misspelled in the script, the functions will silently return 0 or false or whatever the default for that type is. This makes it quite easy for an error to go undetected.

    So I would like to request some way to access complete lists of modifiers, per type. I see three possibilities (listed from what I see as least effort to most):

    1) a single function something like this:

    boolean[string] all_modifiers(string modifer_type), taking a parameter which specifies the type of modifier, and returning an array of the type commonly iterated in ASH. So instead of the long list I posted above I could simply foreach all_modifiers("numeric") and not worry about future modifiers making my script inaccurate.

    b) Plural versions of all existing <type>_modifier() functions, returning a map of modifier name to current value. This would probably be harder to implement but quite amazing. For example:

    boolean boolean_modifier(string) would also have a boolean[string] boolean_modifiers() version, returning all the possible modifiers and their current value.
    float numeric_modifier(item, string) would also have a float[string] numeric_modifiers(item) version, returning all the possible modifiers and their current value.

    This would allow for very easy comparison of the benefits of wearing multiple items, for instance. Particularly when using "whatif", which would be juicy and delicious.

    III) ASH $<type>modifier[] typed constants. Existing modifier functions could accept this type where it currently accepts a string (deprecating existing functions). We could also easily get full lists using something like $numericmodifiers[]. This would ensure no misspelled modifier names in addition to possibly opening the door for further modifier-specific functions or proxy records.

    Thanks for considering this feature request!
    Last edited by zarqon; 12-05-2018 at 10:51 AM.
    Sig by JakAtk
    My scripts: Prefref Plus | Skillref Plus | One-Click Wossna | Om*****st (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mercenary Mood | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | Drag-n-Drop Inventories | CanAdv | Script Registry | Map Manager
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts