Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
Hi,
I want to search value in array.
I have this array and I want find PlayerSkin* (Idk first value have what number) (In my array It is 8)
I need to Result: 2 (Value's array X)
Codes
My Array Data
Capx : https://www.dropbox.com/s/cbyduqoj6cuob ... .capx?dl=0
Develop games in your browser. Powerful, performant & highly capable.
You don't need regex. You can use expressions like left, right, find, mid etc.
dop2000
Thanks for answer but "result = 5" I need it "result = 2"
I need like this way
Array.IndexOf("PlayerSkin*")
I need find the first matching element not last
It finds all results - 2, 3, 4, 5
If you want to stop after the first element found, change the loop to this:
For x=0 to Array.width-1
.... left(Array.at(loopindex), 10)="PlayerSkin" -> set result to loopindex
.... -> Stop loop
OK Got it. Thank you
.CurValue, CurX and similar expressions only work with "Array-For Each element" loop. (But Array-For Each loops can't be stopped)
When you are using System-For loop, those expressions don't work.
You need to use Array.At() as in my example above.
I fixed it. Thank you again. It is stopping when find first value.
https://prnt.sc/iv9svt