Page 1 of 2

Dissassemble Materials

Posted: Fri Aug 16, 2013 4:27 am
by Draakje
someone can write a small or short macro to dissassemble materials:
has like right click the material (object or item), wait 1sec then right click again (loop it for 999 times)


trying something out, but im missing lot, no idea how start it.

UseItem("Dark Crystal Sand")
wait 1

Re: Dissassemble Materials

Posted: Fri Aug 16, 2013 5:01 am
by ratzuk
I Use this:

Code: Select all

<waypoints type="TRAVEL">
	<onLoad>	
	itemname ="Sinners Palm Sap"	
	
	RoMScript("CloseAllWindows()") -- Don't want to accidentaly sell stuff!
	while inventory:getItemCount(itemname) > 0 do
		for i, item in pairs(inventory.BagSlot) do					
			if item.Name == itemname then
				item:use() -- Breaks it up
				yrest(1200)
			end
		end
	end
	</onLoad>	
</waypoints>
Change itemname to suit

Re: Dissassemble Materials

Posted: Fri Aug 16, 2013 5:10 am
by Draakje
ratzuk wrote:I Use this:

Code: Select all

<waypoints type="TRAVEL">
	<onLoad>	
	itemname ="Sinners Palm Sap"	
	
	RoMScript("CloseAllWindows()") -- Don't want to accidentaly sell stuff!
	while inventory:getItemCount(itemname) > 0 do
		for i, item in pairs(inventory.BagSlot) do					
			if item.Name == itemname then
				item:use() -- Breaks it up
				yrest(1200)
			end
		end
	end
	</onLoad>	
</waypoints>
Change itemname to suit
where u place this in?

Re: Dissassemble Materials

Posted: Fri Aug 16, 2013 6:01 am
by Draakje
got it, ty

Re: Dissassemble Materials

Posted: Wed Aug 21, 2013 10:54 am
by Draakje
is it possible to make an addon macro of this? so u can activate dissassemble materials ingame by type /Start Dissassemble and maybe possible change item name ingame too. So diff materials can be done ingame, without editing file constantly.

Gave it a try write myself, but gues some probs in it:

Lua file

Code: Select all

local activate = true -- Starting value

SLASH_DissMats1 = "/DissambleMaterials"
SLASH_DissMats2 = "/DM" -- Add as many variations as you like just increment the number
SlashCmdList["DissMats"] = function(editBox, msg)
    if msg then
        msg = string.lower(msg)
        if msg == "start" then -- start
            activate = true
        elseif msg == "stop" then -- stop
            activate = false
        else
            activate = not activate -- Toggles addon if 'start' or 'stop' is not used.
        end
        if activate then
            itemname ="Dark Crystal Ingot"

            RoMScript("CloseAllWindows()") -- Don't want to accidentaly sell stuff!
            while inventory:getItemCount(itemname) > 0 do
                for i, item in pairs(inventory.BagSlot) do
                    if item.Name == itemname then
                        item:use() -- Breaks it up
                        yrest(1200)
                    end
                end
            end
        else
            SendSystemChat("Dissambling Materials has been stopped")
        end
    end
end




local DissMats = {} -- the AddOn namespace, all your functions should be placed inside here instead of as globals.
_G.DissMats = DissMats -- expose it to the global scope




    local time_remaining = 0.5 -- in seconds
       function DissMats:OnUpdate(elapsed)
        if activate == false then
        return
        end
       end
Xml file

Code: Select all

<Ui xmlns="http://www.runewaker.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.runewaker.com/UI.xsd">
    <Frame name="DissambleMaterials_Frame">
        <Scripts>
            <OnUpdate>
                DissMats:OnUpdate(elapsed)
            </OnUpdate>
        </Scripts>
    </Frame>
</Ui>

Re: Dissassemble Materials

Posted: Wed Aug 21, 2013 11:31 am
by rock5
You can't use rombot functions such as RoMScript and inventory:itemTotalCount in a game addon. You would have to use only in game function.

Re: Dissassemble Materials

Posted: Wed Aug 21, 2013 12:38 pm
by Draakje
ah i see

Re: Dissassemble Materials

Posted: Wed Aug 21, 2013 12:39 pm
by Draakje
but its still possible? what functions should be needed then

Re: Dissassemble Materials

Posted: Wed Aug 21, 2013 2:33 pm
by rock5
Try this for your lua. No guarantee it will work though.

Code: Select all

local activate = true -- Starting value
local itemname ="Dark Crystal Ingot"


SLASH_DissMats1 = "/DissambleMaterials"
SLASH_DissMats2 = "/DM" -- Add as many variations as you like just increment the number
SlashCmdList["DissMats"] = function(editBox, msg)
    if msg then
        msg = string.lower(msg)
        if msg == "start" then -- start
            activate = true
        elseif msg == "stop" then -- stop
            activate = false
        else
            activate = not activate -- Toggles addon if 'start' or 'stop' is not used.
        end
    end
end

local time_remaining = 1.2 -- in seconds
function DissMats:OnUpdate(elapsed)
	if activate = false then
		return
	end
	
	time_remaining = time_remaining - elapsed
	if time_remaining > 0 then
		-- cut out early, we're not ready yet
		return
	end

	-- Search for item
	local item, name, found
	for slot = 1,60 do
		index, _, name = GetBagItemInfo(slot)
		if name == itemname then
			found = index
			break 
		end
	end 
	
	if found then
		StoreFrame:Hide()
		UseBagItem(found)
	else
		activate = false
	end
	time_remaining = 2 -- reset to 2 seconds
end
	
I've set it to stop when it runs out of items so you need to start it after getting the items.

Re: Dissassemble Materials

Posted: Wed Aug 21, 2013 2:44 pm
by Draakje
can u also adjust itemname function change, with typing ingame what material u want dissamble?

Re: Dissassemble Materials

Posted: Wed Aug 21, 2013 4:04 pm
by Draakje
its not working so far, will have look tommrow what could be wrong

Re: Dissassemble Materials

Posted: Wed Aug 21, 2013 4:08 pm
by Draakje
Maybe its missing the right click function, or i read somewhere they use: UseItemByName(".....")

added: end at bottom and my program also give maybe error part at

Code: Select all

function DissMats:OnUpdate(elapsed)
    if activate = false then
    return
    end

Re: Dissassemble Materials

Posted: Thu Aug 22, 2013 6:11 am
by rock5
Draakje wrote:Maybe its missing the right click function, or i read somewhere they use: UseItemByName(".....")
UseBagItem and UseItemByName is basically the same thing done 2 different ways. You could try using UseItemByName but I suspect it's not working because the function is disabled in addons. A lot of functions are disabled in addons and can't be used.
Draakje wrote:added: end at bottom and my program also give maybe error part at
I think my code is missing an 'end'. I'll update the above code and put the extra 'end' in the right place.

Re: Dissassemble Materials

Posted: Thu Aug 22, 2013 12:17 pm
by Draakje
hmm still not working

Re: Dissassemble Materials

Posted: Thu Aug 22, 2013 12:29 pm
by rock5
Then I don't think it's possible.

Re: Dissassemble Materials

Posted: Wed Dec 11, 2013 3:46 pm
by lolilol
I have this message when I start this waypoint : No waypoints to go to waypoint file.
can someone help me please?

thanks

Re: Dissassemble Materials

Posted: Wed Dec 11, 2013 6:54 pm
by noobbotter
Probably the best bet for Draakje at this point would be to create a script similar to the "createpath" Lua file where it would bring up a menu and you could use the numpad keys to select which item you want to break down. You'd have to build out the menus to where when you select the item you want to breakdown, the lua would set the variable to the correct item name and run the function that loops through the bag items.

Seems like a lot of work though versus the other option... Create a subfolder and make copies of the waypoint file that breaks an item down. Each copy could easily be named by the item it breaks down. That way all those same scripts are in the same location and they all do the same thing. They just each have a different item name in the variable.

Just some thoughts.

Re: Dissassemble Materials

Posted: Wed Dec 11, 2013 10:05 pm
by rock5
I think the easiest would be to add an option to the slash command eg.

Code: Select all

/DM Start "Dark Crystal Ingot"
or even easier, to have it disassemble any mat in slot 1 of the bag, by default. Then you wouldn't even need to type the name. Just put the item you want to disassemble into slot 1 and it disassembles all items of that name.

Re: Dissassemble Materials

Posted: Thu Dec 12, 2013 4:51 am
by lolilol
I don't understand one thing, this code :
<waypoints type="TRAVEL">
<onLoad>
itemname ="Sinners Palm Sap"

RoMScript("CloseAllWindows()") -- Don't want to accidentaly sell stuff!
while inventory:getItemCount(itemname) > 0 do
for i, item in pairs(inventory.BagSlot) do
if item.Name == itemname then
item:use() -- Breaks it up
yrest(1200)
end
end
end
</onLoad>
</waypoints>
it's a waypoint or I need to put in an other file?

Thanks for help

Re: Dissassemble Materials

Posted: Thu Dec 12, 2013 5:01 am
by lisa
<waypoints type="TRAVEL">
Yes it is definately a waypoint and needs to be the only code inside the wp, easiest thing to do would be to copy an existing WP and then rename it. Then open it and delete all existing code in the new file and paste in the code that was posted here, then save and give it a try.

=)