/mob
Move()
for(var/icon/I in usr.underlays)
usr.underlays -= I
Problem description:
Shouldn't this be getting rid of all the underlays?
I want it to delete all underlays every time i move(Don't ask why)
ID:142264
![]() Jul 8 2008, 3:02 pm
|
|
Code:
/mob Problem description: Shouldn't this be getting rid of all the underlays? I want it to delete all underlays every time i move(Don't ask why) |
![]() Jul 8 2008, 3:06 pm
|
|
When you add something to the overlays var, it is converted to the /image type. It should work if you change icon to image.
|
No usr in proc.
Also a clean way of doing that would be: mob/Move() |
It doesn't turn to /image, it turns to a totally different, special object.
Just nulling underlays should work. 'usr' should NEVER be used in mob/Move(). Why are you deleting the underlays everytime someone moves? Sounds very needless to me. |
Because i have my own reasons...
And what is this special object? Is there a way to remove that specific object from underlays? |
Lcooper wrote:
And what is this special object? Read The Reference. Basically, it's a special type of object that is not meant to be interacted with, and little interaction is possible to do with it, anyway. Is there a way to remove that specific object from underlays? Duh. Again, Read The Reference. Removing the same thing you've added to the overlays/underlays list with the usual Remove() or -= works, just don't try to access the items by looping through them. underlays.Cut() and the [probably better] underlays = null also work, the latter unusual, but it works for the built-in, special lists. |
I dont want to null the whole thing...I meant something specific..
Like.... src.underlays.Remove(raft) |
Lcooper wrote:
I dont want to null the whole thing...I meant something specific.. Like my post said, you can use the -= operator or Remove() with the overlays/underlays vars. Please look all of those up (click the links, I made it more convenient) - which should always be done for anything you use in DM when you first use it, or you unsure how it should be used. Like.... src.underlays.Remove(raft) That will work, considering "raft" is replaced by an appropriate element that is already in underlays. Bear in mind underlays/overlays is a special list (again, I urge you to look it up) and items of multiple types can be added to it - object paths, icon objects, image objects, and atom objects. In order to remove something previously added to that list, you need to use the same thing you've used to add it. Eg: if you added an atom object, you must use an atom object in Remove() - I don't think you can add an atom and later attempt to remove it by removing a type path, for example. If you are still having trouble, then show us the relevant code, and we'll try to identify the problem and tell you how to fix it. =) |