• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Some Rune Functions

Qwe

Banned User
Joined
May 19, 2009
Messages
122
Reaction score
8
Location
$user->getLocation();
Hello, I started to learn Lua and I would like to present my first code... These are the three simple functions, which can operate with runes, check the number of remaining charges or change the quantity, whether the left or the last charge...

Functions:
* getRuneCharges(item) - returns charges of rune
* setRuneCharges(item, charges) - sets rune charges
* isLastCharge(item) - it's last charge of this rune?

in data/lib/function.lua
PHP:
function getRuneCharges(item)
	return item.type
end

function setRuneCharges(item, charges)
	return doTransformItem(item, item.itemid, (charges <= 255) and charges or 255)
end

function isLastCharge(item)
	return (item.type == 1) and TRUE or FALSE
end

Regards,
Qwe.
 
Last edited:
what exactly is this for?

maybe... a new system like, if this is your last charge, you get a message:

do you want to recharge your rune?

Yes~no~*

if yes -> recharge and hunt a lot again!
if no -> ok, dont hunt and die (again!)
if * -> i just want to know if you want it or not...

or another good idea...
 
-- EDITED --

Removed, reason: I don't like this function.
 
Last edited:
Back
Top