ID:149666
 
I am haveing trouble makeing a world proc call only one type of its contents but all of that type. like how would i make a world proc call the obj/plopsy/proc for all objects of type obj/plopsy
You are looking for well.. for()

I'm not quite sure about how to call a proc that an obj has though, but ill try.
for(var/obj/plopsy/P in world)
P.my_proc()


Not sure if that will work though. I usally just call user verbs, I don't put procs in objects, really.

-Rcet
jobe wrote:
I am haveing trouble makeing a world proc call only one type of its contents but all of that type. like how would i make a world proc call the obj/plopsy/proc for all objects of type obj/plopsy
for(var/obj/plopsy/P in world)
P.plopsy()

That is, if I understand correctly the name of your proc.
I believe Nadrew's oworld proc was commended for it's efficiency, so I'll model off that.

proc/plopsy_search()
var/list/List = list()
for(var/obj/O in world)
if(!O.istype(/obj/plopsy))
List += O
return List


In fact, you could make an argument and tell it search for any specific type.

proc/type_search(type)
var/list/List = list()
for(var/obj/O in world)
if(!O.istype(type))
List += O
return List


Then just use it like so:
   type_search(/mob/player) << "Woohoo!"
In response to Foomer
You make everything so long and complicated, you know that? :]

-Rcet
In response to Skysaw
oh the proc name is obj/ploopsy/proc/ploff
In response to Rcet
Yeah, but it's so much more warm and efficient looking, I'd be proud to have it as part of my code! :oP

Besides, knowing jobe, it's probably safer.
In response to Foomer
what do you mean by that???
In response to jobe
jobe wrote:
oh the proc name is obj/ploopsy/proc/ploff
Then that would make it:
for(var/obj/plopsy/P in world)
P.ploff()


... that's the best way I know to make all your plopsies ploff.
In response to jobe
Weren't you the one with the 500x500x200 world?
In response to Skysaw
Skysaw wrote:
... that's the best way I know to make all your plopsies ploff.

you guys are unusually funny tonight... whats up with that. Or maybe I am finally thinking your jokes are funny, either way I have been laughing.
In response to Rcet
The application of this code supremely flys over my head. I dont get why you would want to know that in a game? Im just to darn ignorant!
In response to Canar
Canar wrote:
you guys are unusually funny tonight... whats up with that. Or maybe I am finally thinking your jokes are funny, either way I have been laughing.

Yup. Some nights we're like that.
In response to Foomer
yeah but ill only havr about a thousand object useing this.