for(var/S in typesof(/obj/items/Magic))
src.item+= S
obj/items
Magic
Bean
Rock
Grass
Problem description: Why is it when I do that it will include "Magic" in the list? Is it supposed to do this? I only wanted to include the items in Magic's string.
ID:145612
Feb 5 2006, 10:04 pm
|
|
Code:
for(var/S in typesof(/obj/items/Magic)) Problem description: Why is it when I do that it will include "Magic" in the list? Is it supposed to do this? I only wanted to include the items in Magic's string. |
Feb 5 2006, 10:48 pm
|
|
try
|
In response to A.T.H.K
|
|
A.T.H.K wrote:
try > for(var/S in typesof(/obj/Magic)) That wouldn't and doesn't make a diffrence because it is essiently doing the same exact thing. |
Texter wrote:
Code: for(var/S in typesof(/obj/items/Magic)) Problem description: Why is it when I do that it will include "Magic" in the list? Is it supposed to do this? I only wanted to include the items in Magic's string. Try adding a "/" to the end of Magic in the first line. |
It's because you're not filtering /obj/Magic from the list. You can try typesof(/obj/Magic/), but it may not work. Your best bet is to use for(var/M in typesof(/obj/Magic/)-/obj/Magic)
|
In response to Artemio
|
|
Artemio wrote:
if(istype(S,/obj/Magic)) continue Uh, no. istype() returns true if it is derived from any of the type's child paths. You would want to compare it to an exact path type. What CaptFalcon wrote is a correct way to do it. ~~> Unknown Person |