How would I go about creating a list of objects that, say are not of type exampleType and don't have the name of ""? I tried several things that weren't, and aren't successful.
--Vito
ID:270433
![]() May 5 2006, 9:44 am
|
|
Umm, not so quick. I came up with:
var I don't know why or how, but there's an infinite loop in one of those 3. Where? I can't find it. Is it a really stoopid mistake or oversight? A somewhat related question: Does that run through every obj, mob, or turf type in the world, or does it run through every one coded? --Vito |
That little bit of code will run through every single obj mob and turf in your world, the problem with the infinite loop you are having is probably with the turfs because there are usually so many of them.
|
Ah, will it now? I thought it would only run through a list of possible type paths... Is there a way to do that?
--Vito |
Ohh, that's what you were after? Sorry for the misunderstanding, this may be more up your alley.
var Okay, I ran into a bit of trouble checking the names, thankfully I found a proc courtesy of Loduwijk that helped. Dont forget to run setup_initial_variables() in world/New(). You'll also want to make sure to remove any other paths you dont want people to be able to create, as I did with /mob/, /obj/ and /turf/. |
Ah... Well, I guess I didn't say what I wanted properly, and I misunderstood what leaving the in world out of the for loop would do. Thanks.
--Vito |
One final question... What is this about the array initial_variables? What should it be initialized as? How long? You did not define it, and I don't know how long to make it.
--Vito |
That part of the code was right out of an old post by Loduwijk, and the proc setup_initial_variables() should take care of initial_variables for you. Just run the proc in world/New().
-Edit- To explain a little further what the array is for, variables can't just be read from a typepath without an instance of the path being created. With objs and mobs that's not a problem, we could just make a mock of each one, check its name, then delete it, but when it comes to turfs, it's a bit more complicated. initial_variables will store each typepath, and its variables to a list, that can be accessed with the other proc, initial_from_type(type,var). |
initail_variables was read as undefined. I put a call to setup_initial_variables() in world/New(). You need initial_variables defined, with a predefined length, to make all that work, as far as I can tell.
I get runtime errors yelling about "bad index" at world start, and about 50 more when the proc that this is all used in is called. What did I do wrong here? setup_initial_variables() remains unchanged. The only thing I did was defining initail_variables. It doesn't work defined as a list or as an array of unspecified length. --Vito |
That would loop through all objects, and exclude anything of type /obj/Example, or with the name "Example" from the list. Hope that's what you're looking for.