SUGGESTION: Kill aggros, and rest

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
aasi888
Posts: 64
Joined: Fri May 15, 2009 5:13 am

SUGGESTION: Kill aggros, and rest

#1 Post by aasi888 » Sat May 16, 2009 9:49 am

Coudl you add to the base macro the following: After killing main target check if you are being attacked and clear the aggressive mobs. Then rest (use potions or just wait) to get enough hp to continue. In what file should I put that code?

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: SUGGESTION: Kill aggros, and rest

#2 Post by Administrator » Sat May 16, 2009 5:52 pm

You can put this code in your waypoint script, or within your onLeaveCombat event.

waypoint method:

Code: Select all

  <waypoint x="x" z="z">
    player:clearTarget();
    local lastHP = player.HP
    while(true) do
      player:update();
      if( player.HP == player.MaxHP ) then break; end; -- Full HP, resume

      if( player.HP < lastHP ) then break; end; -- We're taking damage, break
      lastHP = player.HP; -- update our 'lastHP' for checking next repetition

      if( player:haveTarget() ) then break; end; -- We picked up a target, might be getting attacked

      yrest(10);
    end
  </waypoint>
The onLeaveCombat event would work almost exactly the same way, except you place the code inside <onLeaveCombat> and </onLeaveCombat> in your character profile instead.

Bobert
Posts: 10
Joined: Sat May 16, 2009 7:27 pm

Re: SUGGESTION: Kill aggros, and rest

#3 Post by Bobert » Sat May 16, 2009 8:26 pm

Code: Select all

RoM Bot Version 2.38
Attempt to read playerAddress
playerAddr: 0x2BAC6900
playerTarget: 0x0
...dministrator/Desktop/micromacro/scripts/settings.lua:111: XML Parse Error.
File: ...ator/Desktop/micromacro/scripts/profiles/******.xml
Line: 55
Column: 22
Message: not well-formed (invalid token)

Code: Select all

    <onLeaveCombat>
    player:clearTarget();
    local lastHP = player.HP
    while(true) do
      player:update();
      if( player.HP == player.MaxHP ) then break; end; -- Full HP, resume

      if( player.HP < lastHP ) then break; end; -- We're taking damage, break
      lastHP = player.HP; -- update our 'lastHP' for checking next repetition

      if( player:haveTarget() ) then break; end; -- We picked up a target, might be getting attacked

      yrest(10);
    end
	</onLeaveCombat>

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: SUGGESTION: Kill aggros, and rest

#4 Post by Administrator » Sat May 16, 2009 8:45 pm

I guess that's caused by the '<' character being in the charData section of the XML. It's confusing the less than in the Lua code with an XML tag being opened.

Simple fix would be to reverse it:

Code: Select all

if( lastHP > player.HP )
Instead of:

Code: Select all

if( player.HP < lastHP )

Or, you could make that code a function in functions.lua, and call it from onLeaveCombat.

Or, you can replace the '<' in the code with '<'.

aasi888
Posts: 64
Joined: Fri May 15, 2009 5:13 am

Re: SUGGESTION: Kill aggros, and rest

#5 Post by aasi888 » Mon May 25, 2009 11:49 am

By adding those lines I got a new problem. MY bot will never loot.

EDIT: solved by editing profile.lua

I put this after looting and not before.

Code: Select all

	if( type(settings.profile.events.onLeaveCombat) == "function" ) then
		local status,err = pcall(settings.profile.events.onLeaveCombat);
		if( status == false ) then
			local msg = sprintf("onLeaveCombat error: %s", err);
			error(msg);
		end
	end
EDIT2: How can i set the health values below i want to rest? I'dd like to define new values for HP_LOW_REST and HP_STAND. How to do this?
I tried to use HP_LOW_POTION value:
if( player.HP < settings.profile.options.HP_LOW_POTION ) then keyboardPress(key.VK_EQUAL); break; end;

But it doesn't allow me to use it like that.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: SUGGESTION: Kill aggros, and rest

#6 Post by Administrator » Mon May 25, 2009 8:07 pm

aasi888 wrote: EDIT2: How can i set the health values below i want to rest? I'dd like to define new values for HP_LOW_REST and HP_STAND. How to do this?
I tried to use HP_LOW_POTION value:
if( player.HP < settings.profile.options.HP_LOW_POTION ) then keyboardPress(key.VK_EQUAL); break; end;

But it doesn't allow me to use it like that.
Just add them into your profile and they will be created, then you can access them through settings.profile.options.HP_LOW_REST and HP_STAND. I would really suggest not bothering with sitting, though. It has been discussed before; everybody thinks it's useless and adds unnecessary complication. You'll begin to see that sitting to heal outside of combat is just not worth it. You really are better off just buying a lot of health potions.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests