Nobuild()
set category = "Icon Commands"
switch(alert("Would you like to turn nobuild on or off?","Nobuild Options","ON","OFF","Cancel"))
if("ON")
for(var/obj/O in world)
if(O:owner=="[src.key]")
O:nobuild="ON"
return
if("OFF")
for(var/obj/O in world)
if(O:owner==src.key)
O.nobuild="OFF"
return
Problem description:
Why isn't this doing squat? I've double checked and something that was coded similar works fine.
I checked to see if it was alert's problem, and still nothing. Am I doing something wrong and I am just having brain farts, or is this correct and something is wrong with DM?
Next, you should probably be double-checking that O.owner is being set as expected when the object is created, putting in some debugging output would probably help you a whole lot.
Lastly, looping over every object in the world like this probably isn't a great idea, you should probably be tracking the objects created by specific users in a list of some kind. There's also a hidden benefit to this, saving a list of object references to a savefile magically saves those objects and will load them when the list is loaded again. Of course you'd have to track location your own way since x, y, and z aren't automatically saved for you.
Something like
The reason I have both a reference to the owner itself and the owner's key as variables is because you don't want the owner getting saved with the objects, this can cause many, many headaches, but you want to be able to re-establish that reference after loading the object so you save the key and go from there after the object is loaded.
Now when you want to access all of the objects a person has created, just loop over their 'mystuff' list, a whole lot more resource friendly than a global lookup.
I'll let you figure things out from here, if you need more to go on just lemme know; this is just a solid starting point.