Rock5's craftItem function

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Message
Author
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Rock5's craftItem function

#1 Post by rock5 » Mon Apr 25, 2011 9:37 am

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.
Attachments
userfunction_craftitem.lua
Fix for path 4.02 - Address shouldn't need to be updated in the future.
(3.66 KiB) Downloaded 388 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

Alkaiser
Posts: 222
Joined: Sat Sep 25, 2010 2:03 pm

Re: Rock5's craftItem function

#2 Post by Alkaiser » Mon Apr 25, 2011 3:10 pm

Excellent! I've been wanting this one for a while.

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

Re: Rock5's craftItem function

#3 Post by rock5 » Sat Apr 30, 2011 12:16 am

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.
Attachments
logarcraft.xml
(2.89 KiB) Downloaded 315 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

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: Rock5's craftItem function

#4 Post by MiesterMan » Thu Jun 09, 2011 10:38 pm

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?

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: Rock5's craftItem function

#5 Post by MiesterMan » Sat Jun 18, 2011 9:41 pm

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

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

Re: Rock5's craftItem function

#6 Post by rock5 » Sat Jun 18, 2011 10:55 pm

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.
  • 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
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: Rock5's craftItem function

#7 Post by MiesterMan » Sat Jun 18, 2011 11:07 pm

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.

nokirk
Posts: 73
Joined: Sat Jul 03, 2010 2:26 pm

Re: Rock5's craftItem function

#8 Post by nokirk » Fri Jul 08, 2011 8:51 am

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!

User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Rock5's craftItem function

#9 Post by botje » Mon Jul 18, 2011 4:11 pm

any way of letting this bulk process whole bag?

like craftitem(all, all)

?

Botje

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

Re: Rock5's craftItem function

#10 Post by rock5 » Mon Jul 18, 2011 8:08 pm

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?
  • 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
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Rock5's craftItem function

#11 Post by lisa » Mon Jul 18, 2011 10:02 pm

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.
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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Rock5's craftItem function

#12 Post by rock5 » Tue Jul 19, 2011 12:37 am

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.
  • 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: Rock5's craftItem function

#13 Post by botje » Tue Jul 19, 2011 2:47 am

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

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

Re: Rock5's craftItem function

#14 Post by rock5 » Tue Jul 19, 2011 2:58 am

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.
  • 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: Rock5's craftItem function

#15 Post by botje » Tue Jul 19, 2011 3:45 am

k, ill try after the server maintenance is over :)

ill report back

Botje

User avatar
botje
Posts: 656
Joined: Wed Oct 27, 2010 7:17 am

Re: Rock5's craftItem function

#16 Post by botje » Tue Jul 19, 2011 10:52 am

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 :)

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

Re: Rock5's craftItem function

#17 Post by rock5 » Wed Jul 27, 2011 8:52 pm

I've updated the address in the function to support client patch 4.01.
  • 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

nokirk
Posts: 73
Joined: Sat Jul 03, 2010 2:26 pm

Re: Rock5's craftItem function

#18 Post by nokirk » Thu Jul 28, 2011 1:38 pm

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
Attachments
EXT housecraft.xml
(1.36 KiB) Downloaded 218 times

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

Re: Rock5's craftItem function

#19 Post by rock5 » Fri Sep 09, 2011 3:28 am

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.
  • 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

Dsanchez
Posts: 77
Joined: Thu Aug 04, 2011 11:20 pm

Re: Rock5's craftItem function

#20 Post by Dsanchez » Fri Sep 09, 2011 7:13 am

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

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests