playMaker

Author Topic: String Join action[SOLVED]  (Read 2408 times)

Doh

  • Full Member
  • ***
  • Posts: 124
String Join action[SOLVED]
« 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?
« Last Edit: November 29, 2017, 01:05:40 AM by jeanfabre »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: String Join action
« Reply #1 on: November 24, 2017, 03:14:49 PM »
Hi,
I have just tested this and it seems fine on my end.


Doh

  • Full Member
  • ***
  • Posts: 124
Re: String Join action
« Reply #2 on: November 24, 2017, 03:21:58 PM »
Cheers for testing that out, it must be me. I'll check back if I can't solve it.

Doh

  • Full Member
  • ***
  • Posts: 124
Re: String Join action
« Reply #3 on: November 24, 2017, 04:03:48 PM »
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.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: String Join action
« Reply #4 on: November 24, 2017, 05:01:00 PM »
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.

Doh

  • Full Member
  • ***
  • Posts: 124
Re: String Join action
« Reply #5 on: November 24, 2017, 08:04:00 PM »
Wonderful, thanks very much djaydino!

I'll implement your method first thing Sunday.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: String Join action
« Reply #6 on: November 27, 2017, 02:17:54 AM »
Hi,

 you need to use the action "Array Save Changes" from the ecosystem. Can you try this?

 Bye,

 Jean

Doh

  • Full Member
  • ***
  • Posts: 124
Re: String Join action
« Reply #7 on: November 27, 2017, 10:18:38 AM »
Yup that does the trick and updates it. Cheers!