Results 1 to 3 of 3

Thread: First combat action ignored when using adv1()/adventure() macros.

  1. #1
    Senior Member
    Join Date
    Jan 2014
    Posts
    156

    Default First combat action ignored when using adv1()/adventure() macros.

    r18016

    This may be a KOL bug, but I'm documenting it here. I haven't reported it in-game.

    The first combat action taken in a macro, passed into adv1() or adventure(), will be skipped.

    Running this command will not olfact crates:
    Code:
    > ashq adv1($location[noob cave], 0, "skill 19; runaway; repeat;");
    
    Visit to Mountain: Noob Cave in progress...
    
    [335] Noob Cave
    Encounter: crate
    Strategy: helix fossil [default]
    Round 0: Ezandora wins initiative!
    Round 0: Ezandora casts TRANSCENDENT OLFACTION!
    Round 1: Ezandora casts RETURN!
    
    Requests complete.
    
    > ash $effect[on the trail].have_effect()
    
    Returned: 0
    Note that mafia believes olfaction happened, but it did not. The game's response does include "<!-- macroaction: skill 19 -->" in the HTML, but no attempt to cast olfaction occurs.

    This bug can also be triggered via other commands:
    Code:
    ashq adv1($location[noob cave], 0, "runaway; attack;");
    ashq adventure(1, $location[noob cave], "skill 19; runaway; repeat;");
    Seemingly, conditionals aren't affected. It's the first action, not first conditional, that the game skips:
    Code:
    > ashq adventure(1, $location[noob cave], "if monstername crate; skill 19; endif; runaway; repeat;");
    
    Visit to Mountain: Noob Cave in progress...
    
    [343] Noob Cave
    Encounter: crate
    Strategy: helix fossil [default]
    Round 0: Ezandora wins initiative!
    Round 0: Ezandora casts TRANSCENDENT OLFACTION!
    Round 1: Ezandora casts RETURN!
    
    Requests complete.
    
    > ash $effect[on the trail].have_effect()
    
    Returned: 0
    If I manually load adventure.php then submit the macro to fight.php myself, the bug does not occur:
    Code:
    > ashq visit_url("adventure.php?snarfblat=240");
    
    [339] Noob Cave
    Encounter: crate
    Round 0: Ezandora wins initiative!
    
    > ashq visit_url("fight.php?action=macro&macrotext=" + url_encode("skill 19; runaway; repeat;"), true, true);
    
    Round 1: Ezandora executes a macro!
    Round 1: Ezandora casts TRANSCENDENT OLFACTION!
    You acquire an effect: On the Trail (40)
    Round 2: Ezandora casts RETURN!

    I believe this is because adventure() loads URLs in a slightly different way, as part of the adventure.php redirect:
    Code:
    Requesting: https://www.kingdomofloathing.com/adventure.php?snarfblat=240
    Retrieved: https://www.kingdomofloathing.com/adventure.php?snarfblat=240
    Field: null = [HTTP/1.1 302 Moved Temporarily]
    Field: Location = [fight.php?ireallymeanit=1494283352]
    
    Requesting: https://www.kingdomofloathing.com/fight.php?ireallymeanit=1494283352&action=macro&macrotext=skill+19%3Brunaway%3Brepeat%3B
    adventure.php redirects to "fight.php?ireallymeanit=1494283352". Mafia does not strictly follow that redirect - it also submits macro text along with it. The game then executes the macro, but with the first action skipped.

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

    Default

    I'll look at this this weekend, unless somebody has time/interest to look at it before then.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

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

    Default

    Revision 18023 will follow the initial redirect with ireallymeanit before starting the fight automation.

    A pity, since macrofying the original redirect saved a server hit.
    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
  •