Page 1 of 1

userfunction_magicbox

Posted: Wed Jun 17, 2015 4:51 am
by Celesteria
hello again,

this is a set of functions to fuse items/elements/manastones without the need of an ingame-addon like fusion. It handles nearly every functionality of the magicbox.

(UMB = userfunction_magicbox)


function UMB_getCharges ()
------------------------------------------------------------------------------------
-- get current amount of arcane charges
--
-- arguments:
-- none
-- returns:
-- number
------------------------------------------------------------------------------------


function UMB_getMagicBoxEnabled ()
------------------------------------------------------------------------------------
-- check if magicbox is enabled
--
-- arguments:
-- none
-- returns:
-- boolean
------------------------------------------------------------------------------------


function UMB_buyCharges (secPass, numTokensToKeep)
------------------------------------------------------------------------------------
-- find ID, buy arcane charges from itemshop using phirius tokens, use items
--
-- arguments:
-- secPass - [required] secondary password
-- numTokensToKeep - [optional] how many phirius tokens left (at least)
--
-- returns:
-- nothing
------------------------------------------------------------------------------------


function UMB_numToBuy (id, itemTier, maxStoneTier)
------------------------------------------------------------------------------------
-- calculates the number of required items/stones
--
-- arguments:
-- id - [required] id of item to check (f.e. from fjord is 228966, default stone id is 202999)
-- itemTier - [required] tier of the item in itemID (belt from fjord is 5)
-- maxStoneTier - [optional] highest tier to build (default 20)
-- returns:
-- number
------------------------------------------------------------------------------------


function UMB_fuseItems (...)
------------------------------------------------------------------------------------
-- fusing a list of items
--
-- arguments:
-- a list of (max. 5) items or itemIDs or itemNames (mixed)
--
-- returns:
-- nothing
------------------------------------------------------------------------------------


function UMB_fuseTierStones (itemID, itemTier, stoneID, maxStoneTier)
------------------------------------------------------------------------------------
-- fuses items and fusion stones as much as possible
--
-- arguments:
-- itemID - [required] id of the item to use (belt from fjord is 228966)
-- itemTier - [required] tier of the item in itemID (belt from fjord is 5)
-- stoneID - [optional] id of fusion stones to use (default 202999)
-- maxStoneTier - [optional] highest tier to build (default 20)
--
-- returns:
-- nothing
------------------------------------------------------------------------------------

function UMB_fuseElements (element, level, amount)
------------------------------------------------------------------------------------
-- fuses elements to higher level
--
-- arguments:
-- element - [required] type of element - ELE_WIND, ELE_WATER, ELE_FIRE, ELE_EARTH
-- level - [required] max level to fuse - LVL_STARDUST, LVL_SAND, LVL_STONE, LVL_DIAMOND
-- amount - [optional] number of fused elements in bag to finish
--
-- returns:
-- boolean - failure or success
------------------------------------------------------------------------------------


Version 1.2
* functions renames to prevent problems with other fusion functions
* added function UMB_getCharges and UMB_getMagicBoxEnabled
* making UMB_numToBuy public
* added the variable __timing to balance the speed of fusing (sometimes the bot is faster than RoM)
Version 1.1
* removed a copy'n'paste bug
Version 1.0
* initial release

Re: userfunction_magicbox

Posted: Sat Jun 27, 2015 7:11 am
by Celesteria
updated to version 1.2

Re: userfunction_magicbox

Posted: Sat Jun 27, 2015 2:21 pm
by leroy
Sofar the Fusion addon has been enough for me but I might just try your functions :)
Thanx for all the contributions you made!

Re: userfunction_magicbox

Posted: Thu Mar 15, 2018 1:01 pm
by Agrozet
Hi.
Can you tell me what to insert in the script to repeat the task and finish ok?
Thank you

Code: Select all

<?xml version="1.0" encoding="utf-8"?><waypoints type="RUN">
<onload>	
	
	UMB_fuseItems (241095,241095,241095,241114)	
	yrest(2000)
	if inventory:itemTotalCount(241096) ~= 81 then
	inventory:update()
	return UMB_fuseItems (241095,241095,241095,241114)
	end
-----------------------------------------------------------
	UMB_fuseItems (241096,241096,241096,241114)	
	yrest(2000)
	if inventory:itemTotalCount(241097) ~= 27 then
        inventory:update()	
	return UMB_fuseItems (241096,241096,241096,241114)	
	end
--------------------------------------------------------------	
	UMB_fuseItems (241097,241097,241097,241114)	
	yrest(2000)
	if inventory:itemTotalCount(241098) ~= 9 then
	inventory:update()
	return UMB_fuseItems (241097,241097,241097,241114)	
	end
------------------------------------------------------------
	UMB_fuseItems (241098,241098,241098,241114)

</onload>

</waypoints>