Code:
Problem description:
What i need is an algorithm to select an area based on two points ( Ex.. Northeast, southwest corner, of a box) and make a copy of every atom inside those two points, then place the copies elsewhere on the map.
Example, if i selected a plot of land with a structure on my map, and copied it, i would then be able to paste an exact copy of that house, somewhere of my choosing on the map.
The problem i face is that i cannot think up a way to execute this, would anybody be willing to make a sample, or show me how to write code that would be able to perform such commands?
Thank you for your time.
Hey, how are u?
So I think u want something like this: mob/Player/var/tmp/list/Copied = list() Now lets discuss the code that I wrote: the first question that u may come up with is "Why the heck did he wrote a for loop that only goes through objects (in the copy proc)?" Well, you can change that if u want but i strongly advise u to be careful. Because if you paste turfs on top of turfs then the older turf will be deleted. Also copying mobs won't bring any good (specially client mobs). So the copy proc will simply store all the objs that are in a radius of X . The position_x and position_y lists will store the distance that the object if from the player. The paste proc will instantiate each object that you copied and will adjust its position (this is when the position_X and position_y lists join the party). So the position of the copied object will correspond to the player position on the x/y axis plus the position_X/Y list value that corresponds to the initial difference between the position of the client and the object being copied. Any questions? Hug, ,Misty |
You know to me it sounds,
That the function you need is bounds() In so many words Use 2 sets of coords And boom, copy everything on those grounds. |
In response to Lugia319
|
|
Nice shortcut but I think his biggest issue is creating a copy of the atoms rather than a reference to pre-existing atoms.
Unfortunately BYOND to my knowledge doesn't come with a built in method for cloning datums. |
In response to Lugia319
|
|
Lugia319 wrote:
You know to me it sounds, Mmm, try "all" instead of "everything". Fits the meter better. |
The var copying is the most advanced part, but you'll want to do something like