ID:263270
 
Code:
obj
jetsu
Sexy_nin_jetsu
name = "woot"
icon = 'kisame.dmi'
icon_state = "boom"

Sexy_nin_jetsu2
name = "woot"
icon = 'kisame.dmi'
icon_state = "boom"

mob
var
attacks

Stat()
statpanel("Attacks")
src.attacks = typesof(/obj/jetsu)
for(var/obj/T in src.attacks)
stat(,T)


Problem description: It doesn't find any of the objects on the list -.- any help

Thanks in advance

That's because the objects aren't in the variable, which you should really typescast under the /list datum. All you have is a bunch of object types, or maybe just the two. The point still stands. Try using "new" to create the objects in the list.

Of course, if you just want to display all of the objects in a list, you can use stat(listname). It'd probably have to be typecasted under /list though.
Dark_samurai wrote:
Code:
> obj
> jetsu
> Sexy_nin_jetsu
> name = "woot"
> icon = 'kisame.dmi'
> icon_state = "boom"
>
> Sexy_nin_jetsu2
> name = "woot"
> icon = 'kisame.dmi'
> icon_state = "boom"
>
> mob
> var
> attacks
>
> Stat()
> statpanel("Attacks")
> src.attacks = typesof(/obj/jetsu)
> for(var/obj/T in src.attacks)
> stat(,T)
>

Problem description: It doesn't find any of the objects on the list -.- any help

Thanks in advance


That doesn't look right... what are you trying to do, set src.attacks to all of the different types of attacks? Or perhaps store different attacks in src.attacks which stat outputs?

If the first one, then you need to make src.attacks into a list, not just a variable e.g
mob
var
list/attacks[0]

Note that (if you didn't know) the zero is the length. I put a zero there just so you can add stuff to the list, but you can make it any length you want.

Then follow that up with this:
mob
var
list/attacks[0]

Stat()
statpanel("Attacks")
for(var/v in typesof(/obj/jetsu)) // It's jUtsu btw
if(!(v in src.attacks) // If it's not here already
src.attacks += v // Not sure if this is what you want, it only puts the TYPE into the list
for(var/T in src.attacks) //I removed /obj because the list won't have any objects in it
stat(,T)


Basically, I set the Stat() proc to take all the different kinds of "jetsu"s and add them to your attacks, then to display each type. I don't think that's what you want at all, but just in case I thought I'd put it here.

If you meant the second thing, then you are going to have a harder time, because as far as I know, you can't actually store objects in anything other than contents, unless there's some way to surpass that with datums. I'm assuming there is cause CaptFalcon mentioned it, so we'll just say *insert demo on how to make custom inventory lists here* and then add that you don't need THIS line:
src.attacks = typesof(/obj/jetsu)

And that you should change var/obj/T to var/obj/jetsu/T.

As a final note, your code is setting src.attacks to '/list' which is not what you want to do, and also explains why you can't find any objects, 'cause none are in it!
In response to CaptFalcon33035
I tried to add new to it and it gave me errors :(

And it adds objects to the attack list it doesnt display them on the Attacks statpanel those. I tried your method Perpetr8er
and it did nothing :(
In response to Dark_samurai
I don't beleive you can use "new" in combination with typesof(), so you'll have to use a variable.

mob/var/list/attacks=list()
//Make this null if you don't plan to have attacks for a while.\
When you need it, you can just convert it to a list.


mob/verb/Whatever()
for(var/O in typesof(/obj/skill/)-/obj/skill) attacks+=new O

mob/Stat()
statpanel("Inventory")
stat(attacks)

That should work. And from there, you can stack of delete multiple copies, or just leave it. Whatever you decide.
Note: It's made how it is so you just can't copy and paste and hope it works. It probably will given that you tab it correctly, but you won't want a verb that gives the user the attacks, would you?