Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Doh on November 24, 2017, 03:01:47 PM
-
Having an issue where the "String Join" action doesn't add the last string in an array. If the array is 5 strings long then it joins the first 4, if it's 3 strings long then it joins the first 2 etc.
Anyone else getting this problem?
-
Hi,
I have just tested this and it seems fine on my end.
(https://i.imgur.com/VVg7GeV.png)
-
Cheers for testing that out, it must be me. I'll check back if I can't solve it.
-
After further testing it seems I can make it work with an array that I manually prefill before running the game, I can't seem to make it work though with an array that is populated during runtime.
-
Hi,
I can confirm this indeed.
I will report to Alex.
Meanwhile you can do this as a workaround (2 States needed) :
State 1 : place the action "array get next" and set a loop event (Next) and a Finished Event (Done)
Connect 'Next' to State 2 and connect 'Done' to the next part of your setup.
on 'Result' add a variable (Current)
State 2 : place the action "Build String" and set String parts to '2'
Then in 'Element 0' place the variable 'Current'
in 'Element 1' make a new variable (Result)
Don't use the separator
in 'Store Result' place the 'Result' Variable.
place a finished transition and direct it back to State 1
if you do need a separator (- for example)
set string parts to 3 and place the separator in element 1 and current in element 2
you will also need a state right after done wit the actions :
-"get string length" place the 'Result' Variable and make a (Length) Variable
-"Int Add" add -1 to the Length variable
-"Get String Right" on string Variable place 'Result' variable, on Char Count place 'Length" variable and on Store Result place 'Result' variable.
and then connect to the next part of your fsm.
-
Wonderful, thanks very much djaydino!
I'll implement your method first thing Sunday.
-
Hi,
you need to use the action "Array Save Changes" from the ecosystem. Can you try this?
Bye,
Jean
-
Yup that does the trick and updates it. Cheers!