ID:166289
 
I have 2 stat panels, one is for monsters you own, one is for items you have, when you get a monster it goes into your contents. All the monsters are mobs of course. The probelm is right now both stat panels just look into your contents, I need the monster stat panel to only show the monsters you have with their stats, and the item panel to just show the items you have. Right now both stat panels show monsters and items. How do I do fix this?
FriesOfDoom wrote:
I have 2 stat panels, one is for monsters you own, one is for items you have, when you get a monster it goes into your contents. All the monsters are mobs of course. The probelm is right now both stat panels just look into your contents, I need the monster stat panel to only show the monsters you have with their stats, and the item panel to just show the items you have. Right now both stat panels show monsters and items. How do I do fix this?

Make two lists,inventory and monster.
Use two seperate lists to store them, and show the lists in the stat panels.
In response to FananaQ
i am horrible with lists, I have no idea how to use them, could you explain them to me?(code example of something else would be nice, I wanna figure mine out :P)
In response to Echtolion
If he uses two lists, then he will lose all "set src in usr" verbs unless he store the objects in both the contents and the list. The easy solution? Do a for() loop for the specific type and stat those under each tab. Also, make sure you're doing "if(statpanel(name))" to save CPU.
In response to DarkCampainger
DarkCampainger wrote:
Do a for() loop for the specific type and stat those under each tab. Also, make sure you're doing "if(statpanel(name))" to save CPU.

huh?
In response to FriesOfDoom
If you don't know what a for() loop is, you'll want to look it up. If I'm just typing barely understandable sentences, this is what I meant:

mob
Stat()
if(statpanel("Monsters")) //Use an if so the following doesn't run unless it needs to.
for(var/mob/Monster/M in src.contents) //Loop through all of the monsters in the players contents
stat(M)
if(statpanel("Items"))
for(var/obj/Item/I in src.contents) //can also be "in src" or "in contents". They're considered the same here.
stat(I)


Like that. You'll have to change a few things so it works in your game, but that's the basic concept.
In response to DarkCampainger
DarkCampainger wrote:
If you don't know what a for() loop is, you'll want to look it up. If I'm just typing barely understandable sentences, this is what I meant:

> mob
> Stat()
> if(statpanel("Monsters")) //Use an if so the following doesn't run unless it needs to.
> for(var/mob/Monster/M in src.contents) //Loop through all of the monsters in the players contents
> stat(M)
> if(statpanel("Items"))
> for(var/obj/Item/I in src.contents) //can also be "in src" or "in contents". They're considered the same here.
> stat(I)
>

Like that. You'll have to change a few things so it works in your game, but that's the basic concept.


thank you very much that make awhole lot more since^_^
In response to FriesOfDoom
ok i did that but now, when you pick up the item to catch the monster, theres 2 of the items in the item panel and 1 in the monster panel, and when you catch the monster, theres 2 of the monster in the monster panel and 1 of the monster in the items panel 0_0


*Edit*
Never mind i fixed it