Page 1 of 2

Rock5's craftItem function

Posted: Mon Apr 25, 2011 9:37 am
by rock5
Here's a crafting function to craft any item by name. I will add it to the bot one day but I thought it would be a good idea to start it as a userfunction for now so I can iron out the bugs and respond to user feedback.


Crafting an item
Requires you to be near the corresponding crafting tools.

Syntax:
  • craftItem ( _itemNameOrGUID [, _itemNumber] )
Arguments:
  • _itemNameOrGUID - The name of the item, or part of it, you want to craft. Or the GUID of the item. The GUID is the id of the recipe.
  • _itemNumber - The number you want to create. If equal to "all", it will create the maximum possible of that item. (optional) If omitted it will create only 1.
Note: If "all" is used, it will create all items that match the name eg. "Timber" will create all timbers. If a number is specified then it will only create the first item that matches.

Finding an item to craft
Should rarely be needed because you can check your inventory to see if you are ready to craft but I thought I'd throw it in anyway.

Syntax:
  • GUID, itemName, maxCraft = findItemToCraft ( _itemNameOrGUID )
Argument:
  • _itemNameOrGUID - The name of the item, or part of it, you want to find to craft. Or the GUID of the item. The GUID is the id of the recipe.
Returns
  • GUID - The GUID of the item recipe.
  • itemname - The full name of the item produced.
  • maxCraft - The maximum number that can be crafted.
Note: This function only returns items that can be crafted ie. at least 1 can be made. Returns nil if no item found.

Re: Rock5's craftItem function

Posted: Mon Apr 25, 2011 3:10 pm
by Alkaiser
Excellent! I've been wanting this one for a while.

Re: Rock5's craftItem function

Posted: Sat Apr 30, 2011 12:16 am
by rock5
New in version 1.1:
  • Search and create by GUID. That's the id of the recipe.
  • "all" now creates all items that match the search name. If a number is specified then it will create that many of only the first item that matches the name. eg.

    Code: Select all

    craftItem("Timber", "all")
    will create all timber ie. "Ash Timber", "Chime Wood Timber", "Willow Timber", etc.
  • Other minor tweaks.
I think this is ready for addition to the bot so I'll add it in a couple of days if no one sees any bugs in this version.

Edit: Here's an example file you can use to turn all your harvested resources (wood, herbs and ore) to green resources in Logar. It starts at Matt Sorrun, converts all the resources to green then ends back near Matt Sorrun and goes to sleep.

Re: Rock5's craftItem function

Posted: Thu Jun 09, 2011 10:38 pm
by MiesterMan
Awsome!! I wish I'd seen this earlier. I spent a couple of hours figuring out how to extract recipes from the recipe book and using the CreateItemCraft function to make my own. Has this been added to the bot? Can I just use the craftItem() function from the bot now or do I need to download the addon?

Re: Rock5's craftItem function

Posted: Sat Jun 18, 2011 9:41 pm
by MiesterMan
Everytime I do a craftItem(something,"all") it makes the first one then I get this and the bot crashes:

Code: Select all

Crafting 25 Foloin Nut Bundle
...scripts/rom/userfunctions/userfunction_craftitem.lua:63: attempt to compare number with
 nil

Re: Rock5's craftItem function

Posted: Sat Jun 18, 2011 10:55 pm
by rock5
Sorry, I've been using an updated version for a while now but forgot to upload it.

The first post has been updated.

It just has an updated memory address for the new client.

Re: Rock5's craftItem function

Posted: Sat Jun 18, 2011 11:07 pm
by MiesterMan
rock5 wrote:Sorry, I've been using an updated version for a while now but forgot to upload it.

The first post has been updated.

It just has an updated memory address for the new client.
Awsome, tyvm! Now I don't have to use my lame version.

Re: Rock5's craftItem function

Posted: Fri Jul 08, 2011 8:51 am
by nokirk
Just found it and I love it! Always hated doing the crafting. For other german guys: in Logarcraft.xml you need to replace the names "Bundle" -> "ndel" [don't know if "bündel" works probably not?] / "Wood" -> "holz". Maybe this is obvious, but maybe it helps someone.

Again, the userfunction is awesome!

Re: Rock5's craftItem function

Posted: Mon Jul 18, 2011 4:11 pm
by botje
any way of letting this bulk process whole bag?

like craftitem(all, all)

?

Botje

Re: Rock5's craftItem function

Posted: Mon Jul 18, 2011 8:08 pm
by rock5
botje wrote:any way of letting this bulk process whole bag?

like craftitem(all, all)

?

Botje
Don't you have to be near a production tool to procress? You can only be near one at a time. Or do you mean process all green, blue, purple, etc?

Re: Rock5's craftItem function

Posted: Mon Jul 18, 2011 10:02 pm
by lisa
You can set up a house with all of the crafting processor stuff, I know a few houses on my server I can visit if I wanted like this. So no movement and you can craft anything or refine matts.

Just a question since function findItemToCraft(_itemNameOrGUID) uses find.string could you use findItemToCraft("") to find all

I know most of the in game functions I have used you can use "" instead of a name like "Iron Ore" and it will do the function for anything it can.

Re: Rock5's craftItem function

Posted: Tue Jul 19, 2011 12:37 am
by rock5
The only problem with that is, if they also have tailoring, carpentry, armorcrafting recipes etc, I think it would produce them too. Of course if they only have mining, woodworking and herbalism tools in their house then that should work but otherwise I would just stick with using multiple commands.

Code: Select all

craftItem("Bundle", "all")
craftItem("Sand", "all")
craftItem("Timber", "all")
craftItem("Sap", "all")
craftItem("Nugget", "all")
craftItem("Lumber", "all")
etc. It gives you better control.

Re: Rock5's craftItem function

Posted: Tue Jul 19, 2011 2:47 am
by botje
actually, i mean more like: walk to tools, process all wood, then walt to next tools, process all ores etc.

get what i mean?

botje

Re: Rock5's craftItem function

Posted: Tue Jul 19, 2011 2:58 am
by rock5
Still the same applies. Try what lisa said. Use "".

Code: Select all

craftItem("", "all")
Or if that doesn't work then.

Code: Select all

craftItem("Timber", "all")
craftItem("Lumber", "all")
craftItem("Plank", "all")
etc.

Re: Rock5's craftItem function

Posted: Tue Jul 19, 2011 3:45 am
by botje
k, ill try after the server maintenance is over :)

ill report back

Botje

Re: Rock5's craftItem function

Posted: Tue Jul 19, 2011 10:52 am
by botje
Very weird, but it only works for metal stuff O.o

rest reports that i need to be near blacksmithing tools... xd

Botje

oh well, ill just do multiple commands then :)

Re: Rock5's craftItem function

Posted: Wed Jul 27, 2011 8:52 pm
by rock5
I've updated the address in the function to support client patch 4.01.

Re: Rock5's craftItem function

Posted: Thu Jul 28, 2011 1:38 pm
by nokirk
I'd like to contribute my waypoint file, I really like this craftitem feature. I bought the 3 main crafting apparatus and put them in the house of an alt, so, in order to use that waypoint you should do the same or copy whatever you like.

Note: first four craftitem specifications are for german client. Apart from that it's set to produce the most valuable version of the resource and it's set to produce "Strong Stimulant" in the end as it's quite expensive on my server (Starkes Anregungsmittel). Enjoy

Re: Rock5's craftItem function

Posted: Fri Sep 09, 2011 3:28 am
by rock5
Updated to work with client 4.02. Hopefully I future proofed it by using settings.skillsTableBase to get the address. It's only 0x50 off after all.

Re: Rock5's craftItem function

Posted: Fri Sep 09, 2011 7:13 am
by Dsanchez
Is this the new updated version? It's only processing one stack herb, ore, and wood instead of all in my bags. I'm using the provided logarcraft.xml


thanks