SphereCommunity
top container - Printable Version

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



top container - Rizz - 05-17-2015 08:44 AM

Is there a key to find which one is the top container?


RE: top container - XuN - 05-17-2015 05:01 PM

TopObj will refer to the most top container (including characters which are also considered the top container), if you don't want characters and returning it in the top container only ... you can use something like this:


Code:
[function GetTopCont]
if (!<IsItem>)
return 0
if (<Cont.IsChar>)
return 0// or return <uid>, whatever pleases you more
endif
ref1=<cont> // We set REF1 to the item's container
while (<ref1.cont.IsItem>) // and make it loop through all containers above (only if they are items) by setting ref1 to this container.
ref1=<ref1.cont>
endif
return <ref1>



RE: top container - Rizz - 05-18-2015 02:49 AM

Thx i will try