[Suggestion] Additional Method Hook

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
evilband7
Posts: 15
Joined: Thu Aug 18, 2011 10:39 am

[Suggestion] Additional Method Hook

#1 Post by evilband7 »

First, my English skill is poor. please try to understand what i mean. T^T

I just wanna suggest what i did to the scripts. ;D

Is it a good idea to add method hook for some action ? such as beforeBotFight and afterBotFight.

this is example for CPlayer:fight()

Code: Select all

function CPlayer:fight()
   if( not self:haveTarget() ) then
      return false;
  end
  pcall(beforeBotFight);  -- i add beforeFight method hook here.
  ....
  ....
  ....
  ...
  pcall(afterBotFight);   -- and add afterFight method hook here.
end -- end of CPlayer:fight()

if i wanna use this method hook just add the function to userfunction, <onload> in waypoint.xml or <onload> in profile.xml

Code: Select all

<onload>
function afterBotFight()
   cprintf(cli.yellow, "[INFO] this is afterBotFight() method.");
end
</onload>
and the reason I added afterBotFight method because <onLeaveCombat> was hooked before looting. ;(
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: [Suggestion] Additional Method Hook

#2 Post by rock5 »

For yourself, that is ok. The nice thing about SVN is when you do an update it normally wont affect your edits so they remain in affect until you remove them.

Or are you asking if they should be added to the bot for everyone?
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: [Suggestion] Additional Method Hook

#3 Post by lisa »

There was discussion about making the event "preCodeOnElite" to be for all mobs and not just elite and then if people wanted they could just do a HP check if they wanted to. So that would be the code before starting combat.


As for code before looting and after combat, just set loot to false and put the code in onleavecombat and then add in the player:loot() at the end of the onleavecombat. This can be done without altering the bot at all and just altering your profile.
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
Post Reply