Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: derkoi on July 20, 2012, 04:56:54 AM
-
I'm trying to make my own actions and I need to use the type "long" (http://msdn.microsoft.com/en-us/library/ctetwysk%28v=vs.71%29.aspx), I tried FsmLong but it appears it's not supported?
The actions are for Playtomic that I'm trying to add so I can't just use an Int instead. :(
Also when I try and use a FsmString for a string variable in this line of code, it won't allow it.
gameid needs to be a long, guid & apikey are strings
Playtomic.Initialize(gameid, "guid", "apikey");
Any ideas how I can add this? Thanks
-
Hi,
yes, you'll need to convert to int unfortunately, it's the same with some date functions that uses long, I haven't found a work around that myself.
bye,
Jean
-
Ah right, I just edited the original post as I cant get the strings to work either. I tried this:
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("Playtomic")]
[Tooltip("Initializes Playtomic.")]
public class PlaytomicInitialize : FsmStateAction
{
public string guid;
public string apikey;
[RequiredField]
// [UIHint(UIHint.Variable)]
public FsmString appGuid;
[RequiredField]
public FsmString appApikey;
// [RequiredField]
// public FsmLong gameid;
public override void Reset()
{
appGuid = null;
appApikey = null;
}
public override void OnEnter()
{
if (gameid == null) return;
if (appGuid == null) return;
if (appApikey == null) return;
guid = appGuid;
apikey = appApikey;
Playtomic.Initialize(gameid, guid, apikey);
Finish();
}
}
}
I get this error:
Assets/My Playmaker Actions/Playtomic Actions/PlaytomicInitialize.cs(35,25): error CS0029: Cannot implicitly convert type `HutongGames.PlayMaker.FsmString' to `string'
-
Hi,
FsmXXX variable are wrappers, so you have to use the .Value to get and set them
so:
appGuid.Value = guid;
guid = appGuid.Value;
the same apply to ALL FsmXXx types.
bye,
Jean
-
Great, thanks Jean! :)
Any idea how i should convert the int to a long?
-
Hi,
just do (int)MyLongVariable
Bye,
Jean