Is WPL:reverse broken?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Is WPL:reverse broken?

#1 Post by Giram »

Hi

I was making waypoint file that goes from a to b and would go back using same line. At the end of the line there is npc and i do check just before that if i would go back or repair.

Code: Select all

<!-- # 57 --><waypoint x="1701" z="-3952">    </waypoint>
    <!-- # 58 --><waypoint x="1608" z="-4094">
    local dura = inventory:getMainHandDurability();
    printf("Durability:%s\n", dura);
    if( dura < 90 ) then
        __WPL:setWaypointIndex(__WPL:findWaypointTag("gorepair"));    
    else
        __WPL:reverse();
    end
    
    </waypoint>
    <!-- #  59 --><waypoint x="1666" z="-4163" tag="gorepair">    </waypoint>
    <!-- #  60 --><waypoint x="1683" z="-4639">    </waypoint>
    <!-- #  61 --><waypoint x="1712" z="-4695">
        player:merchant("Isaac Kaid");
        __WPL:reverse();
    </waypoint>
It goes repair but after that it gets stuck on loop. Do i do something wrong here? I am using nevest rev 503.
Attachments
loop.png
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Is WPL:reverse broken?

#2 Post by rock5 »

Your logic is wrong. When it is coming back from repair, the direction is set to backwards. When it gets to point 58 dura is > 90 so it executes the Reverse() command that changes the direction to forward again. So it heads to repair again.

Here's a tip: You hardly ever want to use reverse. Reverse() makes a choice; if you are going forward then go backward, if you are going backward go forward. But usually where it is used it only is expected to change to 1 direction eg. at the end of a file you expect it to only change the direction to backwards.

So, instead try using,

Code: Select all

__WPL:setDirection(WPT_BACKWARD)
when you want to go backwards and

Code: Select all

__WPL:setDirection(WPT_FORWARD)
when you want to go forward.

I, personally, can't think of a situation where I would ever use reverse().
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan
User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: Is WPL:reverse broken?

#3 Post by Giram »

Thanks.

That fixed this problem. I thought that reverse() does same thing than __WPL:setDirection(WPT_BACKWARD) did.

This is from wiki:

Code: Select all

__WPL:reverse();
"Resort the waypoints. Means after running from 1 to 20 you can now run from 20 - 1. It is usefull to put that at the first and at the last waypoint if you want to run between two places."
Post Reply