G
Guayuu
Guest
I'm not really sure if this is the most efficient way to check with every value of a Ds_list, if its value repeats in another Ds_list, but its just the way i came with (which isnt managing to work anyways), so i came here for some help to do some changes....
I have two objects, which IDs are in the b and c variables of a third object.
the third object which is supposed to check if the b and c objects are collitioning with this third object (itself)
To this point the code works right perfectly.
If there is collision, then this third object checks a DS_LIST called ancestry in object b and c (both ds_lists have only 6 positions, yes from 0 to 5), and checks with every value in b.ancestry if it repeats at least once in some position of c.ancestry, if it does repeat and isnt = "nothing", it sums +1 to the f variable.
So if the f variable equals 0, the code is supposed to create an instance. (Everything worked fine until i implemented the ds_lists checking thing, so im stuck in that)
i decided that when a value of the DS_LIST isnt a real number, in some code from the b or c it changes the value to the string "nothing", this isnt part of the problem, but i just tell you for the sake of explaining it all.
this is the code (in the Begin_step) that isnt working, it just does create the instance even if there is some value repeating in b.ancestry to c.ancestry:
Thank you guys....
I have two objects, which IDs are in the b and c variables of a third object.
the third object which is supposed to check if the b and c objects are collitioning with this third object (itself)
To this point the code works right perfectly.
If there is collision, then this third object checks a DS_LIST called ancestry in object b and c (both ds_lists have only 6 positions, yes from 0 to 5), and checks with every value in b.ancestry if it repeats at least once in some position of c.ancestry, if it does repeat and isnt = "nothing", it sums +1 to the f variable.
So if the f variable equals 0, the code is supposed to create an instance. (Everything worked fine until i implemented the ds_lists checking thing, so im stuck in that)
i decided that when a value of the DS_LIST isnt a real number, in some code from the b or c it changes the value to the string "nothing", this isnt part of the problem, but i just tell you for the sake of explaining it all.
this is the code (in the Begin_step) that isnt working, it just does create the instance even if there is some value repeating in b.ancestry to c.ancestry:
Code:
f=0
var d;
for (d = 0; d < 6; d += 1)
{
var e;
for (e = 0; e < 6; e += 1 )
{ if ds_list_find_value(b.ancestry,e) = ds_list_find_value(c.ancestry,d)
{ if ds_list_find_value(b.ancestry,e) != "nothing"
{ f += 1}
}
}
}
if f=0 {instance_create_depth(x,y,0,o_fourthobject) }
Last edited by a moderator: