ID:263745
 
Why not make a way in which u can use like item A.VarValues = B.VarValues

that would be good if u could do that...
Super Silly Stuart wrote:
Why not make a way in which u can use like item A.VarValues = B.VarValues

that would be good if u could do that...

We have this, actually; it's the vars list.

Lummox JR
In response to Lummox JR
so how would i make object A inherit all properties of item B?
In response to Super Silly Stuart
taken from the help.


vars list var (datum)
See also:
initial proc
issaved proc
list
list associations
This is a list of all the variables belonging to an object. The items in the list are the variable names. If the variable name is used as an index into the list, the value of that variable is accessed.

Example:
mob/verb/dump()
var/V
for(V in vars)
usr << "[V] = [vars[V]]"

This example displays all the variables belonging to your mob.

In response to Fusioneko
NOT VIEWING, making object A have all its vars = to object B

which is why this was under byond features before...
In response to Super Silly Stuart
This is so when i edit object A's vars via an edit verb, i can clone all the item's variables over to the new object i created at an earlier time.
In response to Super Silly Stuart
Super Silly Stuart wrote:
This is so when i edit object A's vars via an edit verb, i can clone all the item's variables over to the new object i created at an earlier time.
mob/verb/dump()
var/V
for(V in vars)
usr << "[V] = [vars[V]]"

IF YOU KNEW how to work in DM In the first place, You'd understand.

You have to dump all the object variables into a list, that objects vars are then put into the inherited object as such. It's not that hard, Do you WANT ME TO WRITE AN EXAMPLE? Why can't you figure it out yourself. ITS SIMPLE.
In response to Fusioneko
DUDE, that tells u the vars of both, thats not doing crap...

u did use the USR << command which makes it show in the text.....

and if u took usr out if u deleted the first object, the second object would also get deleted....
In response to Super Silly Stuart
Super Silly Stuart wrote:
DUDE, that tells u the vars of both, thats not doing crap...

u did use the USR << command which makes it show in the text.....

and if u took usr out if u deleted the first object, the second object would also get deleted....

That was an example, Let me write it for you.
In response to Super Silly Stuart
well, just if i knew how to do it, i would do it, so of course i need it done for me.... lolz
In response to Super Silly Stuart
Super Silly Stuart wrote:
well, just if i knew how to do it, i would do it, so of course i need it done for me.... lolz
obj
var
rt1 = null
rt2 = null
rt3 = null
rt4 = null
rt5 = null
MultiplyingRock
verb
Multiply()
set category = "Actions"
set src in oview(1)
usr <<"OH MA GOSH IT MULTIPLIED!!"
var/obj/XZ = new/obj/MultiplyingRock
//var/P = new /obj/MultiplyingRock
XZ.loc = src.loc
var/obj/O
var/V = O
for(V in vars)
V = "[vars[V]]"

SetVar()
set category = "Actions"
set src in oview(1)
//var/obj/O
src.rt1 = rand(100,120)
src.rt2 = rand(60,80)
src.rt3 = rand(40,60)
src.rt4 = rand(20,40)
src.rt5 = rand(1,20)
ShowVars()
set category = "Actions"
set src in oview(1)
var/obj/O
var/V = O
for(V in vars)
usr <<"[V] = [vars[V]]"


WELL I actually don't know how to fully do it, If you know about objects and how to set their variables onto them try setting ti and using this to modify requires a bit tweaking, Most of my projects have been fully text based, So I merely just can't get you the best result yet.
In response to Fusioneko
i used this, and got it to do some var settings, but i had to create a base including all the variables i wanted changed, the code wasnt able to look through the list i made it make, to do duplication of the vars
In response to Lummox JR
In response to Fusioneko
Fusioneko wrote:
Super Silly Stuart wrote:
This is so when i edit object A's vars via an edit verb, i can clone all the item's variables over to the new object i created at an earlier time.
> mob/verb/dump()
> var/V
> for(V in vars)
> usr << "[V] = [vars[V]]"
>

IF YOU KNEW how to work in DM In the first place, You'd understand.

You have to dump all the object variables into a list, that objects vars are then put into the inherited object as such. It's not that hard, Do you WANT ME TO WRITE AN EXAMPLE? Why can't you figure it out yourself. ITS SIMPLE.

I dont even understand this stuff... Could you post an example? Because I need it to complete this Geti Star code for Empire, so the metas created inherit all variables of the original mob.
In response to Dragonn
mob/GetiClones/proc/Inherit(mob/M)//mob/M would be the mob the geti clones get their variable values from
for(var/V in M.vars)//loop through M's variable list
if(V in src.vars)//check if the variable exists
src.vars[V]=M.vars[V]//the value of that variable is set to the value of M's variable

Hope that helps.