SphereCommunity
Listing items - Printable Version

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



Listing items - JohnVeritas - 05-21-2014 09:31 PM

Hello guys, I want to list items with a proper command but I want the listed items placed by their amout. For instace; I have a lot of potions, when I use the command .listpotions, I want to see, which potions I have and how many of them. And if I have 20 heal 19 cure and 21 refresh, in the list refresh potion must be the first place, also I dont want to see the potion names that I dont have in my backpack.

(p.s Sorry about my bad english. )


RE: Listing items - Alaric - 05-21-2014 10:49 PM

Do you have stackable potions or separate?

for stackable:
1. use a function with forconttype t_potion - store potion uids separated by comma in one local.string. Send the whole string to second function that will sort it.nope

2. MySQL

3. usin a list- basically the same as the long string in the first case.


RE: Listing items - JohnVeritas - 05-21-2014 11:29 PM

My potions are stackable but dont stand upon it, it's just a sample, it could be ores too. Anyways I see, I can get values of my potions with checking forconttype t_potion but I can't understand how to store uids, can u show a example ?


RE: Listing items - Coruja - 05-22-2014 12:20 AM

you must use RESCOUNT

Code:
[FUNCTION listpotions]
IF (<RESCOUNT i_potion_mana>)
  SYSMESSAGE Mana Potion: <RESCOUNT i_potion_mana>
ENDIF
IF (<RESCOUNT i_potion_heal>)
  SYSMESSAGE Heal Potion: <RESCOUNT i_potion_heal>
ENDIF
...



RE: Listing items - JohnVeritas - 05-22-2014 12:33 AM

Well I'm already done a list script but it just too simple. Check it;

Code:
[function pots]
dialog d_potions
return 1

[dialog d_potions]
5,5
page 0
resizepic 0 0 5120 270 270
resizepic 5 5 3000 260 260
dhtmlgump 90 20 150 20 0 0 Potion Counter

tilepic 13 70 <eval 3852>
gumppic 55 70 2443
dhtmlgump 82 72 150 20 0 0 <def.bfont_yellow><eval <rescount i_potion_heal>>
dhtmlgump 35 50 150 20 0 0 heal

tilepic 15 110 <eval 3847>
gumppic 55 110 2443
dhtmlgump 82 112 150 20 0 0 <def.bfont_yellow><eval <rescount i_potion_cure>>
dhtmlgump 35 90 150 20 0 0 cure

tilepic 11 150 <eval 3851>
gumppic 55 150 2443
dhtmlgump 82 152 150 20 0 0 <def.bfont_yellow><eval <rescount i_potion_refresh>>  
dhtmlgump 35 130 150 20 0 0 refresh

tilepic 26 190 <eval 3848>
gumppic 55 190 2443
dhtmlgump 82 192 150 20 0 0 <def.bfont_yellow><eval <rescount i_potion_agility>>
dhtmlgump 35 170 150 20 0 0 agility

tilepic 133 70 <eval 3852>
gumppic 170 70 2443
dhtmlgump 197 72 150 20 0 0 <def.bfont_yellow><eval <rescount i_potion_healgreat>>
dhtmlgump 153 50 150 20 0 0 g.heal

tilepic 135 110 <eval 3847>
gumppic 170 110 2443
dhtmlgump 197 112 150 20 0 0 <def.bfont_yellow><eval <rescount i_potion_curegreat>>
dhtmlgump 153 90 150 20 0 0 g.cure

tilepic 131 150 <eval 3851>
gumppic 170 150 2443
dhtmlgump 197 152 150 20 0 0 <def.bfont_yellow><eval <rescount i_potion_refreshtotal>>
dhtmlgump 153 130 150 20 0 0 t.refresh

tilepic 146 190 <eval 3846>
gumppic 170 190 2443
dhtmlgump 197 192 150 20 0 0 <def.bfont_yellow><eval <rescount i_potion_nightsight>>
dhtmlgump 153 170 150 20 0 0 nightsight

[DIALOG d_potions text]

But... I want that list count potions and list them "much to less" by their amount.


RE: Listing items - Alaric - 05-22-2014 12:57 AM

Its bad with thos uids, ignore it. You have to really use the rescount. (Didn't know sphere has this function Smile)
I don't know about an easy way to do this, damn... Everything is too heavy.