SphereCommunity
storing / filtering massive items - Printable Version

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

Pages: 1 2 3 4


RE: storing / filtering massive items - kn4tseb - 07-12-2014 06:10 AM

yes skul but i want to get exactly the .<xx>.
this is what i'd like to get

serv.log <serv.itemdef.<*rose*>.defname> so i would get all items with the word rose at itemdef.

dunno if possible

strmatch wont work since the string wont be completed because i dont have a way to refer a non specific itemdef
is it possible to add a variable for this? as a new request??? because it would be very usefull not only for itemdefs, it would be usefull for chardefs, defnames, maybe regions... and whatever the programmer wanted, as many of them dont have a specific way to make the reference for.

am i losing my mind?

regards Smile


RE: storing / filtering massive items - Skul - 07-12-2014 06:46 AM

better off using the file.object, open up your .scp file and use file.readline, example:
Code:
if (<file.open <path to colored armor.scp>>)
  for line 1 <file.readline end>
    if (strmatch([itemdef *,<file.readline <local.line>>))
      local.x += 1
      local.obj<dlocal.x>=<strsub 10 <eval <eval strlen(<file.readline <local.line>>)> +-11> <file.readline <local.line>>
    endif
  endfor
endif
file.close
if (<local.x>)
  for x 1 <local.x>
    serv.log <local.obj<dlocal.x>>
  endfor
endif



RE: storing / filtering massive items - Extreme - 07-12-2014 07:07 AM

Strmatch(*rose*,<serv.itemdef.<hval <local.x>>.defname>)
Assuming you're using the for loops


RE: storing / filtering massive items - kn4tseb - 07-12-2014 07:27 AM

(07-12-2014 07:07 AM)Extreme Wrote:  Strmatch(*rose*,<serv.itemdef.<hval <local.x>>.defname>)
Assuming you're using the for loops

But which values should i use at FOR LOOPS?

those custom items dont have a NUMBERED ID

the ID is the inhereted to another item

(07-12-2014 06:46 AM)Skul Wrote:  better off using the file.object, open up your .scp file and use file.readline, example:
Code:
if (<file.open <path to colored armor.scp>>)
  for line 1 <file.readline end>
    if (strmatch([itemdef *,<file.readline <local.line>>))
      local.x += 1
      local.obj<dlocal.x>=<strsub 10 <eval <eval strlen(<file.readline <local.line>>)> +-11> <file.readline <local.line>>
    endif
  endfor
endif
file.close
if (<local.x>)
  for x 1 <local.x>
    serv.log <local.obj<dlocal.x>>
  endfor
endif

18:41:ERROR:(sphere_system_1.scp,112)Can't resolve <scripts/items/sphere_item_provisions_armor_color.scp>
18:41:ERROR:(sphere_system_1.scp,112)Can't resolve <file.open >
18:41:ERROR:(sphere_system_1.scp,112)Undefined symbol ''
18:41:ERROR:(sphere_system_1.scp,120)Undefined keyword 'file.close'


RE: storing / filtering massive items - Skul - 07-12-2014 07:55 AM

you put <brackets> around the filename, does not require any.

example:
Code:
if (<file.open some_file.txt>) //opens some_file.txt



RE: storing / filtering massive items - kn4tseb - 07-12-2014 08:03 AM

(07-12-2014 07:55 AM)Skul Wrote:  you put <brackets> around the filename, does not require any.

example:
Code:
if (<file.open some_file.txt>) //opens some_file.txt
PHP Code:
if (<file.open scripts/items/sphere_item_provisions_armor_color.scp>)
  for 
line 1 <file.readline end>
    if (
strmatch([itemdef *,<file.readline <local.line>>))
      
local.+= 1
      local
.obj<dlocal.x>=<strsub 10 <eval <eval strlen(<file.readline <local.line>>)> +-11> <file.readline <local.line>>
    endif
  endfor
endif
file.close
if (<local.x>)
  for 
x 1 <local.x>
    
serv.log <local.obj<dlocal.x>>
  endfor
endif 

19:06:ERROR:(sphere_system_1.scp,112)Can't resolve <file.open scripts/items/sphere_item_provisions_armor_color.scp>
19:06:ERROR:(sphere_system_1.scp,112)Undefined symbol ''
19:06:ERROR:(sphere_system_1.scp,120)Undefined keyword 'file.close'

EDIT: OK OF_FileCommands was disabled.


RE: storing / filtering massive items - kn4tseb - 07-12-2014 09:07 AM

if (<file.open scripts/items/sphere_item_provisions_armor_color.scp>)
for line 1 9197 // <file.filelines scripts/items/sphere_item_provisions_armor_color.scp> //<file.readline 0>
if (strmatch([itemdef *rose*,<file.readline <local.line>>))
local.x += 1
local.obj<dlocal.x>=<strsub 10 <eval <eval strlen(<file.readline <local.line>>)> +-11> <file.readline <local.line>>
endif
endfor
endif
file.close
if (<local.x>)
for x 1 <local.x>
serv.log <local.obj<dlocal.x>>
endfor
endif

i got no errors but no logs either, it freezes a bit because of the ~9000 lines read but i got no serv.log Confused
i tried to understand the script but couldnt figure the " local.obj<dlocal.x>=<strsub 10 <eval <eval strlen(<file.readline <local.line>>)> +-11> <file.readline <local.line>>" line
i suppose it should be "local.obj<dlocal.x>=<strsub 10 <eval <eval strlen(<file.readline <local.line>>)> +-1> <file.readline <local.line>>"

ok i got it: local.obj<dlocal.x>=<strsub 9 <eval <eval strlen(<file.readline <local.line>>)> +-10> <file.readline <local.line>>>


RE: storing / filtering massive items - Skul - 07-12-2014 10:49 AM

oh ya, index for strsub starts at 0, good to see you got it resolved.


RE: storing / filtering massive items - kn4tseb - 07-13-2014 10:07 AM

^^
Byw, im trying to recreate my own version of powder of fortifying, does anyone know the hex graphic value of this tile? i have burnt my eyes looking into uo fiddler but i cannot find it, im using a 7.x version of the client so it should be there, anyone please?

EDIT: ohh i think i got it, it must be 01006 with a diff HUE Smile


RE: storing / filtering massive items - kn4tseb - 07-13-2014 04:29 PM

Guys, is the property maxuses enabled? or something similar?
i'd like to add "charges" or "remaining uses" to this custom powder of fortifying.

Thanks again ^^!