-------------------------- -- Element Fuser By Rock5 -- Version 1.1 -------------------------- -- User options local MakeType = "Wind" -- "Wind", "Water", "Fire" or "Earth" local MakeLevel = 3 -- 1 = Element, 2 = Stardust, 3 = Sand, 4 = Stone, 5 = Diamond local MakeNumber = 3 -- Final number you will have in your inventory at the end. -------------------------- local Data = { ["Wind"] = { [1] = {Id = 241479}, -- Element [2] = {Id = 241334}, -- Stardust [3] = {Id = 241333}, -- Sand [4] = {Id = 241332}, -- Stone [5] = {Id = 241331}, -- Diamond }, ["Water"] = { [1] = {Id = 241480}, -- Element [2] = {Id = 241338}, -- Stardust [3] = {Id = 241337}, -- Sand [4] = {Id = 241336}, -- Stone [5] = {Id = 241335}, -- Diamond }, ["Fire"] = { [1] = {Id = 241481}, -- Element [2] = {Id = 241342}, -- Stardust [3] = {Id = 241341}, -- Sand [4] = {Id = 241340}, -- Stone [5] = {Id = 241339}, -- Diamond }, ["Earth"] = { [1] = {Id = 241482}, -- Element [2] = {Id = 241346}, -- Stardust [3] = {Id = 241345}, -- Sand [4] = {Id = 241344}, -- Stone [5] = {Id = 241343}, -- Diamond }, } local EleData = Data[MakeType] local function EmptyMagicbox(quick) local function findEmpty(num) local count = 0 for i = 61,240 do local item = inventory.BagSlot[i] item:update() if item.Available and item.Empty then count = count + 1 end if count >= num then return item end end end if quick then local emptynum = 0 local itemmoved = false for i = 51,60 do local item = inventory.BagSlot[i] item:update() if not item.Empty then emptynum = emptynum + 1 local BagEmpty = findEmpty(emptynum) if not BagEmpty then error("Not enough bag space to empty transmutor.",0) end item:pickup() BagEmpty:pickup() itemmoved = true end end if itemmoved then yrest(500) end else --local itemmoved = false for i = 51,60 do local item = inventory.BagSlot[i] item:update() if not item.Empty then item:moveTo("bags") end end --if itemmoved then yrest(500) end end end local function Fuse(id,num) -- Move items to magic box local need = num local magicslot = 51 for i = 61,240 do local item = inventory.BagSlot[i] item:update() if item.Available and (not item.Empty) and item.Id == id then if item.ItemCount > need then RoMScript("SplitBagItem("..item.BagId..","..need..")") need = 0 else item:pickup() need = need - item.ItemCount end yrest(200) inventory.BagSlot[magicslot]:pickup() yrest(200) magicslot = magicslot + 1 end if need == 0 then break end end yrest(500) -- Press 'Confirm' RoMScript("MagicBoxRequest()"); yrest(500) EmptyMagicbox() inventory:update() end -- Empty Magicbox EmptyMagicbox(true) while MakeNumber > inventory:itemTotalCount(EleData[MakeLevel].Id) do -- Create MakeList local need = inventory:itemTotalCount(EleData[MakeLevel].Id) + 1 -- Make 1 at a time for i = MakeLevel, 1, -1 do local count = inventory:itemTotalCount(EleData[i].Id) if need > count then EleData[i].Make = need - count need = EleData[i].Make * 3 else -- Have enough EleData[i].Make = 0 need = 0 end end -- Check if you have enough Elements if EleData[1].Make > 0 then -- Can't make elements error("Not enough elements. You need "..EleData[1].Make.." more to make another.",0) end -- Make starting from level 2 (uses level 1) for i = 2, MakeLevel do local targetnum = inventory:itemTotalCount(EleData[i].Id) + EleData[i].Make while targetnum > inventory:itemTotalCount(EleData[i].Id) do if RoMScript("GetMagicBoxEnergy()") == 0 then error("Out of charges",0) end Fuse(EleData[i-1].Id,3) end end end error("Finished element fusing.",0)