Page 1 of 2 1 2 LastLast
Results 1 to 10 of 18

Thread: [Patch] Implement PirateRealm-only modifiers

  1. #1
    Senior Member
    Join Date
    Apr 2018
    Posts
    301

    Default [Patch] Implement PirateRealm-only modifiers

    This patch implements modifiers for items that only affect PirateRealm, such as the bloody harpoon. It does not add any new modifiers, however.

    PirateRealm Properties.patch

  2. #2
    Senior Member
    Join Date
    Apr 2018
    Posts
    301

    Default

    Is this going to be reviewed eventually?

  3. #3
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,396

    Default

    r19336

    Untested

  4. #4
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,674

    Default

    If your location is set to a specific PirateRealm island, the modifiers remain 0, since "PirateRealm" and "PirateRealm Island" are two different zones.

    > ash set_location($location[piraterealm island])

    Returned: void

    > ash numeric_modifier($item[cursed compass], "Item Drop")

    Returned: 100.0

    > ash set_location($location[battle island])

    Returned: void

    > ash numeric_modifier($item[cursed compass], "Item Drop")

    Returned: 0.0
    We might have to do something like [100*(zone(PirateRealm)+zone(PirateRealm Island))]
    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!

  5. #5
    Developer fronobulax's Avatar
    Join Date
    Feb 2009
    Location
    Central Virginia, USA
    Posts
    4,396

    Default

    Possibly my bad since I do recall some changes concerning realm zones and they may have occurred after the patch was first submitted.

    I'll gladly take a correction/fix but Zarqon has shown me the way if it's all me :-) I'll revisit later today.

  6. #6
    Senior Member
    Join Date
    Apr 2018
    Posts
    301

    Default

    If your location is set to a specific PirateRealm island, the modifiers remain 0, since "PirateRealm" and "PirateRealm Island" are two different zones.
    Originally Posted by zarqon View Post
    That’s odd, since I had a very specific conversation with Veracity about this. She said that PirateRealm Island is nested within PirateRealm. If PirateRealm Island is within PirateRealm, and the specific islands are within PirateRealm Island, that should work. Clearly one of those things is incorrect. I recall testing it successfully before submitting the patch, but something may have changed. My memory, for instance.

    At any rate, thanks for catching it.
    Last edited by Saklad5; 06-24-2019 at 03:50 PM.

  7. #7
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,674

    Default

    Zones can totally nest. But the above behavior seems to indicate that the zone() function is non-recursive; it simply checks for a match against the location's immediate parent zone, without going any further up or down the tree.

    Changing instances of zone(PirateRealm) to zone(PirateRealm)+zone(PirateRealm Island) ought to yield the desired behavior.

    And thank you for the patch Saklad!
    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!

  8. #8
    Senior Member
    Join Date
    Apr 2018
    Posts
    301

    Default

    OK, I’ve looked at the code in Expression.java that actually evaluates the modifiers, and it looks like it is just doing a case-insensitive match on the zone. I could submit a patch that fixes that, since it is supposed to take nested zones into account.

    There’s a few ways I could implement this, and given the code in question it is probably worth optimizing carefully.

    I’m thinking a bottom-up search would be best, where we check whether the current zone matches the expression, then whether the parent of the current zone matches, then whether the parent ofthat zone matches, until we either get a match or hit a top-level zone.

    Alternatively, we could do a breadth-first top-down search, where we check whether the zone in the expression matches the current zone, then whether any of the children of the zone in the expression match the current zone, then whether any of the children of those zones match, until we get a match or exhaust the possibilities. Since most zones don’t match most modifiers, this seems like it would take more time.
    Last edited by Saklad5; 06-24-2019 at 04:12 PM.

  9. #9
    Senior Member
    Join Date
    Apr 2018
    Posts
    301

    Default

    Zones can totally nest. But the above behavior seems to indicate that the zone() function is non-recursive; it simply checks for a match against the location's immediate parent zone, without going any further up or down the tree.

    Changing instances of zone(PirateRealm) to zone(PirateRealm)+zone(PirateRealm Island) ought to yield the desired behavior.

    And thank you for the patch Saklad!
    Originally Posted by zarqon View Post
    I’d rather just make the zone() function recursive, as I said as you posted that. Existing modifiers for zones like Hobopolis and Spookyraven Manor could benefit from that, not to mention future maintainers. Heck, given the current approach of adding up redundant zone expressions, it might actually yield a small performance increase.

    And again, thanks for catching the issue.
    Last edited by Saklad5; 06-24-2019 at 04:30 PM.

  10. #10
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    11,870

    Default

    Id rather just make the zone() function recursive, as I said just now. Existing modifiers for zones like Hobopolis and Spookyraven Manor could benefit from that, not to mention future maintainers. Heck, given the current approach of adding up redundant zone expressions, it might actually yield a small performance increase.
    Originally Posted by Saklad5 View Post
    That's fine. If you are on Battle Island, you are in PirateRealm Island and are also in PirateRealm.
    I'm all for adjusting modifier expressions that currently use multiple subzones to use the super zone instead. There are only a few, actually:

    Code:
    Item	doll-eye amulet	Single Equip, Item Drop: [40*(zone(Manor0)+zone(Manor1)+zone(Manor2)+zone(Manor3))]
    Item	stinky fannypack	Stench Damage: +25, Stench Spell Damage: +25, Item Drop: [40*(zone(Spring Break Beach)+zone(Conspiracy Island)+zone(Dinseylandfill)+zone(That 70s Volcano)+zone(The Glaciest))]
    Effect	Expert Vacationer	Experience Percent (Muscle): [25*(zone(Spring Break Beach)+zone(Conspiracy Island)+zone(Dinseylandfill)+zone(That 70s Volcano)+zone(The Glaciest))], Experience Percent (Mysticality): [25*(zone(Spring Break Beach)+zone(Conspiracy Island)+zone(Dinseylandfill)+zone(That 70s Volcano)+zone(The Glaciest))], Experience Percent (Moxie): [25*(zone(Spring Break Beach)+zone(Conspiracy Island)+zone(Dinseylandfill)+zone(That 70s Volcano)+zone(The Glaciest))]
    Those could use zone(Manor) and zone(Elemental International Airport).
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

Posting Permissions

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