Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: derkoi on July 20, 2012, 04:56:54 AM

Title: Long type?
Post 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

Code: [Select]
Playtomic.Initialize(gameid, "guid", "apikey");
Any ideas how I can add this? Thanks
Title: Re: Long type?
Post by: jeanfabre on July 20, 2012, 05:29:54 AM
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
Title: Re: Long type?
Post by: derkoi on July 20, 2012, 05:33:17 AM
Ah right, I just edited the original post as I cant get the strings to work either. I tried this:

Code: [Select]
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'
Title: Re: Long type?
Post by: jeanfabre on July 20, 2012, 06:36:32 AM
Hi,

 FsmXXX variable are wrappers, so you have to use the .Value to get and set them

so:
Code: [Select]
appGuid.Value = guid;
guid = appGuid.Value;

the same apply to ALL FsmXXx types.

bye,

 Jean
Title: Re: Long type?
Post by: derkoi on July 20, 2012, 06:45:23 AM
Great, thanks Jean!  :)

Any idea how i should convert the int to a long?
Title: Re: Long type?
Post by: jeanfabre on July 20, 2012, 10:16:03 AM
Hi,

 just do (int)MyLongVariable


Bye,

 Jean