playMaker

Author Topic: Getting a Variable from an FSM through a script into my database[solved]  (Read 2344 times)

cobra01

  • Playmaker Newbie
  • *
  • Posts: 4
Code: [Select]
using UnityEngine;
using uGameDB;
using System.Collections;
using HutongGames.PlayMaker;

public class CharacterSave : MonoBehaviour {

public void Start() {

StartCoroutine(MiniCoroutine());
}

private IEnumerator MiniCoroutine() {

FsmString Data = FsmVariables.GlobalVariables.GetFsmString("TestWrite");

var bucket = new Bucket("PlayerBucket");

var setRequest = bucket.Set("PlayerNr1", (Data), Encoding.Json);

yield return setRequest.WaitUntilDone();

Debug.Log("Wrote one value and got a reply. Success = " + setRequest.isSuccessful);
}
}

I am pretty stuck on how to get variables or global variables from out from an FSM trough this script into my database, it works ...up to the point where it writes everything in that fsm into the database and while all the FSM data is correct i just need the value or string from it, not the entire FSM.

Ive tried all the variable solutions on the forum that i could find, but either it writes ..everything or it throws an error that things dont excist.
« Last Edit: March 31, 2012, 03:38:08 PM by jeanfabre »

cobra01

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Getting a Variable from an FSM through a script into my database
« Reply #1 on: March 31, 2012, 02:49:11 PM »
Fixed it 5 mins after posting this lol ....4 hours ...i post and i find the issue /facepalm..

had to use .Value

Code: [Select]
var setRequest = bucket.Set("PlayerNr1", (Data.Value), Encoding.Json);