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

Help with doItemSetAttribute(uid, "aid", ...)

Status
Not open for further replies.
Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
I'm sick now trying to understand why this isn't working :S!

LUA:
local actionBase = 100
local aid = actionBase + getPlayerStorageValue(cid, calledCreature)
doItemSetAttribute(item.uid, "aid", aid)

Error:
LUA:
[21/02/2010 20:47:21] [Error - Action Interface] 
[21/02/2010 20:47:21] data/actions/scripts/ploplo.lua:onUse
[21/02/2010 20:47:21] Description: 
[21/02/2010 20:47:21] data/actions/scripts/ploplo.lua:63: attempt to perform arithmetic on a string value
[21/02/2010 20:47:21] stack traceback:
[21/02/2010 20:47:21] 	data/actions/scripts/ploplo.lua:63: in function <data/actions/scripts/ploplo.lua:22>

It works in this way...
LUA:
--(actionBase + getPlayerStor... = 251) So...
--If i use the code like this:
doItemSetAttribute(item.uid, "aid", 251)

--IT WORKS
 
I don't know why getPlayerStorageValue returns a string, but you can enclose it with tonumber(), ex;

Code:
[COLOR=#B1B100]local[/COLOR] aid [COLOR=#66CC66]=[/COLOR] actionBase + tonumber(getPlayerStorageValue[COLOR=#66CC66]([/COLOR]cid, calledCreature[COLOR=#66CC66]))
[/COLOR]
 
I don't know why getPlayerStorageValue returns a string, but you can enclose it with tonumber(), ex;

Code:
[COLOR=#B1B100]local[/COLOR] aid [COLOR=#66CC66]=[/COLOR] actionBase + tonumber(getPlayerStorageValue[COLOR=#66CC66]([/COLOR]cid, calledCreature[COLOR=#66CC66]))
[/COLOR]

Well i tried
LUA:
local aid = tonumber(actionBase + getPlayerStorageValue(cid, calledCreature))

But sill not working
 
Then either actionBase is a string or the storage value is nil.

No, actionBase = 100, storage value is 151, (I checked it used "doPlayerSendCancel(cid, getPlayerStor...) and it returns "151", checked using "doPlayerSendCancel(cid, actionBase + getPlayerS...)" and it retuns "251")

Is a problem with the function "doItemSetAttribute"

I got the problem... by badd! :O!! xD
 
Last edited by a moderator:
Status
Not open for further replies.
Back
Top