Help on seek and hide

This is my code:

# Gather 4 lightstones to defeat the Brawler.
# If you find a lightstone, hide.

def checkTakeHide(item):
    if item:
        # The item is here, so take it.
        hero.moveXY(item.pos.x, item.pos.y)
        # Then move to the center of the camp (40, 34)
        hero.moveXY(40, 34)


# Move to the top right X mark.
hero.moveXY(54, 53)
hero.moveXY(68, 56)
 # Search for a lightstone there.
while true:
    lightstone = hero.findNearestItem()
     # Call checkTakeHide with the argument: lightstone
    checkTakeHide(lightstone)
        # Move to the top left mark.
    
    # Search for a lightstone.
    
    # Call the checkTakeHide function.
    # Pass in the result of your search as an argument.
    
    

Delete the while True loop here. Also delete the break.

I did that but then he just stands there

Once you do that, what is your code?

while True:
    # Search for a lightstone there.
    lightstone = hero.findNearestItem()
    # Call checkTakeHide with the argument: lightstone
    checkTakeHide(lightstone)
    # Move to the top left mark.
    
    # Search for a lightstone.

[/quote]

What is your full code (including the function)?

# Gather 4 lightstones to defeat the Brawler.
# If you find a lightstone, hide.

def checkTakeHide(item):
    if item:
        # The item is here, so take it.
        hero.moveXY(item.pos.x, item.pos.y)
        # Then move to the center of the camp (40, 34)
        hero.moveXY(40, 34)


# Move to the top right X mark.
hero.moveXY(54, 53)
hero.moveXY(68, 56)
 # Search for a lightstone there.
while true:
    lightstone = hero.findNearestItem()
     # Call checkTakeHide with the argument: lightstone
    checkTakeHide(lightstone)
        # Move to the top left mark.
    
    # Search for a lightstone.
    
    # Call the checkTakeHide function.

Delete the two move statements outside the while true loop. In your while true loop, move to (68,56) and check for the nearest item. Then use checkTakeHide(item) replacing item with your variable. Do the same thing again within your while true loop except this time instead of moving to (68,56), move to the coordinates (12,56).

I cant get there()()

What do you mean you can’t get there. Can you take a screenshot and post your updated code?

image

Try using a different hero.

Ok i got there but then i just stay still

I think I found the problem. You need to put your 2 moveXY commands inside the while true loop, like this:

while true:
moveXY(54, 53)
lightstone = hero.findNearestItem()
checkTakeHide(lightstone)
moveXY(68, 56)
lightstone = hero.findNearestItem()
checkTakeHide(lightstone)

and include the function
(sorry for my bad formatting)

Thanks. But the first move xy was unnecessary. After you take that out you put move 12 56.

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.