Change Profile Battle-Parameter in <onload> of th WP.

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
gloover
Posts: 304
Joined: Wed Jul 07, 2010 4:31 am

Change Profile Battle-Parameter in <onload> of th WP.

#1 Post by gloover »

Hey rock.

Is it possible to change (to add) parameter like <ondeath> or <onLeavecombat> in onload part of the WP?

Reason: I have a segment such as "changechannel" in onleavecombat in my profile using one WP, so I have allways to delete this part, using another WP (killing mobs), otherwise it would change the channel after every kill (bad thing especailly using malatina survival ;-))

so back to the question: how can I add or change those parameters in WP onload part?

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

Re: Change Profile Battle-Parameter in <onload> of th WP.

#2 Post by lisa »

Well I'm not rock but I may be able to help lol

Code: Select all

settings.profile.events.onLeaveCombat = function() return 
--add code here
end 
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
BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: Change Profile Battle-Parameter in <onload> of th WP.

#3 Post by BillDoorNZ »

you may also want to do:

Code: Select all

oldOnLeaveCombat = settings.profile.events.onLeaveCombat;

settings.profile.events.onLeaveCombat = function()
--add code here
--call profile on leave combat
  if (oldOnLeaveCombat and (type(oldOnLeaveCombat)=='function')) then
    oldOnLeaveCombat();
  end;
end
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Change Profile Battle-Parameter in <onload> of th WP.

#4 Post by rock5 »

To avoid nesting of functions I ALWAYS do it like this.

Instead of

Code: Select all

oldOnLeaveCombat = settings.profile.events.onLeaveCombat;
use

Code: Select all

if oldOnLeaveCombat = nil then oldOnLeaveCombat = settings.profile.events.onLeaveCombat; end
Of course nesting only happens if you reload the file, eg. when you change characters and reload the file to run another character through it. If the file is only run once, eg. a farming script that just loops until you stop it, then you don't need to do it this way. But it's probably good practice to always do it this way.
  • 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
gloover
Posts: 304
Joined: Wed Jul 07, 2010 4:31 am

Re: Change Profile Battle-Parameter in <onload> of th WP.

#5 Post by gloover »

Thx guys (and ladies) - it works fine.

Now I can create a fine Boss-farming -WP
Post Reply