SphereCommunity
Question : Getting the @create-Color via Itemdef - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Question : Getting the @create-Color via Itemdef (/Thread-Question-Getting-the-create-Color-via-Itemdef)



Question : Getting the @create-Color via Itemdef - Shidhun - 03-01-2013 06:04 PM

Hello,

i have just a small question regarding Serv.Itemdef

Is there a command to get the Color (or another attribute) that one Item gets after create?

I want to check if an Item was altered, after it has been created.

Lets say i have a Rose-Heater. @create the Heater normally gets the color (color=color_o_rose). Now i want to check if it still has this defined color (or another attribut) or if it was changed by a gm or by anything else.

I tried it with something like :

if (<serv.itemdef.(argo.id).color> = <argo.color>)

but this didn't work, i assume because of sphere checking the status before @create

Of course i could use other checks using defnames or creating a dummy-item, but this is not a fine way


RE: Question : Getting the @create-Color via Itemdef - darksun84 - 03-01-2013 07:37 PM

There isn't a color field in a ITEMDEF definition, but it's only used as item property.


RE: Question : Getting the @create-Color via Itemdef - admin phoenix - 03-01-2013 07:58 PM

you have to create the item too via script and then check the color like
serv.newitem=i_your_item
local.color=<new.color>


RE: Question : Getting the @create-Color via Itemdef - Shidhun - 03-01-2013 08:00 PM

I see,

so the only way would be to use a workaround like this ?

Example:
serv.newitem <serv.itemdef.<argo.id>>
local.color= <new.color>
new.remove
if !(<local.color> = <argo.color>)
src.sysmessage Abort: Item was manipulated
return 1
endif

EDIT ; Phoenix was first Tongue i should write faster


RE: Question : Getting the @create-Color via Itemdef - RanXerox - 03-02-2013 09:30 AM

You can add a permanent TAG to any ITEMDEF and reference that tag in your script... the ITEMDEF might looks like this:

Code:
[ITEMDEF 02db]
//"One of the keys to access Dreadhorn.
// Found on the ground in Twisted Weald, this item has a timed life span."
DEFNAME=i_blighted_cotton
NAME=blighted cotton
TYPE=t_normal
VALUE=100
WEIGHT=1.0
CATEGORY=Quest
SUBSECTION=Twisted Weald
DESCRIPTION=Blighted Cotton
TAG.TrueColor=05a3
TEVENTS=e_timed_key
ON=@Create
   COLOR=<TAG.TrueColor>