Mr Giff
Member
Hi guys! I've been a long time Gamemaker user (since gm6) but have only recently joined the new forums here. So thank you in advance to anyone who's willing to help me out!
Introductions aside, I've been having an issue that's been bugging me for a week.
First, here's a little pretext on what I am trying to do:
My game has a spreadsheet like system that allows you to move auto populated cell objects around in the room and snap them to a grid. The variables and contents that these objects contain are given to them by a control object upon creation. This control object retrieves their text from a column in a CSV file.
My problem is, is that in the CSV there are more than one of the same cell content. So say there is 50 Apples, 3 Oranges, and 20 Bananas. I want to have three cells say Apples, Oranges and Bananas. However no matter how I try to get rid of duplicate strings I'll still get results that say "Apples, Apples Apples."
I've tried flat out comparison such as:
Code: if global.cellcategory1 == ds_grid_get("CSV",11,nx_cell);
nx_cell as a variable that moves to the next row.
As well as comparing two variables:
Code: if global.cellcategory1 == global.cellcategory2 etc.
I've also tried using string_pos and switch cases but I get same result.
All of my attempts have been in the step event.
If anyone can help me out that would be amazing!
(I've also provided a snapshot of my latest attempt in code)
Cheers.
Introductions aside, I've been having an issue that's been bugging me for a week.
First, here's a little pretext on what I am trying to do:
My game has a spreadsheet like system that allows you to move auto populated cell objects around in the room and snap them to a grid. The variables and contents that these objects contain are given to them by a control object upon creation. This control object retrieves their text from a column in a CSV file.
My problem is, is that in the CSV there are more than one of the same cell content. So say there is 50 Apples, 3 Oranges, and 20 Bananas. I want to have three cells say Apples, Oranges and Bananas. However no matter how I try to get rid of duplicate strings I'll still get results that say "Apples, Apples Apples."
I've tried flat out comparison such as:
Code: if global.cellcategory1 == ds_grid_get("CSV",11,nx_cell);
nx_cell as a variable that moves to the next row.
As well as comparing two variables:
Code: if global.cellcategory1 == global.cellcategory2 etc.
I've also tried using string_pos and switch cases but I get same result.
All of my attempts have been in the step event.
If anyone can help me out that would be amazing!
(I've also provided a snapshot of my latest attempt in code)
Cheers.
Attachments
-
151.6 KB Views: 16
Last edited: