Addon or userfuction ??!!??

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
noobyone
Posts: 16
Joined: Mon Feb 27, 2012 5:29 am

Addon or userfuction ??!!??

#1 Post by noobyone » Mon Feb 27, 2012 7:00 am

Hello eweryone,
First of all: TANK U SO MUTCH FOR YOUR WONDERFULL JOB !!!
I was using your bot, some years ago with help of rompros comunity... but they are all gone and the site have ben hacked.
So having start to play again since two months i found your forum and i can just say WOW, i just love : MRC optimized, cavia catch function, invaders, and I'm realy exited with the SOLO (leveling bot) developement.
I'm sure some of my questions are answred somewhere in the forum, but i read much and dident find.

Now my first question:
I downloaded :
userfuncion_teleport.lua
userfuncion_catchcavy.lua
invaders_userfunction.lua
If I understand everything I should have an addon folder (i dont have, and i have updated the bot):
so do i create a new folder "addon" and rename the lua files like this ?:
addon_teleport.lua
addon_catchcavy.lua
addon_invaders_userfunction.lua
or do i stay with my "userfunctions" folder and the orginal names of the lua?

Second question:
I want to have all my skills working with events so I'm using the <onSkillCast> function.
I already have:

Code: Select all

<onSkillCast><![CDATA[
 		local target = player:getTarget();
	if( 50 < target.HP/target.MaxHP*100 ) then
		player:cast("MAGE_LIGHTNING");
		local target = player:getTarget();
	elseif( 70 < target.HP/target.MaxHP*100 ) then
		player:cast("MAGE_INTENSIFICATION");
	elseif( 30 > target.HP/target.MaxHP*100 ) then
		player:cast("MAGE_FIREBALL");
	end;
	]]></onSkillCast>
And it seems to work fine.
How could I set a skill working only if the number of mobs i have agro is > 2 and if they are in range of 50. It's for: MAGE_PURGATORY_FIRE
And can i write a multiple cast on same event like:

Code: Select all

              elseif( 70 < target.HP/target.MaxHP*100 ) then
		player:cast("MAGE_INTENSIFICATION") and player:cast("MAGE_ENERGY_INFLUX");
Thanks for your help !

PS: I'm not dumb but I'm french so sometimes I dont understand everything :p

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Addon or userfuction ??!!??

#2 Post by rock5 » Mon Feb 27, 2012 8:02 am

For a very short time 'userfunctions' were called 'addons' but it was very quickly changed because it caused confusion with in game addons. When creating a userfunction, it should be prefixed with 'userfunction_' but 'addon_' is still supported for backward compatibility. And there may be some userfunctions created around that time that are still used today but still have the prefix 'addon_' such as my 'addon_Rock5s_Mail_Functions.lua'. It could be changed but then users would have to manually delete the old 'addon_' version. But there's no real need. Just remember everything that starts with 'userfunction_' or 'addon_' is a userfunction and goes into the 'userfunctions folder. Now, when talking about 'addons', we are talking about in game addons.

invaders is an exception. The invaders_functions.lua is not a userfunctions file. I just moved some of the code into a separate file for convenience. As the instructions say on the web page, it needs to be put in the waypoints folder with invaders.xml.

I posted a couple of functions awhile back about counting mobs. I'll just make a few adjustments and make sure it does what you want. I'll make it into a userfunction.
userfunction_countmobs.lua
(626 Bytes) Downloaded 127 times
So put this in the userfunctions folder. You can use it like this,

Code: Select all

if CountMobs(true, 50) > 2 then
    player:cast("MAGE_PURGATORY_FIRE");
end
The first argument is if you want to count only aggro mobs and the second argument is the range you want.

You can put the 2 casts on the one line but don't put "and" between them. You can put nearly any code on one line. eg.

Code: Select all

if player.Casting == true then
    yrest(1000)
else
    print("failed to cast")
end
could be written as

Code: Select all

if player.Casting == true then yrest(1000) else print("failed to cast") end
  • 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

Golbez
Posts: 66
Joined: Sat Aug 02, 2008 8:27 pm

Re: Addon or userfuction ??!!??

#3 Post by Golbez » Mon Feb 27, 2012 8:57 am

just wondering how i could incorporate this just in case when im running around and i pick up more then 1 mob.

noobyone
Posts: 16
Joined: Mon Feb 27, 2012 5:29 am

Re: Addon or userfuction ??!!??

#4 Post by noobyone » Mon Feb 27, 2012 7:04 pm

Thx Rock... I want now to hurry my mage bot to be hight enouth try this XD
Betwen the moment i wrote on the forum an I came back read your post, i found some infos so i tryed this:

Code: Select all

<onSkillCast><![CDATA[
	local target = player:getTarget();
 	if( 30 > player.HP/player.MaxHP*100 ) then
		player:cast("PRIEST_HOLY_AURA");
		player:cast("PRIEST_URGENT_HEAL");
		player:cast("PRIEST_URGENT_HEAL");
	elseif( 50 > player.HP/player.MaxHP*100 ) then
		player:cast("PRIEST_REGENERATE");
		player:cast("PRIEST_URGENT_HEAL");
	elseif( 50 < target.HP/target.MaxHP*100 ) then
		player:cast("MAGE_LIGHTNING");
	elseif( 70 < target.HP/target.MaxHP*100 ) then
		player:cast("MAGE_INTENSIFICATION");
	elseif( 30 > target.HP/target.MaxHP*100 ) then
		player:cast("MAGE_FIREBALL");
			end;
	]]></onSkillCast>
This seems to be working, but i'm wondering why you used "else", what does it change with just using ";"?
Maybe I should write:
<onSkillCast><![CDATA[
local target = player:getTarget();
if( 30 > player.HP/player.MaxHP*100 ) then
player:cast("PRIEST_HOLY_AURA");
else
player:cast("PRIEST_URGENT_HEAL");
else
player:cast("PRIEST_URGENT_HEAL");
elseif( 50 > player.HP/player.MaxHP*100 ) then
player:cast("PRIEST_REGENERATE");
else
player:cast("PRIEST_URGENT_HEAL");
elseif( 50 < target.HP/target.MaxHP*100 ) then
player:cast("MAGE_LIGHTNING");
elseif( 70 < target.HP/target.MaxHP*100 ) then
player:cast("MAGE_INTENSIFICATION");
elseif( 30 > target.HP/target.MaxHP*100 ) then
player:cast("MAGE_FIREBALL");
end;
]]></onSkillCast>
I think maybe using "else" will make the priority stronger?

And thx for the invaders script, just amazing. I had only the caftsmans quest to do manualy (french client)
Golbez wrote:just wondering how i could incorporate this just in case when im running around and i pick up more then 1 mob.
I think u just write it in your profile in "onskillcast" section.

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

Re: Addon or userfuction ??!!??

#5 Post by lisa » Mon Feb 27, 2012 7:38 pm

Code: Select all

<onSkillCast><![CDATA[
local target = player:getTarget();
if( 30 > player.HP/player.MaxHP*100 ) then
player:cast("PRIEST_HOLY_AURA");
else
player:cast("PRIEST_URGENT_HEAL");
else
player:cast("PRIEST_URGENT_HEAL");
elseif( 50 > player.HP/player.MaxHP*100 ) then
player:cast("PRIEST_REGENERATE");
else
player:cast("PRIEST_URGENT_HEAL");
elseif( 50 < target.HP/target.MaxHP*100 ) then
player:cast("MAGE_LIGHTNING");
elseif( 70 < target.HP/target.MaxHP*100 ) then
player:cast("MAGE_INTENSIFICATION");
elseif( 30 > target.HP/target.MaxHP*100 ) then
player:cast("MAGE_FIREBALL");
end;
]]></onSkillCast>
I really don't see that working in any way, else is for when the "if" criteria isn't met.

Code: Select all

if( 30 > player.HP/player.MaxHP*100 ) then
if ur hp % is less then 30 it will do

Code: Select all

player:cast("PRIEST_HOLY_AURA");
else -- means your hp is greater then 30%, the opposite of less then 30%

Code: Select all

player:cast("PRIEST_URGENT_HEAL");
So basically u will cast urgent heal for ever because your hp will be greater than 30% pretty much all the time.

next line has an else but there is no more if criteria so I can't see that working, it will probably just error.

I think you might need to understand the basics of statements, can't think of any sites off hand but there should be quite a few out there to teach you.
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

Golbez
Posts: 66
Joined: Sat Aug 02, 2008 8:27 pm

Re: Addon or userfuction ??!!??

#6 Post by Golbez » Tue Feb 28, 2012 12:52 am

noobyone wrote:
Golbez wrote:just wondering how i could incorporate this just in case when im running around and i pick up more then 1 mob.
I think u just write it in your profile in "onskillcast" section.
ty

EDIT:
i cant get this working. not sure why.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<profile>
	<options>
		<!-- Try the bot with a new char mage                   -->
		<!-- At the pioneer village. Use demo.xml waypoint file -->
		<option name="HP_LOW"				value="85" />
		<option name="MP_LOW_POTION"		value="50" />
		<option name="HP_LOW_POTION"		value="50" />
		<option name="USE_HP_POTION"		value="best" />			<!-- potion select strategy: best|minstack -->
		<option name="USE_MANA_POTION"		value="best" />			<!-- potion select strategy: best|minstack -->
		<option name="USE_PHIRIUS_POTION"	value="false" /> 		<!-- false | true if you want to use the Phirus Potions -->
		<option name="PHIRIUS_MP_LOW"		value="40" />
		<option name="PHIRIUS_HP_LOW"		value="40" />

		<!-- Rest if HP or Mana is below that level -->
		<option name="HP_REST" 				value="15" />
		<option name="MP_REST" 				value="15" />

		<!-- Shopping options, how many of what do you want to keep in your inventory -->
		<option name="HEALING_POTION" 		value="99" />
		<option name="MANA_POTION" 			value="99" />			<!-- set to "0" if not required to buy -->
		<option name="ARROW_QUIVER" 		value="0" /> 			<!-- set to "0" if not required to buy -->
		<option name="THROWN_BAG" 			value="0" />			<!-- set to "0" if not required to buy -->
		<option name="POISON" 				value="0" />			<!-- set to "0" if not required to buy -->

		<!-- either false or arrow or thrown -->
		<option name="RELOAD_AMMUNITION" 	value="false" />		<!-- false|arrow|thrown -->

		<!-- Combat options -->
		<option name="COMBAT_TYPE"        	value="" />				<!-- leave empty or choose ranged/melee if not using class default -->
		<option name="COMBAT_RANGED_PULL" 	value="true" /> 		<!-- only important for melees -->
		<option name="COMBAT_DISTANCE"    	value="200" />
		<option name="MAX_FIGHT_TIME"     	value="15" />			<!-- Max time without damage before break -->
		<option name="DOT_PERCENT"        	value="90" />
		<option name="ANTI_KS"            	value="true" />
		<option name="MAX_TARGET_DIST"    	value="225" />

		<!-- Attack monsters 3 levels above or 10 below your level -->
		<option name="TARGET_LEVELDIF_ABOVE" value="5" />
		<option name="TARGET_LEVELDIF_BELOW" value="10" />

		<!-- Waypoint and movement settings -->
		<option name="WAYPOINTS"			value="" />  			<!-- leave empty to show a list -->
		<option name="RETURNPATH"			value="" />
		<option name="PATH_TYPE"			value="waypoints" />	<!-- waypoints | wander -->
		<option name="WANDER_RADIUS"		value="500" />
		<option name="WAYPOINT_DEVIATION"	value="0" />
		<option name="QUICK_TURN" 			value="true" />

		<!-- Loot settings -->
		<option name="LOOT"               	value="false" />
		<option name="LOOT_ALL"			  	value="false" />  		<!-- Loot all nearby dead mobs after combat -->
		<option name="LOOT_IN_COMBAT"     	value="true" />
		<option name="LOOT_DISTANCE"      	value="100" />
		<option name="LOOT_PAUSE_AFTER"   	value="0" />			<!-- probability in % for a short rest -->

		<!-- Auto selling options when used with player:merchant -->
		<option name="INV_AUTOSELL_ENABLE"	value="true" />		<!-- true | false -->
		<option name="INV_AUTOSELL_FROMSLOT" value="1" /> 			<!-- 1 = bag 1 slot 1 -->
		<option name="INV_AUTOSELL_TOSLOT"	value="70" /> 			<!-- 30 = last slot bag 1 -->
		<option name="INV_AUTOSELL_QUALITY"	value="white,green" /> 	<!-- white,green,blue,purple  -->

		<!-- Harvest options -->
		<option name="HARVEST_DISTANCE"		value="120" />
		<option name="HARVEST_WOOD"			value="true" /> 		<!-- Choose which types to harvest. -->
		<option name="HARVEST_HERB"			value="true" /> 		<!-- "true" = harvest, "false" = do not harvest -->
		<option name="HARVEST_ORE"			value="true" />

		<!-- Eggpet options -->
		<option name="EGGPET_ENABLE_CRAFT"	value="false" />		<!-- If using same slot for assist and craft, onlt 1 can be enabled. -->
		<option name="EGGPET_CRAFT_SLOT"	value="1" />
		<option name="EGGPET_ENABLE_ASSIST"	value="true" />
		<option name="EGGPET_ASSIST_SLOT"	value="2" />
		<option name="EGGPET_CRAFT_RATIO"	value="1:1:1" /> 		<!-- mining:woodworking:herbalism ratio to produce. -->
		<option name="EGGPET_CRAFT_INDEXES"	value="" /> 	 		<!-- override auto craft index for mining,woodworking,herbalism eg. "2,,"-->


		<!-- Log out and resurrect settings -->
		<option name="LOGOUT_TIME" 			value="0" />			<!-- in minutes, 0 = timer disabled -->
		<option name="LOGOUT_SHUTDOWN"		value="false" />
		<option name="LOGOUT_WHEN_STUCK"	value="true" />
		<option name="CLOSE_WHEN_STUCK"		value="true" />
		<option name="RES_AFTER_DEATH" 		value="true" />
		<option name="MAX_DEATHS" 			value="10" /> 			<!-- Log out after this many deaths -->

		<!-- Party Bot options  -->
		<!-- <option name="PARTY"			value="true" /> -->
		<!-- <option name="PARTY_ICONS"		value="true" /> -->
		<!-- <option name="PARTY_INSTANCE"	value="true" /> -->

		<!-- Healing options -->
		<!-- <option name="HEALER_FIGHT"		value="true" /> --> 	<!-- For party bot if you want healer to also fight -->

		<!-- pvp -->
		<!--option name="PVP"			value="true" /> --> 		<!-- To enable PVP, with this set to true it will auto attack any players with red names -->

		<!-- For more options and documentation see the RoM Bot Wiki:  -->
		<!-- http://www.solarstrike.net/wiki/index.php5?title=RoM_Bot  -->

		<!-- GM detection options -->
		<option name="GMDETECT"         	value="true" /> -- enables the GM detection userfunction
		<option name="GMnearbylogout"      	value="true" /> -- If a GM is close to the character it will log out.
		<option name="PAUSEONGM"      		value="600" />  -- Pauses when GM whispers for value in seconds. ie 300 = 5 minutes
		<option name="RECALL"         		value="true" /> -- if in combat while pausing it will use recall and whisper/logout

		<option name="jParty_BotMaster" value="" />
		<option name="jParty_BotAssist" value="" /> 				--	The bot will assist this member if a fight is engaged
		<option name="jParty_BotFollowed" value="" /> 				--	The bot will follow this member
		<option name="jParty_FollowingDistance" value="30" /> 		--	The bot will keep this distance with the BotFollowed
		<option name="jParty_BotHealer" value="false" /> 			--	The bot will heal
		<option name="jParty_BotDPSer" value="false" /> 				--	The bot will Fight the target of BotAssist if in combat
		<option name="jParty_BotLooter" value="false" /> 			--	The bot will loot
		<option name="jParty_Heal" value="PRIEST_URGENT_HEAL" />	--	Your main heal
		<option name="jParty_BigHeal" value="PRIEST_HEAL" /> 		--	Your Big heal
		<option name="jParty_Regen" value="PRIEST_REGENERATE" /> 	--	Your regen (The bot will only regen if jParty_RegenBuffName is not found on party members and if IN combat
		<option name="jParty_RegenBuffName" value="Regenerate" /> 	--	The name of your buff's regen

	</options>

	<friends>
		<!-- names of friends we help fighting or enemys we don't want to attack -->
		<!-- for umlauts use \129 (ue),\132 (ae),\148 (oe) e.g. K\132fer         -->
		<friend name="MyOtherCharacter1" />
		<friend name="MyOtherCharacter2" />
		<friend name="Elite_Mob_Name1" />
		<friend name="Elite_Mob_Name2" />
	</friends>

	<mobs>
		<!-- names of mobs we want to attack 				-->
		<!-- if no names defined we will attack all mobs	-->
		<mob name="" />
		<mob name="" />
		<mob name="" />
	</mobs>

	<hotkeys>
    	<!-- to communicate with the RoM API / define ingame dummy macro at place 1 -->
		<hotkey name="MACRO"          key="VK_0" />
	</hotkeys>

	<!-- define your skills depending from your actual primary class -->
	<!-- see the example for a priest/mage                           -->
	<!-- delete skills you don't have or don't want to use.          -->
	<!-- For more skills to use see /database/skills.xml             -->
	<!-- demo skills for LvL 1 character for all classes             -->
	<!-- to use a specific key instead of MACRO then use hotkey="VK_1" this example is for hotkey 1 -->
	<skills_priest>
		<skill name="PRIEST_SOUL_SOURCE"     	hotkey="MACRO" priority="110" inbattle="true" hpper="15" />
		<skill name="PRIEST_URGENT_HEAL"     	hotkey="MACRO" priority="100" hpper="50"  />
		<skill name="PRIEST_REGENERATE"      	hotkey="MACRO" priority="90"  hpper="80" />
		<skill name="PRIEST_RISING_TIDE"     	hotkey="MACRO" priority="80" />
		<skill name="PRIEST_WAVE_ARMOR"      	hotkey="MACRO" priority="40"  inbattle="true" />
		<skill name="PRIEST_AMPLIFIED_ATTACK" 	hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" />
		<skill name="PRIEST_GRACE_OF_LIFE" 		hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" />
		<skill name="PRIEST_HOLY_AURA"       	hotkey="MACRO" priority="100" inbattle="true" hpper="24" />
		<!--skill name="PRIEST_SOUL_BOND"     	hotkey="MACRO" priority="30" /> -->
		<!--skill name="PRIEST_MAGIC_BARRIER" 	hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" /> -->
	</skills_priest>

	<skills_mage>
		<skill name="MAGE_LIGHTNING"            hotkey="MACRO" priority="50" />
		<skill name="MAGE_FLAME"                hotkey="MACRO" priority="80" />
		<skill name="MAGE_FIREBALL"             hotkey="MACRO" priority="80" />
		<skill name="PRIEST_RISING_TIDE"        hotkey="MACRO" priority="50" />
		<skill name="MAGE_ELEMENTAL_WEAKNESS"   hotkey="MACRO" priority="85" nobuffname="target" nobufftarget="target"/>

		<skill name="MAGE_INTENSIFICATION"       hotkey="MACRO" priority="20" hpper="15" />
		<skill name="MAGE_ENERGY_WELL"            hotkey="MACRO" priority="30" inbattle="true" />
		<skill name="MAGE_ENERGY_INFLUX"         hotkey="MACRO" priority="30" inbattle="true" />
		<skill name="MAGE_ELEMENTAL_CATALYST"   hotkey="MACRO" priority="60" manaper="75" inbattle="true" />
		<skill name="MAGE_ESSENCE_OF_MAGIC"    hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" />
		<skill name="MAGE_FIRE_WARD"         hotkey="MACRO" priority="20" rebuffcut="50" inbattle="false" />
		<skill name="PRIEST_BLESSED_SPRING_WATER"   hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" />
		<skill name="PRIEST_MAGIC_BARRIER"     hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false"/>

		<skill name="PRIEST_URGENT_HEAL"        hotkey="MACRO" priority="100" hpper="60"  />
		<skill name="PRIEST_REGENERATE"         hotkey="MACRO" priority="90"  hpper="80" />
		<skill name="MAGE_ELECTROSTATIC_CHARGE" hotkey="MACRO" priority="100" inbattle="true" hpper="35" nobuffname="player" nobufftarget="player"/>
		<skill name="PRIEST_HOLY_AURA"          hotkey="MACRO" priority="100" inbattle="true" hpper="25" />
	</skills_mage>

	<onLoad>
		startGMDetect()
		include("userfunctions/userfunction_countmobs.lua",true)
	</onLoad>

	<onDeath><![CDATA[
		-- Additional Lua code to execute on death
		-- pauseOnDeath(); -- Stop the script
		-- player:logout();	-- logout
	]]></onDeath>

	<onLeaveCombat>
	if (not player:hasBuff(495431)) then
		inventory:useItem(204514);  -- Uses Magic Perfume
	end
	</onLeaveCombat>

	<onLevelup><![CDATA[
		-- Additional Lua code to execute after having a levelup
		-- and levelup the skills for a new character (mage or priest recommended)
		-- e.g. sendMacro("SetSpellPoint(_tabnr, _skillnr);"); would levelup a skill
	]]></onLevelup>

	<onSkillCast><![CDATA[
		-- 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
		-- e.g.:
		--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");]]>
		if CountMobs(true, 50) > 2 then
			printf("Getting Attack by more then 1 Enemy")
			player:cast("MAGE_PURGATORY_FIRE");
		end
	</onSkillCast>

	<onHarvest><![CDATA[
		-- Additional Lua code to execute directly before the actual harvesting takes place.
		-- Note: arg1 contains the object to be harvested.
		-- i.e. arg1.Name will be the name of the node you are about to harvest
		-- If this snippet returns 'false', the node will *not* be harvested.
		-- All other return values result in the player attempting to harvest the node.
		-- Note that returning 'false' here breaks out of harvesting completely;
		-- You will not attempt to harvest other nearby nodes instead.
	]]></onHarvest>

	<onUnstickFailure><![CDATA[
		-- Lua code to execute when MAX_UNSTICK_TRIALS is reached.
	]]></onUnstickFailure>
</profile>
Attachments
The error i keep getting
The error i keep getting

noobyone
Posts: 16
Joined: Mon Feb 27, 2012 5:29 am

Re: Addon or userfuction ??!!??

#7 Post by noobyone » Fri Mar 02, 2012 8:18 am

->[Golbez]
did you try without this:

Code: Select all

 
<onLoad>
           include("userfunctions/userfunction_countmobs.lua",true)
</onLoad>
all userfunctions i use dont need to be inclued in <onLoad>.
and second thing, I think your sintax might be wrong:

Code: Select all

 <onSkillCast><![CDATA[
      -- 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
      -- e.g.:
      --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");]]>
      if CountMobs(true, 50) > 2 then
         printf("Getting Attack by more then 1 Enemy")
         player:cast("MAGE_PURGATORY_FIRE");
      end
   </onSkillCast>
You closed "<![CDATA[" after :
-elseif( 25 > player.HP/player.MaxHP*100 ) then
-- player:cast("PRIEST_HOLY_AURA");
-- player:cast("PRIEST_URGENT_HEAL");
-- player:cast("PRIEST_URGENT_HEAL");
with: "]]>"
so you may close it at the end after :
"end;"
or try to make a new chapter:

Code: Select all

 <onSkillCast><![CDATA[
      --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; ]]>
     <![CDATA[ if CountMobs(true, 50) > 2 then
         printf("Getting Attack by more then 1 Enemy")
         player:cast("MAGE_PURGATORY_FIRE");
      end; 
]]></onSkillCast>
I dident try it now, my bot lvl is not hight enought. But I will next wend, so if you dident find a solution will can tell you if it's working for me.

And thx for sharing your profile, seeing how you make it gave me some ideas. I had troubles with the heal priority, and i think using it in the <skills> with top priority should fix it. (I was using heal only in <onSkillcast>)

Golbez
Posts: 66
Joined: Sat Aug 02, 2008 8:27 pm

Re: Addon or userfuction ??!!??

#8 Post by Golbez » Fri Mar 02, 2012 9:07 am

<![CDATA[]]> <-- i thought that was the way this computer language established comments

yes i have also tried without the include("userfunctions/userfunction_countmobs.lua",true). it didnt work thats why i put that there.

edit: this doesnt work. gives an error saying: "scripts/rom/classes/player.lua:687: onskillcast error: ... scripts/rom/userfunctions/userfunctions_countmobs.lua:8: attempt to index global 'pawn' <a nil value>"

Code: Select all

<onSkillCast><![CDATA[
      --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; ]]>
     <![CDATA[ if CountMobs(true, 50) > 2 then
         printf("Getting Attack by more then 1 Enemy")
         player:cast("MAGE_PURGATORY_FIRE");
      end; 
]]></onSkillCast>
Attachments
Untitled.png
Untitled.png (5.13 KiB) Viewed 3535 times
Last edited by Golbez on Fri Mar 02, 2012 9:19 am, edited 1 time in total.

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

Re: Addon or userfuction ??!!??

#9 Post by lisa » Fri Mar 02, 2012 9:08 am

Just had a look at the userfunction, Rock probably edited before posting.

Code: Select all

		if obj ~= nil and obj.Type == PT_MONSTER and pawn.Alive and pawn.Attackable and
pawn isn't defined before hand so it should always give the error with it being nil.

at a guess try

Code: Select all

		if obj ~= nil and obj.Type == PT_MONSTER and obj.Alive and obj.Attackable and
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

Golbez
Posts: 66
Joined: Sat Aug 02, 2008 8:27 pm

Re: Addon or userfuction ??!!??

#10 Post by Golbez » Fri Mar 02, 2012 9:23 am

lisa wrote:

Code: Select all

		if obj ~= nil and obj.Type == PT_MONSTER and obj.Alive and obj.Attackable and

this either worked or idk. its letting the bot run now. im trying to see if i can get it to cast the spell now

edit: its not casting it. i have like 5 butterflys on me :P

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Addon or userfuction ??!!??

#11 Post by rock5 » Sat Mar 03, 2012 10:26 am

lisa wrote:Just had a look at the userfunction, Rock probably edited before posting.

Code: Select all

		if obj ~= nil and obj.Type == PT_MONSTER and pawn.Alive and pawn.Attackable and
pawn isn't defined before hand so it should always give the error with it being nil.

at a guess try

Code: Select all

		if obj ~= nil and obj.Type == PT_MONSTER and obj.Alive and obj.Attackable and
Yeah I have a habit of editing before I post. But actually I never even tested it at all. :)

Anyway pawn was correct but in the wrong place. obj.Alive wont work because obj is an object, not pawn so doesn't have those values. I've reorderd some things, and yes, tested it too.
Attachments
userfunction_countmobs.lua
(690 Bytes) Downloaded 128 times
  • 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

Golbez
Posts: 66
Joined: Sat Aug 02, 2008 8:27 pm

Re: Addon or userfuction ??!!??

#12 Post by Golbez » Sat Mar 03, 2012 10:43 am

rock5 wrote:
lisa wrote:Just had a look at the userfunction, Rock probably edited before posting.

Code: Select all

		if obj ~= nil and obj.Type == PT_MONSTER and pawn.Alive and pawn.Attackable and
pawn isn't defined before hand so it should always give the error with it being nil.

at a guess try

Code: Select all

		if obj ~= nil and obj.Type == PT_MONSTER and obj.Alive and obj.Attackable and
Yeah I have a habit of editing before I post. But actually I never even tested it at all. :)

Anyway pawn was correct but in the wrong place. obj.Alive wont work because obj is an object, not pawn so doesn't have those values. I've reorderd some things, and yes, tested it too.

doesnt work or maybe i have something wrong.

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<profile>
   <options>
      <!-- Try the bot with a new char mage                   -->
      <!-- At the pioneer village. Use demo.xml waypoint file -->
      <option name="HP_LOW"            value="85" />
      <option name="MP_LOW_POTION"      value="50" />
      <option name="HP_LOW_POTION"      value="50" />
      <option name="USE_HP_POTION"      value="best" />         <!-- potion select strategy: best|minstack -->
      <option name="USE_MANA_POTION"      value="best" />         <!-- potion select strategy: best|minstack -->
      <option name="USE_PHIRIUS_POTION"   value="false" />       <!-- false | true if you want to use the Phirus Potions -->
      <option name="PHIRIUS_MP_LOW"      value="40" />
      <option name="PHIRIUS_HP_LOW"      value="40" />

      <!-- Rest if HP or Mana is below that level -->
      <option name="HP_REST"             value="15" />
      <option name="MP_REST"             value="15" />

      <!-- Shopping options, how many of what do you want to keep in your inventory -->
      <option name="HEALING_POTION"       value="99" />
      <option name="MANA_POTION"          value="99" />         <!-- set to "0" if not required to buy -->
      <option name="ARROW_QUIVER"       value="0" />          <!-- set to "0" if not required to buy -->
      <option name="THROWN_BAG"          value="0" />         <!-- set to "0" if not required to buy -->
      <option name="POISON"             value="0" />         <!-- set to "0" if not required to buy -->

      <!-- either false or arrow or thrown -->
      <option name="RELOAD_AMMUNITION"    value="false" />      <!-- false|arrow|thrown -->

      <!-- Combat options -->
      <option name="COMBAT_TYPE"           value="" />            <!-- leave empty or choose ranged/melee if not using class default -->
      <option name="COMBAT_RANGED_PULL"    value="true" />       <!-- only important for melees -->
      <option name="COMBAT_DISTANCE"       value="200" />
      <option name="MAX_FIGHT_TIME"        value="15" />         <!-- Max time without damage before break -->
      <option name="DOT_PERCENT"           value="90" />
      <option name="ANTI_KS"               value="true" />
      <option name="MAX_TARGET_DIST"       value="225" />

      <!-- Attack monsters 3 levels above or 10 below your level -->
      <option name="TARGET_LEVELDIF_ABOVE" value="5" />
      <option name="TARGET_LEVELDIF_BELOW" value="20" />

      <!-- Waypoint and movement settings -->
      <option name="WAYPOINTS"         value="" />           <!-- leave empty to show a list -->
      <option name="RETURNPATH"         value="" />
      <option name="PATH_TYPE"         value="waypoints" />   <!-- waypoints | wander -->
      <option name="WANDER_RADIUS"      value="500" />
      <option name="WAYPOINT_DEVIATION"   value="0" />
      <option name="QUICK_TURN"          value="true" />

      <!-- Loot settings -->
      <option name="LOOT"                  value="false" />
      <option name="LOOT_ALL"              value="false" />        <!-- Loot all nearby dead mobs after combat -->
      <option name="LOOT_IN_COMBAT"        value="true" />
      <option name="LOOT_DISTANCE"         value="100" />
      <option name="LOOT_PAUSE_AFTER"      value="0" />         <!-- probability in % for a short rest -->

      <!-- Auto selling options when used with player:merchant -->
      <option name="INV_AUTOSELL_ENABLE"   value="true" />      <!-- true | false -->
      <option name="INV_AUTOSELL_FROMSLOT" value="1" />          <!-- 1 = bag 1 slot 1 -->
      <option name="INV_AUTOSELL_TOSLOT"   value="70" />          <!-- 30 = last slot bag 1 -->
      <option name="INV_AUTOSELL_QUALITY"   value="white,green" />    <!-- white,green,blue,purple  -->

      <!-- Harvest options -->
      <option name="HARVEST_DISTANCE"      value="120" />
      <option name="HARVEST_WOOD"         value="true" />       <!-- Choose which types to harvest. -->
      <option name="HARVEST_HERB"         value="true" />       <!-- "true" = harvest, "false" = do not harvest -->
      <option name="HARVEST_ORE"         value="true" />

      <!-- Eggpet options -->
      <option name="EGGPET_ENABLE_CRAFT"   value="false" />      <!-- If using same slot for assist and craft, onlt 1 can be enabled. -->
      <option name="EGGPET_CRAFT_SLOT"   value="1" />
      <option name="EGGPET_ENABLE_ASSIST"   value="true" />
      <option name="EGGPET_ASSIST_SLOT"   value="2" />
      <option name="EGGPET_CRAFT_RATIO"   value="1:1:1" />       <!-- mining:woodworking:herbalism ratio to produce. -->
      <option name="EGGPET_CRAFT_INDEXES"   value="" />           <!-- override auto craft index for mining,woodworking,herbalism eg. "2,,"-->


      <!-- Log out and resurrect settings -->
      <option name="LOGOUT_TIME"          value="0" />         <!-- in minutes, 0 = timer disabled -->
      <option name="LOGOUT_SHUTDOWN"      value="false" />
      <option name="LOGOUT_WHEN_STUCK"   value="true" />
      <option name="CLOSE_WHEN_STUCK"      value="true" />
      <option name="RES_AFTER_DEATH"       value="true" />
      <option name="MAX_DEATHS"          value="10" />          <!-- Log out after this many deaths -->

      <!-- Party Bot options  -->
      <!-- <option name="PARTY"         value="true" /> -->
      <!-- <option name="PARTY_ICONS"      value="true" /> -->
      <!-- <option name="PARTY_INSTANCE"   value="true" /> -->

      <!-- Healing options -->
      <!-- <option name="HEALER_FIGHT"      value="true" /> -->    <!-- For party bot if you want healer to also fight -->

      <!-- pvp -->
      <!--option name="PVP"         value="true" /> -->       <!-- To enable PVP, with this set to true it will auto attack any players with red names -->

      <!-- For more options and documentation see the RoM Bot Wiki:  -->
      <!-- http://www.solarstrike.net/wiki/index.php5?title=RoM_Bot  -->

      <!-- GM detection options -->
      <option name="GMDETECT"            value="true" /> -- enables the GM detection userfunction
      <option name="GMnearbylogout"         value="true" /> -- If a GM is close to the character it will log out.
      <option name="PAUSEONGM"            value="600" />  -- Pauses when GM whispers for value in seconds. ie 300 = 5 minutes
      <option name="RECALL"               value="true" /> -- if in combat while pausing it will use recall and whisper/logout

      <option name="jParty_BotMaster" value="" />
      <option name="jParty_BotAssist" value="" />             --   The bot will assist this member if a fight is engaged
      <option name="jParty_BotFollowed" value="" />             --   The bot will follow this member
      <option name="jParty_FollowingDistance" value="30" />       --   The bot will keep this distance with the BotFollowed
      <option name="jParty_BotHealer" value="false" />          --   The bot will heal
      <option name="jParty_BotDPSer" value="false" />             --   The bot will Fight the target of BotAssist if in combat
      <option name="jParty_BotLooter" value="false" />          --   The bot will loot
      <option name="jParty_Heal" value="PRIEST_URGENT_HEAL" />   --   Your main heal
      <option name="jParty_BigHeal" value="PRIEST_HEAL" />       --   Your Big heal
      <option name="jParty_Regen" value="PRIEST_REGENERATE" />    --   Your regen (The bot will only regen if jParty_RegenBuffName is not found on party members and if IN combat
      <option name="jParty_RegenBuffName" value="Regenerate" />    --   The name of your buff's regen

   </options>

   <friends>
      <!-- names of friends we help fighting or enemys we don't want to attack -->
      <!-- for umlauts use \129 (ue),\132 (ae),\148 (oe) e.g. K\132fer         -->

   </friends>

   <mobs>
      <!-- names of mobs we want to attack             -->
      <!-- if no names defined we will attack all mobs   -->
      <mob name="" />
      <mob name="" />
      <mob name="" />
   </mobs>

   <hotkeys>
       <!-- to communicate with the RoM API / define ingame dummy macro at place 1 -->
      <hotkey name="MACRO"          key="VK_0" />
   </hotkeys>

   <!-- define your skills depending from your actual primary class -->
   <!-- see the example for a priest/mage                           -->
   <!-- delete skills you don't have or don't want to use.          -->
   <!-- For more skills to use see /database/skills.xml             -->
   <!-- demo skills for LvL 1 character for all classes             -->
   <!-- to use a specific key instead of MACRO then use hotkey="VK_1" this example is for hotkey 1 -->
   <skills_priest>
      <skill name="PRIEST_SOUL_SOURCE"        		hotkey="MACRO" priority="110" inbattle="true" hpper="15" />
      <skill name="PRIEST_URGENT_HEAL"        		hotkey="MACRO" priority="100" hpper="50"  />
      <skill name="PRIEST_REGENERATE"         		hotkey="MACRO" priority="90"  hpper="80" />
      <skill name="PRIEST_RISING_TIDE"        		hotkey="MACRO" priority="80" />
      <skill name="PRIEST_WAVE_ARMOR"        		hotkey="MACRO" priority="40"  inbattle="true" />
      <skill name="PRIEST_AMPLIFIED_ATTACK"    		hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" />
      <skill name="PRIEST_GRACE_OF_LIFE"       		hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" />
      <skill name="PRIEST_HOLY_AURA"          		hotkey="MACRO" priority="100" inbattle="true" hpper="24" />
      <!--skill name="PRIEST_SOUL_BOND"        		hotkey="MACRO" priority="30" /> -->
      <!--skill name="PRIEST_MAGIC_BARRIER"    		hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" /> -->
   </skills_priest>

   <skills_mage>
      <skill name="MAGE_LIGHTNING"            		hotkey="MACRO" priority="50" />
      <skill name="MAGE_FLAME"                		hotkey="MACRO" priority="80" />
      <skill name="MAGE_FIREBALL"             		hotkey="MACRO" priority="80" />
      <skill name="PRIEST_RISING_TIDE"        		hotkey="MACRO" priority="50" />
      <skill name="MAGE_ELEMENTAL_WEAKNESS"   		hotkey="MACRO" priority="85" nobuffname="target" nobufftarget="target"/>

      <skill name="MAGE_INTENSIFICATION"      		hotkey="MACRO" priority="20" hpper="15" />
      <skill name="MAGE_ENERGY_WELL"            	hotkey="MACRO" priority="30" inbattle="true" />
      <skill name="MAGE_ENERGY_INFLUX"         		hotkey="MACRO" priority="30" inbattle="true" />
      <skill name="MAGE_ELEMENTAL_CATALYST"   		hotkey="MACRO" priority="60" manaper="75" inbattle="true" />
      <skill name="MAGE_ESSENCE_OF_MAGIC"    		hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" />
      <skill name="MAGE_FIRE_WARD"         			hotkey="MACRO" priority="20" rebuffcut="50" inbattle="false" />
      <skill name="PRIEST_BLESSED_SPRING_WATER"   	hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false" />
      <skill name="PRIEST_MAGIC_BARRIER"     		hotkey="MACRO" priority="20" rebuffcut="60" inbattle="false"/>

      <skill name="PRIEST_URGENT_HEAL"        		hotkey="MACRO" priority="100" hpper="60"  />
      <skill name="PRIEST_REGENERATE"         		hotkey="MACRO" priority="90"  hpper="80" />
      <skill name="MAGE_ELECTROSTATIC_CHARGE" 		hotkey="MACRO" priority="100" inbattle="true" hpper="35" nobuffname="player" nobufftarget="player"/>
      <skill name="PRIEST_HOLY_AURA"         		hotkey="MACRO" priority="100" inbattle="true" hpper="25" />
   </skills_mage>

   <onLoad>
      startGMDetect()
   </onLoad>

   <onDeath><![CDATA[
      -- Additional Lua code to execute on death
      -- pauseOnDeath(); -- Stop the script
      -- player:logout();   -- logout
   ]]></onDeath>

   <onLeaveCombat>
   if (not player:hasBuff(495431)) then
      inventory:useItem(204514);  -- Uses Magic Perfume
   end
   </onLeaveCombat>

   <onLevelup><![CDATA[
      -- Additional Lua code to execute after having a levelup
      -- and levelup the skills for a new character (mage or priest recommended)
      -- e.g. sendMacro("SetSpellPoint(_tabnr, _skillnr);"); would levelup a skill
   ]]></onLevelup>

   <onSkillCast><![CDATA[
      --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");
		if CountMobs(true, 50) > 2 then
			printf("Getting Attack by more then 1 Enemy")
			player:cast("MAGE_PURGATORY_FIRE");
		end;]]>
	</onSkillCast>

   <onHarvest><![CDATA[
      -- Additional Lua code to execute directly before the actual harvesting takes place.
      -- Note: arg1 contains the object to be harvested.
      -- i.e. arg1.Name will be the name of the node you are about to harvest
      -- If this snippet returns 'false', the node will *not* be harvested.
      -- All other return values result in the player attempting to harvest the node.
      -- Note that returning 'false' here breaks out of harvesting completely;
      -- You will not attempt to harvest other nearby nodes instead.
   ]]></onHarvest>

   <onUnstickFailure><![CDATA[
      -- Lua code to execute when MAX_UNSTICK_TRIALS is reached.
   ]]></onUnstickFailure>
</profile>
Attachments
Untitled.png

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Addon or userfuction ??!!??

#13 Post by rock5 » Sat Mar 03, 2012 11:46 am

Problem with Purgatory Fire? I'd say "Be sure the skill is in the skills section of your profile." If you don't want it automatically used then add autouse="false"

Also, "onSkillCast" happens after the skill. Is that what you want? Or would you rather it count the mobs before casting a skill? If before, then use <onPreSkillCast>.
  • 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

Golbez
Posts: 66
Joined: Sat Aug 02, 2008 8:27 pm

Re: Addon or userfuction ??!!??

#14 Post by Golbez » Sat Mar 03, 2012 11:54 am

rock5 wrote:Problem with Purgatory Fire? I'd say "Be sure the skill is in the skills section of your profile." If you don't want it automatically used then add autouse="false"

Also, "onSkillCast" happens after the skill. Is that what you want? Or would you rather it count the mobs before casting a skill? If before, then use <onPreSkillCast>.

count then cast the spell :P

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 6 guests