sinigrimi
Member
How do I call a random key from a ds_map structure? or will i have to create ds_list? a bunch of variables are created in ds_list, if for example I have 300 keys?
I tried to do something with this, but my head is not working as it should
I tried to do something with this, but my head is not working as it should
Code:
var arts = global.artefacts;
var arts_size = ds_map_size(arts);
var rand = irandom_range(1,arts_size), ar = arts_size;
while ar {
rand++;
if rand > arts_size //if rand becomes larger than ds_map_size it will continue from the beginning of the list
rand = 1;
ar--;//every time 1 is taken away so that the check does not become infinite
}
Last edited: