playMaker

Author Topic: "Collections" Actions[SOLVED]  (Read 214 times)

Duffer

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
    • Email
"Collections" Actions[SOLVED]
« on: March 07, 2017, 08:25:52 AM »
Hi All,

Not sure if this is the right forum board to ask this.... but I see that 'Collections' actions are in planning.

What sorts of actions (and variables) would Collections actions cover?  Where can I find out about them and what they are planned to do/accomplish?

When / what version are they slated to be introduced in?
« Last Edit: March 16, 2017, 12:48:41 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 11404
    • View Profile
    • Email
Re: "Collections" Actions
« Reply #1 on: March 08, 2017, 11:36:45 PM »
Hi,

 can you paste the link where you see this is stated?

 Currently, ArrayMaker is available on the Ecosystem and wiki and covers collection using Hashtables, with string keys. It's already enabling quite a lot, but maybe not as flexible as Collections.

Bye,

 Jean

Duffer

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
    • Email
Re: "Collections" Actions
« Reply #2 on: March 09, 2017, 12:11:31 AM »
Damn.  Doesn't sound likely then... ;)

Here is the link:-  in Action Reference section of Manual:-  https://hutonggames.fogbugz.com/default.asp?W529

Ive always wanted a neat way for Playmaker to work well with or effectively interrogate public Lists in GOs.  I am not sure the Get/Set Property actions get me there...
« Last Edit: March 09, 2017, 12:13:08 AM by Duffer »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 11404
    • View Profile
    • Email
Re: "Collections" Actions
« Reply #3 on: March 09, 2017, 07:28:18 AM »
Hi,

 yes, you are better off creating custom actions to access this component data.

Where did you get this component?

 Bye,

 Jean

Duffer

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
    • Email
Re: "Collections" Actions
« Reply #4 on: March 09, 2017, 10:08:51 AM »
I regularly append public lists or arrays in mono classes to GO.  From what you are saying the Action References link to Collections actions is a red herring?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 11404
    • View Profile
    • Email
Re: "Collections" Actions
« Reply #5 on: March 10, 2017, 02:53:19 AM »
Hi,

 If you are ok with scripting, no it's totally fine, you create the proper custom actions to access this list either per item, or direclty saving the content into an FsmArray.

The actions references link is simply a pending task, I am not sure when this is going to be adressed, I would not wait on this, and use either ArrayMaker or make your own custom actions to access your scripts. If you need a kick start let me know, send me one of your component and I'll show you how to create related custom actions, it's very easy.

 Bye,

 Jean

Duffer

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
    • Email
Re: "Collections" Actions
« Reply #6 on: March 10, 2017, 05:16:04 AM »
Hi Jean,

I'll be honest.  I could do with some help for the script for the custom action to grab values from say a public array of strings and, for the sake of simplicity a List of strings too, in a monobehaviour class linked to a GO.

Pretend the following mono class is sitting as a component on the same GO:-

Code: [Select]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class RPGBaseInfo : MonoBehaviour {

    public bool template = false;
    public bool hidden = false;

    public string title = "default name";

    public string[] descriptors;

    public List<string> knicknames = new List<string>();
}

What would the Custom Action scripts look like to access both values in the Array and then in the List?

[edit] ignore bit about Arrays... can now see how to do that with Get Property action.  More interested in Lists...

« Last Edit: March 10, 2017, 06:18:47 AM by Duffer »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 11404
    • View Profile
    • Email
Re: "Collections" Actions
« Reply #7 on: March 15, 2017, 12:48:10 AM »
Hi,

 here we go:



and the action is :

Code: [Select]
using System;
using UnityEngine;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("RPG")]
public class GetRPGInfoItem : FsmStateAction
{
[RequiredField]
[CheckForComponent(typeof(RPGBaseInfo))]
[Tooltip("The GameObject with the RPGBaseInfo component")]
public FsmOwnerDefault gameObject;

public FsmInt index;

public FsmString name;

public bool everyFrame;

RPGBaseInfo _info;

public override void Reset()
{
index = 0;
name = null;
everyFrame = false;
}

public override void OnEnter()
{
var go = Fsm.GetOwnerDefaultTarget(gameObject);
if (go == null)
{
return;
}

_info = go.GetComponent<RPGBaseInfo> ();

DoGetRPGInfoItem();

if (!everyFrame)
Finish();
}

public override void OnUpdate()
{
DoGetRPGInfoItem();
}

void DoGetRPGInfoItem()
{

if (_info == null) {
return;
}

name.Value = _info.knicknames [index.Value];

}
}
}

 so, once you understand how to declare Fsm Variables and work with them within an action, the rest is regular c#

Bye,

 Jean

Duffer

  • Playmaker Newbie
  • *
  • Posts: 24
    • View Profile
    • Email
Re: "Collections" Actions
« Reply #8 on: March 16, 2017, 12:21:51 AM »
@Jean,

Excellent.  Thanks.