How do I check and delete repeated values in a 1d array

Get help using Construct 2

Post » Thu Mar 10, 2016 5:12 am

I have an array just to hold temporary values, but I need remove values that are repeated between x elements.

Thanks!
B
59
S
21
G
3
Posts: 604
Reputation: 6,691

Post » Thu Mar 10, 2016 6:15 am

Conditions
Array - For Each Element

SubEvent Conditions
System - While
System - Compare two values - IndexOf(Array.At.CurX) != LastIndexOf(Array.At.CurX)

Action
Array - Delete LastIndexOf(Self.At.CurX)

Edit: Changed Self/Array in the expression, since you can't use self in a system condition, formatting, sub event for two the two loops. Yikes made a lot of mistakes actually, glad you understood ;)
Last edited by oosyrag on Sat Mar 12, 2016 1:17 am, edited 3 times in total.
Mistakes were made.
B
60
S
30
G
132
Posts: 1,932
Reputation: 74,341

Post » Fri Mar 11, 2016 7:26 pm

Thanks :)
B
59
S
21
G
3
Posts: 604
Reputation: 6,691

Post » Fri Mar 11, 2016 9:22 pm

Can use a Library to avoid duplicates. If you dont need to acces the data by index.
B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450


Return to How do I....?

Who is online

Users browsing this forum: Asmodean, Elliott, fbarraza28, JoniArtha and 2 guests