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
56
S
21
G
3
Posts: 602
Reputation: 6,612

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
53
S
27
G
114
Posts: 1,695
Reputation: 64,438

Post » Fri Mar 11, 2016 7:26 pm

Thanks :)
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

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
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests