SphereCommunity
Refering item from string - Printable Version

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



Refering item from string - Arcer - 10-06-2014 10:55 PM

Hi,
I've a function like this:

Code:
[function f_craft_list]
serv.list.craftList.ADD <args>

[function f_craft_list_show]
say <<serv.list.craftList.0>.NAME>

with the first make a list of items defname like :i_alchemical_dust,i_gold, etc etc

and it's ok, but with the second i found a console error like :
ERROR:(customItems.scp,17)Can't resolve <"i_chemical_dust".NAME>

serv.list.craftList.0 return me i_alchemical_dust, but how can i retrive item object from a string?


thank you


RE: Refering item from string - kn4tseb - 10-07-2014 02:53 AM

perhaps doin this?

<serv.itemdef.<serv.list.craftlist.0>.name>

i dont really understand what you get from the string but if you are returning the item you want exactly as you wrote it with the " " on it, you might need to remove them
<serv.itemdef.<strsub 1 <EVAL STRLEN(<serv.list.craftlist.0>)-2> <serv.list.craftlist.0>>.name>

PD:
cant find the serv.list command, did you softcored it or it actually exists?


RE: Refering item from string - darksun84 - 10-07-2014 04:44 AM

The list command is for implementing list Tongue

http://wiki.sphere.torfo.org/index.php/LIST


RE: Refering item from string - Arcer - 10-07-2014 07:50 AM

(10-06-2014 10:55 PM)Arcer Wrote:  Hi,
I've a function like this:

Code:
[function f_craft_list]
serv.list.craftList.ADD <args>

[function f_craft_list_show]
say <<serv.list.craftList.0>.NAME>

with the first make a list of items defname like :i_alchemical_dust,i_gold, etc etc

and it's ok, but with the second i found a console error like :
ERROR:(customItems.scp,17)Can't resolve <"i_chemical_dust".NAME>

serv.list.craftList.0 return me i_alchemical_dust, but how can i retrive item object from a string?


thank you
GOOOOOOD OK Smile

What I want to make is a container where player put some resourcers (like mineral,logs, reagents) and in the player's backpack appear an item....but how can i test if the resources in the container are enough to make the item?


Refering item from string - Arcer - 10-07-2014 08:57 AM

Restest is my friend! Task accomplished [GRINNING FACE WITH SMILING EYES]


RE: Refering item from string - kn4tseb - 10-07-2014 09:52 AM

good job ^^