Switch

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Dracon
Posts: 3
Joined: Wed Jun 10, 2009 8:54 am

Switch

#1 Post by Dracon » Sun Oct 25, 2009 10:21 pm

Hi any 1 can tell me how i switch weapon when loss durbality?
Dont want go to repair itp want only simple switch for another from backpack
Ty for all info

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

Re: Switch

#2 Post by d003232 » Mon Oct 26, 2009 12:55 am

Dracon wrote:Hi any 1 can tell me how i switch weapon when loss durbality?
Dont want go to repair itp want only simple switch for another from backpack
Ty for all info

Code: Select all

<onLeaveCombat>
	local dura = inventory:getMainHandDurability();
	printf("Durability:%s\n", dura);
	if( dura < 0.9 ) then
		inventory:useItem(itemNameOrId);
	end
</onLeaveCombat>
The RoM Bot Online Wiki needs your help!

Dracon
Posts: 3
Joined: Wed Jun 10, 2009 8:54 am

Re: Switch

#3 Post by Dracon » Mon Nov 02, 2009 2:57 am

Not work fine get this error

/scripts/rom/settings.lua:584: Failed to compile and run Lua code for onLeaveCombat in character profile


Any idea why?

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

Re: Switch

#4 Post by d003232 » Mon Nov 02, 2009 3:12 am

Dracon wrote:Not work fine get this error

/scripts/rom/settings.lua:584: Failed to compile and run Lua code for onLeaveCombat in character profile


Any idea why?
No. But the chances are better if you post your profile / event. :-)
The RoM Bot Online Wiki needs your help!

Dracon
Posts: 3
Joined: Wed Jun 10, 2009 8:54 am

Re: Switch

#5 Post by Dracon » Mon Nov 02, 2009 5:09 am

Code: Select all

<profile>
	<options>
		<option name="HP_LOW" value="85" />
		<option name="MP_LOW_POTION" value="40" />
		<option name="HP_LOW_POTION" value="55" />

		<option name="COMBAT_TYPE" value="melee" />
		<option name="COMBAT_DISTANCE" value="150" />
		<option name="ANTI_KS" value="true" />
		<option name="WAYPOINTS" value="ren.xml" />
		<option name="LOOT" value="true" />
		<option name="LOOT_TIME" value="800" />
		<option name="ENERGY_STORAGE_1" value="rage" />
		<option name="ENERGY_STORAGE_2" value="mana" />
		<option name="POTION_COOLDOWN" value="15" />
		<option name="MAX_FIGHT_TIME" value="30" />
		<option name="DOT_PERCENT" value="40" />
                <option name="COMBAT_RANGED_PULL" value="true" /> <!-- only important for melees -->
	</options>

	<friends>
		<friend name="Ystra Ferret Cub" />
		<friend name="MyOtherCharacter2" />
	</friends>

	<hotkeys>
		
		<hotkey name="MACRO"        key="VK_0" />
                
	</hotkeys>

	<skills>
                <skill name="ROGUE_THROW"   hotkey="VK_2" priority="110" pullonly="true" maxuse="1"/> <!-- throw then surprise -->
		<skill name="WARRIOR_SLASH" hotkey="VK_3" modifier="" />
		<skill name="WARRIOR_PROBING_ATTACK" hotkey="VK_4" modifier="" />
		<skill name="WARRIOR_OPEN_FLANK" hotkey="VK_5" modifier="" />
                <skill name="PRIEST_URGENT_HEAL" hotkey="VK_6" modifier="" />
                
	</skills>

	<onDeath>
		-- Additional Lua code to execute on death
	</onDeath>

	<onLeaveCombat>
         local dura = inventory:getMainHandDurability();
   printf("Durability:%s\n", dura);
   if( dura < 0.9 ) then
      inventory:useItem(Folding-tooth Axe);
   end

        </onLeaveCombat>

	<onSkillCast>
		-- Additional Lua code to execute when casting a skill
		-- Note: arg1 contains the skill being used.
		-- i.e. arg1.Name will be the name of the skill being cast.
	</onSkillCast>
</profile>

and i see this in setting meybe problem is here
onDeath = nil,
onLoad = nil,
onLeaveCombat = nil,
onSkillCast = nil,
onLevelup = nil,

EDIT: insert CODE tag (d003232)

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

Re: Switch

#6 Post by d003232 » Mon Nov 02, 2009 5:16 am

The item name is not a variable. So you need some quotation marks.

Code: Select all

inventory:useItem("Folding-tooth Axe");
btw: pls use code tags for posting code.
The RoM Bot Online Wiki needs your help!

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests