<onSkillCast> problem /loop

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

<onSkillCast> problem /loop

#1 Post by d003232 » Thu Sep 03, 2009 5:24 am

I want to use the <onSkillCast> event for my emergency skills. Simply because if I use the normal skill casting round, it takes very often to long to use the emergency skills. So my idea is, to check for an emergency situation after every cast.

Code: Select all

<onSkillCast>
	if( 15 > player.HP/player.MaxHP*100 ) then
	    player:cast("PRIEST_SOUL_SOURCE");
	elseif( 25 > player.HP/player.MaxHP*100 ) then
	    player:cast("PRIEST_HOLY_AURA");
	    player:cast("PRIEST_URGENT_HEAL");
	    player:cast("PRIEST_URGENT_HEAL");
	end;
</onSkillCast>
Problems seems now, that the bot also use the '<onSkillCast>' event if he casts allready within <onSkillCast>. So he loop endless.

If I find a little more time, I would/will try to look for a solution.

btw: I couldn't get that coding to work with the '&lt' symbol. So I turn it around as '>' query.
The RoM Bot Online Wiki needs your help!

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

Re: <onSkillCast> problem /loop

#2 Post by Administrator » Thu Sep 03, 2009 7:35 am

Compare arg1.Name with the skill you are casting inside onSkillCast so you know not to try to cast it again. Also, try putting the semicolon in '<' and it should work.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: <onSkillCast> problem /loop

#3 Post by d003232 » Thu Sep 03, 2009 3:41 pm

Administrator wrote:Compare arg1.Name with the skill you are casting inside onSkillCast so you know not to try to cast it again.
The bot will now execute the event onSkillCast only if he cast skills directly from the skill list. It will not be executed, if someone cast a skill from within the onSkillCast event. I think that's the easiest solution and I don't think that people need a recursive onSkillCast event.

I could also create a global variable 'onSkillCast_recursiv' ( true | false) or so, witch could easily checked within the event. But if there are no demands for a recursive use, I would prefere the first solution: onSkillCast event only for skills directly from the skill list.
Administrator wrote: Also, try putting the semicolon in '<' and it should work.
Damned, I never noticed that ';' :evil:
The RoM Bot Online Wiki needs your help!

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests