custom function for when bot is stuck?
-
- Posts: 527
- Joined: Fri Aug 31, 2012 1:15 pm
custom function for when bot is stuck?
I know in the profile you can set LOGOUT_WHEN_STUCK or CLOSE_WHEN_STUCK but I was wondering how I might run custom code when stuck? For example, if I'm stuck and it exceeds 10 retries, I would want to break party causing it to leave an instance and then loadPaths to have my bot follow a path to return to the start. Any way I can do that when max unstick retries exceeds 10?
Re: custom function for when bot is stuck?
I will get stuck in same few places, falling off a ledge, going under some low hanging branch or structure. You can add code to check your height if you dropped below the last wp then fly up to its high and move to it. If stuck at same height you could try wall hack and move toward the closest wp.
Also consider change the wp near were stuck occurs to type=run to move by those areas, also reduce the target distance to more control path it moves.
Last trick is to make double wp. what I mean is anywhere you are changing height up a ramp or down stairs, put 2 wp before and after those spots. Other places to put 2 are a sharp turn around some structure and traveling thru a narrow doorway put 2 in the doorway. Always put 2 were you drop down off a ledge. You will get stuck much less.
I have seen Lisa put some nice unstuck code in wp but none of the names come to mind.
Also consider change the wp near were stuck occurs to type=run to move by those areas, also reduce the target distance to more control path it moves.
Last trick is to make double wp. what I mean is anywhere you are changing height up a ramp or down stairs, put 2 wp before and after those spots. Other places to put 2 are a sharp turn around some structure and traveling thru a narrow doorway put 2 in the doorway. Always put 2 were you drop down off a ledge. You will get stuck much less.
I have seen Lisa put some nice unstuck code in wp but none of the names come to mind.
-
- Posts: 527
- Joined: Fri Aug 31, 2012 1:15 pm
Re: custom function for when bot is stuck?
The waypoint I was wanting this for is fairly short in an instance and the bot doesn't really get stuck anywhere, but one time the instance glitched causing the shiny portal to not exist and the bot was stuck. I guess I could easily add a check where if after trying to port out, if the zone didn't change, then i can break party to get out, restart client, then load waypoint to get back to start of main waypoint. Thanks Beanybabe.
Re: custom function for when bot is stuck?
here is an example form my profile:
I think admin and rock5 have a lot todo these days
Code: Select all
<onUnstickFailure><![CDATA[
-- Lua code to execute when MAX_UNSTICK_TRIALS is reached.
]]>
if(RoMScript( "GetCurrentWorldMapID();" )~= 6)then
keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
releaseKeys()
player.Unstick_counter = 0;
flagbunch = false;
RoMScript("LeaveParty()");
waitForLoadingScreen();
loadPaths("ks-res-to-pancer");
end
</onUnstickFailure>
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
-
- Posts: 527
- Joined: Fri Aug 31, 2012 1:15 pm
Re: custom function for when bot is stuck?
See? I didn't even know that onUnstickFailure was a function we could use in our Profile. Thanks BlubBlab. That's perfect. I'll modify that to suit my needs.
Re: custom function for when bot is stuck?
That is fancy something new to play with thank you rock.
Question is there a reason to use GetCurrentWorldMapID() over this getZoneId()
Question is there a reason to use GetCurrentWorldMapID() over this getZoneId()
Re: custom function for when bot is stuck?
?My name is not rock I use GetCurrentWorldMapID because I have a list to look them up and they are also independent from the channels.beanybabe wrote:That is fancy something new to play with thank you rock.
Question is there a reason to use GetCurrentWorldMapID() over this getZoneId()
Jack-of-all-trades, but master-of-only of a few
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226
Re: custom function for when bot is stuck?
Actually its easier and better than that.
http://www.solarstrike.net/phpBB3/viewt ... 540#p48540
Have a read =)
Oooh and here again
http://www.solarstrike.net/phpBB3/viewt ... ick#p38786
http://www.solarstrike.net/phpBB3/viewt ... ick#p33427
http://www.solarstrike.net/phpBB3/viewt ... ick#p30161
http://www.solarstrike.net/phpBB3/viewt ... 540#p48540
Have a read =)
Oooh and here again
http://www.solarstrike.net/phpBB3/viewt ... ick#p38786
http://www.solarstrike.net/phpBB3/viewt ... ick#p33427
http://www.solarstrike.net/phpBB3/viewt ... ick#p30161
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: custom function for when bot is stuck?
getZoneId() is independent of channels. It returns the channel as a separate returned value which you can ignore if you don't need it.
A good thing about GetCurrentWorldMapID() is that it is more accurate. It changes when in smaller areas such as cities. Hm... Maybe it can be gotten from memory.
That should work.
I initially thought this changed every time the minimap name changed but it doesn't. For instance both Dust Devil Canyon and Khalara Plateau both have and id of 6. I wonder if I can find a unique id for each time the minimap name changes.
I found something but I don't think the numbers correspond with any value returned by any game functions. The only function I could find that returns a unique value for each name change is GetZoneName() but that returns the name of course, which is language specific.I don't know if anyone wants to use these but if you want to know if you are in a smaller area the most accurate, without using coordinates, would be getAreaId() (or the in game function GetZoneName).
Edit: With further testing looks like getAreaId() only returns a unique id for that zone. You might see the same id used in other zones too. It may still be useful for example to use
But it might be easier to use GetZoneName and a text string, eg.
A good thing about GetCurrentWorldMapID() is that it is more accurate. It changes when in smaller areas such as cities. Hm... Maybe it can be gotten from memory.
Code: Select all
function getMapId()
return memoryReadIntPtr(getProc(),addresses.staticbase_char,0x70c)
end
I initially thought this changed every time the minimap name changed but it doesn't. For instance both Dust Devil Canyon and Khalara Plateau both have and id of 6. I wonder if I can find a unique id for each time the minimap name changes.
I found something but I don't think the numbers correspond with any value returned by any game functions. The only function I could find that returns a unique value for each name change is GetZoneName() but that returns the name of course, which is language specific.
Code: Select all
function getAreaId()
return memoryReadIntPtr(getProc(),addresses.staticbase_char,0x6E8)
end
Edit: With further testing looks like getAreaId() only returns a unique id for that zone. You might see the same id used in other zones too. It may still be useful for example to use
Code: Select all
if not (getZoneId() == x and getAreaId() == y) then
Code: Select all
if RoMScript("GetZoneName()") == getText("zone_text_string") then
- 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
Who is online
Users browsing this forum: Ahrefs [Bot] and 55 guests