mob/verb/ContentCopy(obj/o in world,obj/c in world)
c.contents += o.contents
The contents from o.contents dissappear when I try setting c.contents to o.contents.
What I am trying to do it towhere I can have o.contents copied and sent over c.contents, But I cannot think of a way how. Anyone have an solutions as to how I can fix this?
ID:174031
Oct 10 2003, 9:43 am
|
|
In response to Malver
|
|
It still seems to repeat the same problem, Takeing the contents away from o.
mob/var/list/Copy= list() mob/verb/CopyTest(obj/o in world) if(istype(o,/obj/Folder)) var/obj/Folder/s = new/obj/Folder s.icon= o.icon s.name= o.name s.stat= o.stat s.contents += o.contents.Copy() usr.Copy +=s return() I am going to go look up Copy(), Never heard of its use before, Maybe I can just copy the entire object instead of going by the method I am now. *Edit* I can't seem to find any information on the Copy() proc that will help copy the entire object, I am still getting the repeadiate problem on losing o's contents. Anyone know of a method that will go along better then how im doing now? |
In response to Texter
|
|
Make a var and set it to s and then use it to do the contents then it wont matter if the contents get removed cause its not the real s just delete it at the end of the function.
|
In response to Texter
|
|
Texter wrote:
<s>mob/var/list/Copy= list()</s> //What's this for?! Get rid of it. =) Edited parts in bold. |
In response to Crispy
|
|
mob/var/list/Copy= list() is there so the user can pastes the objects stored in there to an objects contents of his choice. By doing
mob/verb/Paste(obj/O in world,obj/C in usr.Copy) O.contents+= C |
In response to Malver
|
|
Malver wrote:
The reason this is happening is because the contents are being moved, not copied. Try the following: mob/verb/ContentsCopy(obj/O in world, obj/C in world) This won't work because list.Copy() is not a deep copy; it only copies references, not the objects themselves. So by adding the copied references to C.contents, the items still move. I'd try a different tactic. atom Lummox JR |
In response to Lummox JR
|
|
untime error: Cannot write to atom.verbs.
proc name: Copy (/atom/proc/Copy) usr: Texter (/mob) src: the gfddfgf (/obj/Sheet) call stack: the gfddfgf (/obj/Sheet): Copy(the gfddfgf (/obj/Sheet)) Texter (/mob): Paste(Folder (/obj/Folder), the gfddfgf (/obj/Sheet)) I get this runtime error when I do this, And everything seems to work somewhat, Though I cannot paste the same object twice inside of the contents, I also have noticed when I copy an object it will sometimes disappear completly. Example: Lets say I go through an objects contents and Copy one of its objects *via Copy verb*, Now when I try to paste the new object, It disappaers completly from the contents from whence it was originly leaving the pasted item at it's destination. mob/var/list/Copy= list() mob/verb/CopyTest(obj/o in world) usr.Copy +=o mob/verb/Paste(obj/o in world,obj/C in usr.Copy) for(var/obj/item in usr.Copy) item.Copy(C) o.contents += item |
In response to Texter
|
|
Texter wrote:
runtime error: Cannot write to atom.verbs. There are certain vars which can't be written to; type and verbs to name but two. You might also want to exclude contents and vars. |
In response to Texter
|
|
Okay, it seems I overlooked a couple of issues. Let's try changing that Copy() code.
atom obj/stone Lummox JR |
The reason this is happening is because the contents are being moved, not copied. Try the following: