How to detect a recipe is learned or not? --solved--

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

How to detect a recipe is learned or not? --solved--

#1 Post by botje »

i want to write a little function that scans my bags, and when it encounters a recipe, it checks if its allready learned, if it is, i add it to lootfilter with a slash script, else i add it to lootfilter and use it.

this will learn them automaticly and keep my bags clean :3

but i am stuck on the part of detecting the learned state...

Botje

edit, instead of relying on lootfilter, i can also thrash them ofcourse...

thanx rock, here is my final version :)

Code: Select all

function LearnRecipe(drop) -- true or false
	inventory:update();
	
	if drop == nil then drop = false
	
	for i, item in pairs(inventory.BagSlot) do
		if item:isType("Recipes") then
			if RoMScript("GetCraftItemInfo("..item.Id..")") == nil then -- Don't have it
				printf("Learning recipe:  "..item.Name.."\n");
				logInfo("LearnRecipe", "Learning recipe:  " ..item.Name.. "." , true)
				item:use();
				yrest(5000);
			else
				if drop == true then
					printf("Deleting Recipe:  "..item.Name.."\n");
					item:delete()
				end
			end
			
		end
	end
end
Last edited by botje on Tue Nov 13, 2012 5:35 pm, edited 1 time in total.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: How to detect a recipe is learned or not?

#2 Post by rock5 »

It's complicated because you need to use more than 1 function. I made a userfunction for crafting stuff called "userfunction_craftitem.lua". It has a function in it that returns a match if you have the ingredients to make something. I could modify it to do what you ask.
  • 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
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: How to detect a recipe is learned or not?

#3 Post by rock5 »

Actually, it turned out to not be that difficult, given that you need to find a recipe in your inventory first and you can use it's id.

Try this, lets say "item" is the recipe, however you searched for it. Then

Code: Select all

if RoMScript("GetCraftItemInfo("..item.Id..")") == nil then -- Don't have it
    item:use() yrest(3000)
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
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: How to detect a recipe is learned or not? --solved--

#4 Post by botje »

thanx for the help rock, added full function to first post :)
Cindy
Posts: 237
Joined: Fri Sep 28, 2012 4:23 pm

Re: How to detect a recipe is learned or not? --solved--

#5 Post by Cindy »

Any way to add a configuration item for color of recipe? (for example, to be able to exclude purple recipes from deletion)?
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: How to detect a recipe is learned or not? --solved--

#6 Post by lisa »

item.Color

just add in a check for the color you don't want to delete and obviously don't delete it.
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
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: How to detect a recipe is learned or not? --solved--

#7 Post by botje »

hmm, didnt think of that xd

ill add that :3
User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: How to detect a recipe is learned or not? --solved--

#8 Post by botje »

hmm... dont recipe's have like the same rarity as other items?

so i can use

Code: Select all

and item.Quality < rarity then
this?
Post Reply