onSkillCast & onPreSkillCast problem

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

onSkillCast & onPreSkillCast problem

#1 Post by Mushroomstamp » Wed Nov 03, 2010 1:30 pm

Can someone tell me where I've gone wrong with these? Giving an onSkillCast error on this one.

Code: Select all

	<onSkillCast>
	player:updateBuffs()
		if player.Debuffs["Stun"] then
			cast("SHIELD_OF_TRUTH")
		elseif player.Debuffs["Fear"] then
			cast("FEARLESS")
	end
	</onSkillCast>
And on this one... character is trying to cast Threaten and Mana Return regardless of holy seals on target:

Code: Select all

	
<onPreSkillCast>
	if player:haveTarget() then
		local deBuffs = {};
		for i = 1,#deBuffs,2 do
			deBuffs[i] = RoMScript("UnitDebuff('target', "..i..")");
			if deBuffs[i] == "Holy Seals (3)" then
				RoMScript("CastSpellByName('Threaten')");
				break;
			elseif deBuffs[i] == "Holy Seals (1)" then
				RoMScript("CastSpellByName('Mana Return')");
				break;  
			end
		end
	end
</onPreSkillCast>
Need at least one Holy Seal on target to cast Mana Return, and need 3 to cast Threaten.

Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Re: onSkillCast & onPreSkillCast problem

#2 Post by Mushroomstamp » Fri Nov 05, 2010 7:23 am

I changed the onSkillCast to;

Code: Select all

   <onSkillCast>
   player:updateBuffs()
      if player.Debuffs["Stun"] then
         cast("SHIELD_OF_TRUTH") --also tried "KNIGHT_SHIELD_OF_TRUTH", and "Shield of Truth"--
      end
   end
   </onSkillCast>
And I get an error that the skill is undefined. However it IS in skills AND local skills. What would cause an undefined skill error for a skill that IS showing to be defined?

Also, preSkillCast works if there is only one event like this;

Code: Select all

   local targetPawn = CPawn(player.TargetPtr);
   if( arg1.Name == "KNIGHT_THREATEN" ) then
      if( targetPawn ~= nill and targetPawn ~= 0 and targetPawn  ~= player.Address ) then
         local bool, count = targetPawn:hasDebuff("Holy Seals (3)");
         if( bool == true ) then
            return true;
         else
            return false;
         end
      else
         return true;
      end
   else
      return true;
   end
In addition to how it's written in my first post, I also tried it this way to no avail;

Code: Select all

	<onPreSkillCast>
	if player:haveTarget() then
		local deBuffs = {};
		for i = 1,#deBuffs,2 do
			deBuffs[i] = RoMScript("UnitDebuff('target', "..i..")");
			if deBuffs[i] == "Holy Seals (3)" then
				RoMScript("CastSpellByName('Threaten')");
				break;
			elseif deBuffs[i] == "Holy Seal (1)" then
				RoMScript("CastSpellByName('Mana Return')");
				break;  
			end
		end
	end
	</onPreSkillCast>
The wiki seems to be grossly outdated and very little of the code there has worked for me, so any help or direction is appreciated.

Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Re: onSkillCast & onPreSkillCast problem

#3 Post by Mushroomstamp » Fri Nov 05, 2010 12:09 pm

Well, I got rid of the onPreSkillCast script and just added some stuff to the skill definitions to get these working.

Code: Select all

	<skill name="KNIGHT_MANA_RETURN" skilltab="3" skillnum="3" range="100" cooldown="10" type="damage" target="enemy" reqbufftype="debuff" reqbuffcount="1" reqbufftarget="target" reqbuffname="Holy Seal (1)" />
	<skill name="KNIGHT_THREATEN" skilltab="4" skillnum="11" mana="30" manainc="3.0" range="50" cooldown="8" type="damage" target="enemy" reqbufftype="debuff" reqbuffcount="3" reqbufftarget="target" reqbuffname="Holy Seals (3)" />

Post Reply

Who is online

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