• 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!

Optmizing "doPlayerAddItem"

Dankoo

Active Member
Joined
Sep 4, 2010
Messages
1,007
Reaction score
27
Well, this function could be optimized with an feature to check if player has capacity and free slots to take the item.

Like in quest system (where you set ActionID = 2000 and place item inside container at map editor)

In this script it's like this:

LUA:
	if(doPlayerAddItemEx(cid, reward.uid, false) ~= RETURNVALUE_NOERROR) then
		result = "You have found a reward weighing " .. getItemWeight(reward.uid) .. " oz. It is too heavy or you have not enough space."
	else
		result = "You have found " .. result .. "."
		setPlayerStorageValue(cid, storage, 1)

But there are a lot of quests that we don't use this system, then the item falls to the ground lol

It would be nice if this check was made by the function itself ^_^
 
do you even know what's optimization

and yea it is, different messages when you don't have cap or room

This part of the script I posted is from "actions/scripts/system.lua", wich is the default quest script with ActionID 2000 and stuff

I said that the function "doPlayerAddItem" itself should have this, instead of having to put this in every script

because now items falls to the floor, lol, fucking ugly...
 
Last edited:
I said that the function "doPlayerAddItem" itself should have this, instead of having to put this in every script
I said this isn't called optimization

doPlayerAddItem doesn't need this and doPlayerAddItemEx was made for this purpose, it's not my or the developers' fault that your chests are scripted in a bad way
 
I said this isn't called optimization

doPlayerAddItem doesn't need this and doPlayerAddItemEx was made for this purpose, it's not my or the developers' fault that your chests are scripted in a bad way

dude just killed the world's most venenous scorpion *-*

serious, I went to take a shower, I looked to my side, just saw that fucking scorpion laying in the wall, got out of the toilet with a jump, he was 10cm of my face

then I tied some papers in a rolling pin, took my brother's deodorant and lit the paper on the rolling pin, to make those sprays of fire...

bah, the rest is history

@topic

Ok, so I should chance all doPlayerAddItem to doPlayerAddItemEx and it will work like tibia RL then? '-' I'll do it.. Tomorrow, I'll just take my damn shower :}

PS: with this msg ppl might think Brazil is a jungle lol kk, rare to see a fly here, this scorpion appeared 'cause we're rebuilding an external area of the house, and there's some rubbish that might have attracted it

PS2: Cyk, chill out dude ;o
 
Back
Top