Page 1 of 4

useGoodie

Posted: Sun Apr 24, 2011 1:36 pm
by Giram
Description
This userfunction was created to use housemaids potions and foods. It first checks if we have that potion / food on inventory and after that it will check if we have buff on and if buff is on then it won't use that item. Otherwise it will use item.

My original userfunction was combined with Jduartedj and now this should be able to use any consumable. I will continue to support this project for now. This one should support clients with other languages than English. Buff names was changed to buff id's.

Just for reference i will link these links to those two threads where can be found info regarding to this one.
UseFood + useHousemaidPotions = useGoodie !!!
housemaid potions and foods

Troubleshooting:
- Default folder for userfunctions is micromacro\scripts\rom\userfunctions
- Delete or move previous versions of useGoodie userfunctions away from userfunctions folder
- If bot is using items everytime it uses function then the buff ID is wrong. Userfunction checks first if we have potions on inventory then it will check if we have buff from that item. If those are true then it will use item.

Available commands
To use housemaid items you need to write these as they are here. These can be placed for example in onLeaveCombat, onSkillCast, onPreSkillCast or in waypoint file.

Code: Select all

useGoodie("giant"); -- Fullness
useGoodie("speed"); -- Unbridled Enthusiasm
useGoodie("frog"); -- Princely Look
useGoodie("casting"); -- Clear Thought
useGoodie("luck"); --Turn of Luck Powder Dust
useGoodie("riding"); --Galloping Gale
useGoodie("jump"); --crazy breakout
useGoodie("defense"); --Scarlet Love
useGoodie("agro");  --Pungent Vileness
useGoodie("godspeed"); --Godspeed
useGoodie("pdmg"); -- Housekeeper Special Salted Fish with Sauce
useGoodie("mdmg"); -- Housekeeper Special Smoked Bacon with Herbs
useGoodie("critp"); -- Housekeeper Special Caviar Sandwich
useGoodie("matt"); -- Housekeeper Special Deluxe Seafood
useGoodie("patt2"); -- Housekeeper Special Spicy Meatsauce Burrito
useGoodie("mdmg2"); -- Housekeeper Special Delicious Swamp Mix
useGoodie("patt3"); -- Housekeeper Special Unimaginable Salad
useGoodie("matt3"); -- Housekeeper Special Cheese Fishcake
I am not very familiar with these ones but this is working also. Jduartedj did this part.

Code: Select all

useGoodie("item"); --if the item has the same buffname as the itemname
useGoodie("item","buff"); --only if you have an item with a buff diferent from its own name.
useGoodie(120556); -- Can cast by consumable ID.
useGoodie("Infinite Herb") --Uses Infinite herb.
useGoodie("Infinite Herb", "Infinite Herb") --This also gives buff so this works also

Examples

Code: Select all

<onLeaveCombat>
	useGoodie("speed");
	useGoodie("luck");
	useGoodie("patt3");
</onLeaveCombat>
useGoodie is usable in waypoint file too:

Code: Select all

<!-- #  1 --><waypoint x="3431" z="2695" y="47">
   useGoodie("defense");
   useGoodie("patt3");
</waypoint>
Link to modified useGoodie by Rock5
http://www.solarstrike.net/phpBB3/viewt ... 952#p21952

Re: useGoodie

Posted: Sun Apr 24, 2011 8:47 pm
by rock5
You might want to add a bit of a description of what exactly the function does for newbys who don't know what this function does and how it works.

Re: useGoodie

Posted: Mon Apr 25, 2011 6:27 am
by M4gm4
hmm,, is there a check function ?
example

Code: Select all

if buff exist (do nothing)
else useGoodie("giant");

Re: useGoodie

Posted: Mon Apr 25, 2011 6:48 am
by rock5
M4gm4 wrote:hmm,, is there a check function ?
example

Code: Select all

if buff exist (do nothing)
else useGoodie("giant");
LOL. That's why I said there needed to be a better description. useGoodie only uses the item if the buff isn't already on.

Re: useGoodie

Posted: Thu Apr 28, 2011 2:21 pm
by M4gm4
if there is no goodi ,wich is listet in your profile, in your bag, the bot gets an error an stops.?!

Re: useGoodie

Posted: Thu Apr 28, 2011 4:10 pm
by Giram
M4gm4 wrote:if there is no goodi ,wich is listet in your profile, in your bag, the bot gets an error an stops.?!
I don't totally understand what you mean by this. I have run with and without potions / foods that i get from housemaids and are listed on my profile and haven't got any errors lately. There was error sometime ago with getting buffs but i think it is now fixed. I thought it was because of my userfunction.

If you are using some other item could you tell me what you are using that causes bot to crash and you could also post error that you get. I could then try replicate that error and try to fix it.

There is check if we got item on inventory. If you don't have item on inventory it shouldn't do nothing. Error could be caused my missing update from somewhere or lack of rest between commands.

Re: useGoodie

Posted: Thu Apr 28, 2011 10:22 pm
by M4gm4
i use

Code: Select all

	<onLeaveCombat>
		   useGoodie("speed");
		   useGoodie("luck");
		   useGoodie("matt2");
	</onLeaveCombat>
and the error msg is (sry, in german)
....../rom/classes/player.lua:1254: fehler im Profile bei der Zeitpunktverarbeitung: onLeaveCombat error
....../rom/classes/pawn.lua:537: bad argument #1 `gmatch´ (string expected, got nil)

than bot stops after the first fight

Re: useGoodie

Posted: Fri Apr 29, 2011 2:06 pm
by M4gm4
ok, now i have more information about the error..
when i have this error ,, and log out ,, the prompt with crit error comes
so its the situation, when the game used many loading screens oder travels from city to city or with transport runes.
the client crashed without log out ,, msg comes only at manual logout.
a restart of the client helps, and all works normal.

(hope you understand my bad english)

Re: useGoodie

Posted: Fri Apr 29, 2011 4:02 pm
by Giram
I am going through all housemaid items and found that few items will crash bot for some reason. I need to continue investigating this other time.

speed, luck, pat3, mat3 is working atleast.
M4gm4 wrote:i use

Code: Select all

	<onLeaveCombat>
		   useGoodie("speed");
		   useGoodie("luck");
		   useGoodie("matt2");
	</onLeaveCombat>
and the error msg is (sry, in german)
....../rom/classes/player.lua:1254: fehler im Profile bei der Zeitpunktverarbeitung: onLeaveCombat error
....../rom/classes/pawn.lua:537: bad argument #1 `gmatch´ (string expected, got nil)

than bot stops after the first fight
If you remove useGoodie("matt2"); i think it would work then so thats one bugging also.

Re: useGoodie

Posted: Tue May 03, 2011 10:56 am
by Giram
Error "./rom/classes/pawn.lua:537: bad argument #1 `gmatch´ (string expected, got nil)" was caused by wrong buff IDs. I went through all ID' with rombot console and didn't get any errors when searched with ID. And changed those that gave error.

New stuff:
- aggro renamed to agro.
- jump has 3 sec cooldown
- riding has effect so i gave 1 sec for it
- Changed few IDs


I was able to test these and will test others if i have change to get those:

Code: Select all

useGoodie("giant"); -- Fullness
useGoodie("speed"); -- Unbridled Enthusiasm
useGoodie("frog"); -- Princely Look
useGoodie("casting"); -- Clear Thought
useGoodie("luck"); --Turn of Luck Powder Dust
useGoodie("riding"); --Galloping Gale
useGoodie("jump"); --crazy breakout
useGoodie("defense"); -- scarlet love
useGoodie("matt2"); -- Housekeeper Special Spicy Meatsauce Burrito
useGoodie("mdmg2"); -- Housekeeper Special Delicious Swamp Mix
Edit: Forgot to tell that i uploaded new version to first post yesterday.

Re: useGoodie

Posted: Thu May 12, 2011 10:15 am
by Giram
Updated userfunction. Should work better now.

- matt2 renamed to patt2.
- Checked all potions. Those are working for me.
- Tested foods:
Housekeeper Special Salted Fish with Sauce
Housekeeper Special Smoked Bacon with Herbs
Housekeeper Special Spicy Meatsauce Burrito
Housekeeper Special Delicious Swamp Mix

Still needs to be tested:
Housekeeper Special Caviar Sandwich
Housekeeper Special Deluxe Seafood
Housekeeper Special Unimaginable Salad (checked)
Housekeeper Special Cheese Fishcake

Using other items are not working for some reason. Tried to check it but couldn't figure out what is wrong with that part.

Re: useGoodie

Posted: Thu May 12, 2011 10:33 am
by rock5
I think the problem is "option" needs to be declared a table before adding values to it (ID, buffName, castime). Try adding "option = {}".

Code: Select all

	if not option then
		option = {}
		if not _buffName then
			option.buffName = _itemName --Assume  both have same name like in mounts
		else
			option.buffName = _buffName
		end
		option.ID = _itemName --luckily the inventory functions use Name Or ID
		option.castTime = 0
	end

Re: useGoodie

Posted: Thu May 12, 2011 10:42 am
by Giram
That fixed that problem.

Tested:
useGoodie("Infinite Herb")
useGoodie("Infinite Herb", "Infinite Herb")

Thanks rock5 :)

edit: Uploaded fixed version.

Re: useGoodie

Posted: Wed May 18, 2011 7:46 am
by rock5
I noticed that if I move a food into my transmutor it doesn't get used. Can I suggest the following change that will allow it to work.

Change line 64;

Code: Select all

	if inventory:itemTotalCount(option.ID) >= 1 and not player:hasBuff(option.buffName) then
to

Code: Select all

	if inventory:itemTotalCount(option.ID,"all") >= 1 and not player:hasBuff(option.buffName) then
itemTotalCount defaults to counting only in the "bags". "all" will allow it to search the transmutor as well when counting the food or potion items.

Re: useGoodie

Posted: Wed May 18, 2011 12:08 pm
by Giram
I will gladly take suggestions to improve my works. I will upload new version later. I think ids are wrong again :( . Starting to get frustrated about that problem. Well i am checking those again. ATM i still need 5 more test but probably can't test foods so i will get those from itempreview after it's finished importing. Lost all again after crash :(

I did test this:

Code: Select all

if inventory:itemTotalCount(option.ID,"all") >= 1 and not player:hasBuff(option.buffName) then
and it used items from AT also so that will come too in next update.

Re: useGoodie

Posted: Fri May 27, 2011 10:29 am
by Giram
Uploaded new version.

- Removed GetIdName from table cause player:hasBuff() works with ids.
- Now it will search items from Arcane Transmutor and backback. Maybe could use item shop backback too but haven't tested that one.
- Checked few ids once again. I haven't been able to test all foods from housemaid. Only got chance to test 2 first and 2 last ones. But haven't seen any reports from those so can't say if those are not working. Multiple ID gives same name so it might still work even if it's not right one.

Re: useGoodie

Posted: Sat May 28, 2011 2:03 pm
by harbifm
can you explian how to use it, I an a newbee

ok, I post into the script file, the copy
<onLeaveCombat>
useGoodie("speed");
useGoodie("luck");
useGoodie("matt2");
</onLeaveCombat>

into my profile afte this scetion:
<onLeaveCombat><![CDATA[
-- Additional Lua code to execute after killing an enemy

so it become like this:

]]></onLoad>

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

<onLeaveCombat><![CDATA[
-- Additional Lua code to execute after killing an enemy
]]></onLeaveCombat>
<onLeaveCombat>
useGoodie("speed");
useGoodie("luck");
useGoodie("matt2");
</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>


is this how it could be used?

Re: useGoodie

Posted: Sat May 28, 2011 2:24 pm
by Giram
You have 2 instances of onLeaveCombat now and i don't know if it will work that way. But if you remove the first one. So this:

Code: Select all

<onLeaveCombat><![CDATA[
-- Additional Lua code to execute after killing an enemy
]]></onLeaveCombat>
<onLeaveCombat>
useGoodie("speed");
useGoodie("luck");
useGoodie("matt2");
</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>
to this and it should work:

Code: Select all

<onLeaveCombat>
useGoodie("speed");
useGoodie("luck");
useGoodie("matt2");
</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>
You can also insert those useGoodie(""); commands to elsewhere. Like in waypoint file. This one will use those just before boss:

Code: Select all

<!-- #  1 --><waypoint x="3431" z="2695" y="47">
	useGoodie("defense");
	useGoodie("patt3");
</waypoint>
And between onPreSkillCast so it will use items before skills or onSkillCast so it will use item after using skills. But i prefer onLeaveCombat. You need to use those predefined words from first post to use housemaid items, item id or item name. You can get item ID these from itempreview addon or from site that list items like this one http://www.runesdatabase.com/ . Just search item you want to use for example http://www.runesdatabase.com/item/20009 ... r-sandwich . ID is on link after item word. So that can be used like this: useGoodie(200098); .

Re: useGoodie

Posted: Sun May 29, 2011 12:02 am
by harbifm
did not work


where should I save the file (userfunction_useGoodie_universal .lua)?

I have put into the script ffolder, not the profile folder. shouldl I rename the lua file to (usergoodie) for the bot to recongnize it since it is named that in the code, not userfunction_useGoodie_universal.lua, or the other way around

what I meen is changeing the name as an example (useGoodie ("speed"); to (userfunction_useGoodie_universal "speed"); in the profile code?

and again where to save it for the bot to recongnize it?

Re: useGoodie

Posted: Sun May 29, 2011 12:19 am
by lisa
don't change the file names or any of the code that you have been told to use. place the file in your rom/userfunctions folder.

It's a good idea to also delete previous versions of a function if they are still in the folder.

Something to keep in mind is pretty much all content is designed for the current version of rombot, MM and runes of magic client. Since you are running with a client version that is over a year old a lot of the content won't work for you.