playMaker

Author Topic: Save variables into String array from C# script[SOLVED]  (Read 2331 times)

nighty9

  • Playmaker Newbie
  • *
  • Posts: 18
Save variables into String array from C# script[SOLVED]
« on: June 23, 2015, 05:31:52 AM »
Hi,

I tried to get data from Parse ( which works ), then when i want to store them in an array variable of Playmaker it only works for int values; as soon as it's string it doesn't store them correctly.

Any ideas why that could be? I attached the code :

Code: [Select]
}
Debug.Log("put whatever u like here");
query = new ParseQuery<ParseObject>("Data20Q");
query.FindAsync().ContinueWith(t =>
{
result = t.Result;
Debug.Log("data recieved!");
foreach (ParseObject obj in result)
{
ID = obj.Get<int>("ID");
answer = obj.Get<string>("Answer");
Debug.Log(obj.Get<string>("Answer"));
yes = obj.Get<string>("Yes");
Debug.Log(obj.Get<string>("Yes"));
no = obj.Get<string>("No");
Debug.Log(obj.Get<string>("No"));
Debug.Log("put whatever u like here");

fsmInterface.FsmVariables.GetFsmArray("IDArray").Set (idIndexArray,ID;
Debug.Log(idIndexArray);
fsmInterface.FsmVariables.GetFsmArray("answerArray").Set (idIndexArray,answer);
fsmInterface.FsmVariables.GetFsmArray("yesArray").Set (idIndexArray,yes);
fsmInterface.FsmVariables.GetFsmArray("noArray").Set (idIndexArray,no);
idIndexArray = idIndexArray + 1;
}
} );
}

The idea is to store each value from Parse to recreate the DB as multiple arrays, one per column.

Thanks for the help!

Nico
« Last Edit: June 23, 2015, 09:51:29 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Save variables into String array from C# script
« Reply #1 on: June 23, 2015, 07:19:21 AM »
Hi,
 
-- You get no errors in the console?

-- Are you sure you are naming properly arrays, since it's loose referencing, you could have typos

Bye,

 Jean

nighty9

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Save variables into String array from C# script
« Reply #2 on: June 23, 2015, 09:47:05 AM »
Hi,

Thank you for the help Jean,

I found the issue, it was that setting a variable to an out of range index will not extend automatically the array size and block the script; i solved it by adding a dynamic "+1" to size when adding a new variable.

Nico

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Save variables into String array from C# script[SOLVED]
« Reply #3 on: June 23, 2015, 09:51:50 AM »
Hi,

 Good! I am glad you found your way out of this.

Bye,

 Jean