playMaker

Author Topic: Long type?  (Read 3173 times)

derkoi

  • Full Member
  • ***
  • Posts: 187
Long type?
« on: July 20, 2012, 04:56:54 AM »
I'm trying to make my own actions and I need to use the type "long", 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
« Last Edit: July 20, 2012, 05:30:23 AM by derkoi »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Long type?
« Reply #1 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

derkoi

  • Full Member
  • ***
  • Posts: 187
Re: Long type?
« Reply #2 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'

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Long type?
« Reply #3 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

derkoi

  • Full Member
  • ***
  • Posts: 187
Re: Long type?
« Reply #4 on: July 20, 2012, 06:45:23 AM »
Great, thanks Jean!  :)

Any idea how i should convert the int to a long?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Long type?
« Reply #5 on: July 20, 2012, 10:16:03 AM »
Hi,

 just do (int)MyLongVariable


Bye,

 Jean