custom function for when bot is stuck?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

custom function for when bot is stuck?

#1 Post by noobbotter » Thu Jul 30, 2015 7:33 am

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?

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: custom function for when bot is stuck?

#2 Post by beanybabe » Thu Jul 30, 2015 10:51 am

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.

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: custom function for when bot is stuck?

#3 Post by noobbotter » Thu Jul 30, 2015 11:44 am

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.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: custom function for when bot is stuck?

#4 Post by BlubBlab » Thu Jul 30, 2015 11:56 am

here is an example form my profile:

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>
I think admin and rock5 have a lot todo these days
Jack-of-all-trades, but master-of-only of a few :D

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

noobbotter
Posts: 527
Joined: Fri Aug 31, 2012 1:15 pm

Re: custom function for when bot is stuck?

#5 Post by noobbotter » Thu Jul 30, 2015 12:26 pm

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.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: custom function for when bot is stuck?

#6 Post by beanybabe » Thu Jul 30, 2015 6:25 pm

That is fancy something new to play with thank you rock.

Question is there a reason to use GetCurrentWorldMapID() over this getZoneId()

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: custom function for when bot is stuck?

#7 Post by BlubBlab » Thu Jul 30, 2015 6:38 pm

beanybabe wrote:That is fancy something new to play with thank you rock.

Question is there a reason to use GetCurrentWorldMapID() over this getZoneId()
?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.
Jack-of-all-trades, but master-of-only of a few :D

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

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: custom function for when bot is stuck?

#8 Post by lisa » Thu Jul 30, 2015 11:20 pm

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

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: custom function for when bot is stuck?

#9 Post by rock5 » Fri Jul 31, 2015 3:55 am

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.

Code: Select all

function getMapId()
	return memoryReadIntPtr(getProc(),addresses.staticbase_char,0x70c)
end
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.

Code: Select all

function getAreaId()
	return memoryReadIntPtr(getProc(),addresses.staticbase_char,0x6E8)
end
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

Code: Select all

if not (getZoneId() == x and getAreaId() == y) then
But it might be easier to use GetZoneName and a text string, eg.

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest