|
Makadungdung Newbie
Joined: 21 Jun 2012 Posts: 8
|
Posted: Thu Jun 21, 2012 2:25 am
Help with script. Thanks! |
Wonder if anybody can give me pointers as how to solve this problem:
The situation is there is a box with different crafting items and i'd like to make a single alias/script to quickly craft an item. Here are the parameters:
-It takes 3 of the same item to craft, note that some items in the box have less than 3, and some items aren't even craftable
-The alias should choose the most 'expensive' items to first craft.
Here's a craftable item list from most expensive to least expensive:
adamantium, gold, iron, glowing rocks
How would I go about doing this? Thanks =) I'm a very newbie scripter looking to improve (my first exposure to coding was through Zmud triggers lol! and made me interested ever since). Any pointers would be helpful!
The capture is as follows---------------
Health:6879/6879 Mana:450/450
A grey box has:
glowing rocks [45]
a lump of iron [3]
a piece of gold [9]
a scrap of metal [4]
a piece of bronze ore [12]
some adamantium [2]
a lump of clay [5]
a piece of steel
Health:6879/6879 Mana:450/450 |
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Jun 21, 2012 12:25 pm |
A few questions:
Is it always a grey box? Or do you want to specify a target container each time?
What is/are the commands to craft?
Are you only concerned with adamantium, gold, iron, and glowing rocks? What about the bronze and steel in the box?
How do you want this crafting process to be initiated? Perhaps you want an alias like "docraft grey box" which looks into the grey box and starts crafting?
Do you want this script to just craft one thing, or to continue crafting until it can't make anything else?
Do the names of the ingredients ever change? Like, does "some adamantium" ever become "a lot of adamantium" or "glowing rocks" become "a glowing rock"?
While crafting, is there any mud output that you have to worry about? In particular, are there any potential error messages, like "You are missing a tool."?
If you could give us the complete mud output of a crafting session, it would be useful. When you cut and paste the text into the forum, precede it with [code] and end it with [/code]. That will format it exactly the way it comes from the mud, which is important for writing triggers. |
|
|
|
Makadungdung Newbie
Joined: 21 Jun 2012 Posts: 8
|
Posted: Thu Jun 21, 2012 10:29 pm |
Hey thanks for the quick reply!
Here are the answers to your questions, hope it helps:
Yes it will always be a grey box.
The command to craft is 'melt ore (materialname here)' and then the second step is 'make bar (materialname here). The second step takes two ores. So it's a two step crafting thing, in total needing 3 of the same ore. So the first step takes one unit to melt it, and the second step takes two more of the same unit to turn it into a bar.
Yes only concerned with adamantium, gold and iron. There are others, however i didn't list it fearing it may be too complicated. Just wanted pointers on how to make a 'hierarchy' of 'importance' so that it would always craft a certain one first.
The crafting would be initiated by an alias hopefully. And only craft one item at a time.
The name of the ingredients do not change when quantity changes. However if there are mutliple ores it will look like 'some iron ore [5]' if the quantity is only one, it will look like 'some iron ore'.
Yes there's an error output you have to worry about: 'Cannot make bar from (ore)' This happens if you try to make a bar without melting it first.
Code: |
Health:6879/6879 Mana:450/450 look in bag
A small bag contains:
glowing rocks [45]
a lump of iron [3]
a piece of gold [9]
a scrap of metal [4]
a piece of bronze ore [12]
some adamantium [2]
a lump of clay [5]
a piece of steel
Health:6879/6879 Mana:450/450 st
You are already standing.
Health:6879/6879 Mana:450/450 get 3*bronze bag
You get a piece of bronze ore from a small bag.
You get a piece of bronze ore from a small bag.
You get a piece of bronze ore from a small bag.
Health:6879/6879 Mana:450/450 get resin box
You carefully remove a bit of resin from a box.
Health:6879/6879 Mana:450/450 melt ore bronze
You melt a piece of bronze ore.
Health:6879/6879 Mana:450/450 make bar ore
You make a bar of bronze from a piece of bronze ore
Health:6879/6879 Mana:450/450
|
The possible error messages that can return are:
You do not have any resin
You aren't carrying that item (if ore is not present in inventory for either melting process, or make-bar process)
------
I wonder what would be the best solution.. to just look in the bag, and have a script calculate everything out? Or to actually keep 'inventory' or a database of what you have and run the script in the background so it doesn't have to keep looking at the inventory. Pretty interested to see what the solution might be.
Also if the trigger does not find any craftable items, is it possible to return something like 'say bag has no craftable ore' or something like that.
Again thanks for the quick reply! |
|
|
|
Makadungdung Newbie
Joined: 21 Jun 2012 Posts: 8
|
Posted: Mon Jun 25, 2012 6:27 pm |
Can anybody give me pointers or clues as to what functions to use to go about accomplishing this? XD Thanks
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|