Playmaker Forum

PlayMaker Feedback => Action Requests => Topic started by: Farwest on September 10, 2021, 04:40:53 PM

Title: [SOLVED] Split String into Int Array
Post by: Farwest on September 10, 2021, 04:40:53 PM
Currently there is an Action: Split String. And it is splitting a String into String Array, but I need it to convert each of the items in the Array into Int too.

Therefore, I modified the script a little bit, yet it gives this error although it generates an Int Array (as I see the generated variable in debug on runtime), it has a problem in saving it I guess because it is not finishing running the action (not moving to next action in run):
ArrayTypeMismatchException: Attempted to access an element as a type incompatible with the array.
(wrapper stelemref) System.Object.virt_stelemref_sealed_class(intptr,object)


Currently I rely on saving int arrays by building them as strings (1.2.3.74.8.136...etc. have "." between each int rows) so I can save the Arrays in PlayerPrefs and saving them as arrays inside arrays. And when loading, I plan to split the string back to an Array again by using this Action "Split String into Int Array".

As my coding skills are not great, I need some help to finalize the action. I uploaded my modified script in the attachment.
Thanks!

Edit: [Solved]
Title: Re: Split String into Int Array
Post by: Farwest on September 10, 2021, 05:23:38 PM
I fixed it as I needed, however the script is requiring adding an additional String Array Variable to work as carrier to move the values to Int Array. I share it for anyone who needs.

Please feel free to fix the script if needed.