SphereCommunity
ForAllItems - Printable Version

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



ForAllItems - Llirik - 01-12-2016 04:24 PM

What command for search all items in the scripts:

[FUNCTION all_items]
db.execute TRUNCATE items
foritems 100000
if <isarmor> || <isweapon>
db.execute INSERT INTO `items`(`name`, `RESOURCES`, `SKILLMAKE`) VALUES ("<name>","<RESOURCES>","<SKILLMAKE>")
endif
endfor

But this command search items in the world only! Sad


RE: ForAllItems - Llirik - 01-12-2016 05:58 PM

How many items in the Sphere 56b?

[itemdef i_all_items]
ID=i_deed

ON=@DClick
for 10000 // How many?
src.newitem <LOCAL._for>
if <src.act.isarmor> || <src.act.isweapon>
serv.newitem <LOCAL._for>
new.p=<p>
endif
endfor


RE: ForAllItems - Artyk - 01-12-2016 10:28 PM

Code:
27-10-2013, Ben
- Added: new Section to Sphere.ini [RESOURCELIST] with a list of resource blocks to be loaded into DEFLISTs
         Ex: Adding ITEMDEF in the RESOURCELIST will create a DEFLIST.ITEMDEF with all itemdefs loaded by the server.

For the use of lists -> lists

You can take a look at sphere_add_sqlite.scp, it could be useful


RE: ForAllItems - Llirik - 01-13-2016 02:49 PM

Thank you! But I have troubles with skills on chars. Sad

[FUNCTION f_chars]
for 0 <eval <serv.deflist.chardef.count>-1>
local.char=<serv.deflist.chardef.<dlocal._for>>
if (<local.char>)
local.name=<serv.chardef.<local.char>.name>
local.taming=<serv.chardef.<local.char>.taming> // Can't resolve <serv.chardef.C_BIRD_JUNGLE.taming>
db.execute INSERT INTO sphere_items_chars VALUES ("<local.name>","<local.taming>")
endif
endfor

MySQL create "0". Help me please!


RE: ForAllItems - Llirik - 01-13-2016 04:12 PM

On Blank SphereWorld:

[FUNCTION ff_chars]
for 0 <eval <serv.deflist.chardef.count>-1>
local.char=<serv.deflist.chardef.<dlocal._for>>
if (<local.char>)
local.defname=<serv.chardef.<local.char>.defname>
serv.newnpc <local.defname>
new.p 5140,1773
endif
endfor

[FUNCTION fff_chars]
forchars 6144
if <taming>
db.execute INSERT INTO sphere_items_chars VALUES ("<name>","<taming>","0")
endif
endfor


RE: ForAllItems - Artyk - 01-13-2016 11:22 PM

Code:
-Added: Category, Subsection, and Description to ITEMDEF and CHARDEF (now the server can read them if directly in the DEF section and not under @create)

I think those are the only fields you have in the deflist (other than defname and name)


RE: ForAllItems - rastrero - 01-14-2016 02:18 AM

I think its better if u use python or java to do this task.


RE: ForAllItems - Kanibal - 01-14-2016 02:35 AM

(01-14-2016 02:18 AM)rastrero Wrote:  I think its better if u use python or java to do this task.

Or Perl
Code:
cat "Find all sphere items..." | perl -e '$??s:;s:s;;$?::s;;=]=>%-{<-|}<&|`{;;y; -/:-@[-`{-};`-{/" -;;s;;$_;see'