FncHelp says:
(itmSetData item attrib data [count]) -> item
and when I use:
(itmSetData (itmCreate &itWaterIce; 1) "data" 42)
I get as the return:
(16422 -16777215 48 0 0 "\0\0\0\0\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff" "|\0\0\0AOLA\x01\0\0\0\x01\0\0\0\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x09\0\0\0\0\0\0\0\x01\0\0\0\xff\xff\ xff\xff\0\0\0\0\0\0\0\0\x09\0\0\0\x01\0\0\0\0\0\0\0\xff\xff\xff\xff\x01\0\0 \0\x01\0\0\0\x01\0\0\0\x04\0\0\0data\x02\0\0\0\x01\0\0\0\x02\0\0\042\x02\0\0\0\0\0")
which I can only assume is the entire item and it's data in hex.
The real problem is, when data is set already on the fruit I am unable to overwrite that data.
So, is this working as intended?
If so, what is the proper way to use itmSetData to change data that is already set?
For reference, this is the code that sets the data on fruit initially and the code I'm using to try and change it:
From StKatharines.xml line 356
Code: Select all
(objAddItem gSource
(itmSetData
(itmCreate theItemUNID produceCount)
"expireTime"
(add (unvGetTick) (random expireTime (add expireTime 1800)))
produceCount
)
)
My attempt to alter the data:
Code: Select all
(objEnumItems gSource "* +FreshFood;" theItem
(block (expiry fruitCount)
(setq expiry (itmGetData theItem "expireTime"))
(setq fruitCount (itmGetCount theItem))
(if (ls (unvGetTick) expiry)
(block (rand)
(setq rand (random 5 15))
(itmSetData theItem "expireTime"
(add rand expiry)
(itmGetCount theItem)
)
)
)
)
)
Any help would be appreciated, Thanks!
EDIT:
Thanks to Betelgeuse/Taben for explaining the use of ObjSetItemData, the mod is now working as intended.