SphereCommunity
DispID - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: DispID (/Thread-DispID)



DispID - Q23A - 06-08-2012 07:19 PM

Hello. Have can check items in mul?
Example if i create i_stairs_wood _2, than I can check it with this if (<dispid> == i_stairs_wood_2)
But have can I check the same item if it is not created item, but it is in .mul.


RE: DispID - Gil Amarth - 06-09-2012 12:12 AM

You can use serv.defname.

if (<src.defname> == <serv.defname.i_stairs_wood_2>)

This way, you don´t need to create any item, you directly seek in the object "server". i_stairs_wood_2 definition and all his properties who are below his [ITEMDEF xxxx]
DEFNAME=i_stairs_wood_2...


RE: DispID - Q23A - 06-09-2012 02:59 AM

This is not what I need:

[function checkforitems]
foritems 0
if (<baseid> == i_box_box)
remove
return 1
elif (<dispid> == i_stairs_wood_2) - Stairs find only if I create it with .add I_stairs_wood_2,but I need that it check i_stairs_wood_2 what is already in .mul file. this is my tournament arena wall.
return 1
endif
endfor


RE: DispID - Shaklaban - 06-09-2012 04:02 AM

you can use isneartype function:

[ITEMDEF 0720]
DEFNAME=i_STAIRS_WOOD
type=t_bla_bla
RESOURCES=50 I_BOARD
CATEGORY=Buildings - Stairs
SUBSECTION=Wooden Stairs (light)
DESCRIPTION=@
DUPELIST=0721,0722,0723,0724,0725,0726,0727,0728,0729,072a,072b,072c,072d,072e,0​72f,0730,0731,0732,0733,0734,0735

[typedef bla_bla]

[function checkforitems]
...
elif (<isneartype t_bla_bla>
return 1
endif


RE: DispID - jeem - 06-09-2012 07:02 AM

And if you don't want to change the item's type, check the statics functions here: http://wiki.sphere.torfo.org/index.php/Map_Points


RE: DispID - Gil Amarth - 06-09-2012 06:55 PM

Maybe you can use:

elif (<dispid> == <serv.itemdef.i_stairs_wood_2.dispid>)


You can´t directly access to .mul files, somewhere in your scripts there is a ITEMDEF definition who tells Sphere which direction in .mul files has to look.
In this case:

[ITEMDEF xxxxx] // Where xxxxx is the hexadecimal number at .mul files
DEFNAME = i_stairs_wood_2

It´s where sphere knows where have to look. If you want to know a property without create a item, you have to use SERV.ITEMDEF.i_stairs_wood_2.whatever

There is no other way.


RE: DispID - Q23A - 06-10-2012 01:35 AM

Not working, but anyway thank you. I gonna try something else.