SphereCommunity
Enhanced .info for statics and map - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Submissions (/Forum-Script-Submissions)
+--- Thread: Enhanced .info for statics and map (/Thread-Enhanced-info-for-statics-and-map)



Enhanced .info for statics and map - wuffel - 04-04-2014 02:07 AM

Hi.
It was always a bit annoying to get the color of a static item. The Info-command delivers a few informations about map and statics, even there is the possibilty to get the color of a static item. It will deliver to much informations when two identical Statics (same ID and Z-Level) are on the same spot.
Code:
[function f_oncommand]
if !strcmpi(info,<strarg <args>>)
    f_info
    return 1
endif

[function f_info]
if <findid.i_info_target>
    findid.i_info_target.remove
    sysmessage @04ea Old target-cursor removed, try again.
    return 1
endif
serv.newitem i_info_target
new.timer -1
equip <new>

[itemdef i_info_target]
ID=i_memory
name=Targettile for Info
TYPE=t_eq_script
layer=30

on=@equip
targetg @04ea Get the Target.

on=@TargOn_Ground
local.amount = <serv.map(<src.targp.x>,<src.targp.y>).statics>
if !<local.amount>
    src.sysmessage [No static tile], Terrain=<serv.map(<src.targp.x>,<src.targp.y>).terrain>, Z=<serv.map(<src.targp.x>,<src.targp.y>).terrain.z>, TYPE=<serv.map(<src.targp.x>,<src.targp.y>).type>
    remove
    return 1
endif
for x 0 <local.amount>
    if (<serv.map(<src.targp.x>,<src.targp.y>).statics.<local.x>.z> == <src.targp.z>) && (<argn1> == <serv.map(<src.targp.x>,<src.targp.y>).statics.<local.x>.id>)
        src.sysmessage [Statics at Z=<src.targp.z>:
        src.sysmessage <hval <argn1>>=<serv.itemdef.<argn1>.defname>-><serv.itemdef.<argn1>.type>-><serv.map(<src.targp.x>,<src.targp.y>).statics.<local.x>.color>]
        src.sysmessage Terrain=<serv.map(<src.targp.x>,<src.targp.y>).terrain>, Z=<serv.map(<src.targp.x>,<src.targp.y>).terrain.z>, TYPE=<serv.map(<src.targp.x>,<src.targp.y>).type>
    endif
endfor
remove
return 1

on=@TargOn_Item
src.act=<argo.uid>
src.info
src.last
remove
return 1

on=@TargOn_Char
src.act=<argo.uid>
src.info
src.last
remove
return 1

on=@TargOn_Cancel
remove
return 1



RE: Enhanced .info for statics and map - amonvangrell - 05-07-2014 11:11 AM

thanks!