E
Ekke
Guest
I'm trying to update multiple entries in a ds_map, namely the value for AGE. The age is supposed to be added to a timer so it changes every time the timer fires. There will also be a "add baby" timer that will add more people to the list.
I'm fairly new to GML and programming in general and I hit a wall with this one, I hope someone out there can assist me here so I can continue with my project.
Many thanks in advance
CREATE
Age is supposed to be in weeks currently, will probably change this at a later stage that will make 52 weeks = 1 year 0 weeks.
SCR_PERSONMAP
Script that generates people
CURRENTLY UNDER KEY PRESS
It generates a person with the age of 1, it's supposed to be 0 and then increase the AGE of all the other people +1. It's not supposed to update the age every time a baby is born, this just a test zone.
I'm fairly new to GML and programming in general and I hit a wall with this one, I hope someone out there can assist me here so I can continue with my project.
Many thanks in advance
CREATE
Age is supposed to be in weeks currently, will probably change this at a later stage that will make 52 weeks = 1 year 0 weeks.
GML:
people = ds_list_create();
// Men
scr_personmap("John","Jackson","Man",25*52);
scr_personmap("James","Hill","Man",32*52);
scr_personmap("Eric","Strange","Man",33*52);
// Women
scr_personmap("Lily","Jackson","Woman",27*52);
scr_personmap("Rebecca","Southtwig","Woman",27*52);
scr_personmap("Carin","Hill","Woman",18*52);
Script that generates people
GML:
person = ds_map_create();
ds_map_add(person, "First Name", firstname);
ds_map_add(person, "Surname", surname);
ds_map_add(person, "Gender", gender);
ds_map_add(person, "Age", age);
ds_list_add(people, person);
It generates a person with the age of 1, it's supposed to be 0 and then increase the AGE of all the other people +1. It's not supposed to update the age every time a baby is born, this just a test zone.
GML:
var random_gender = choose(0,1);
if random_gender = 0{gender = "Woman";} else if random_gender = 1{gender = "Man";}
// Add a new person with a random generated name
scr_personmap(string(scr_namegenerator(gender)),string(scr_surnamegenerator()),gender,0);
// Add +1 to AGE to all entries that contain AGE
person[? "Age"] += 1;