SphereCommunity
forinstances but for types - Printable Version

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



forinstances but for types - Art - 12-15-2012 10:07 PM

Greetings.

Code:
forinstances i_platemail_chest
...
endfor

But i should to check each item on server for type. How i can do it without 'foritems 9999' ?


RE: forinstances but for types - Shaklaban - 12-16-2012 12:20 AM

there is no internal thing like foritemtypes so most simple solution is running forinstances for all items which has that type, or looping all items with forchars, foritems etc.

another option is you can create little program which read sphere save files and record items uid which has that type to the mysql, after that you can use that data and loop through uids. but this method only work for background changes.


RE: forinstances but for types - Mordaunt - 12-16-2012 02:59 AM

Code:
FORINSTANCES i_platemail_chest
  if (<type>==t_whatever)
    do function...
  endif
endfor



RE: forinstances but for types - Art - 12-16-2012 03:49 AM

I should check not only iron platemail chest, but others too.

foritems 9999 checks only items on ground. Maybe i can check, if it's container, then use forcont?

Code:
foritems 9999
if <type> == t_container
     forcont <uid>
     ...
     endfor
endfor

Is it safe?

...

oh yes, also i should check bankbox on characters, and vendor box.. uh.


RE: forinstances but for types - Mordaunt - 12-16-2012 03:53 AM

At best it's going to lag your server, at worse it could hang it.

Are you live?


RE: forinstances but for types - Art - 12-27-2012 06:16 PM

Well i just put needed function to ON=@ItemEquip to change properties of items.