PlayMaker Help & Tips > PlayMaker Help

Custom action help [SOLVED]

(1/2) > >>

escpodgames:
I've got my first action and in theory it works (yet to test on device) however I can't figure out how to make a string/int/float variable to not have to take a variable but to be a text field. For example the set string action has a text field you can type to set the string. My action will only take variables, I've had a look at many other actions to see what the differences are and I'm missing something.

Also feels awesome to make a custom action :)

jeanfabre:
Hi,

 Yes, making custom is really cool, cause it integrates so well with playmaker, it feels it's always been there isn't it :)

in your case I think you want to add an attribute to the public var:

[UIHint(UIHint.Variable)]

this will expose the variable to let the user pick a Fsm variable from the state ( or a global variable).

 Is that what you are after?

 basically, when you want to do something that exists on other action, simply right click on the action and click "edit script" and see how it was coded, that's how I learned and actually alway do when I want to achieve something similar to existing actions.

bye,

 Jean

escpodgames:
Ah, I was using [UIHint(UIHint.Variable)] so it was looking for a variable, but its still not exactly what I would expect ... it would work but I would like to understand why its not working :)

Attached an image - the top action is what I want it to look like when added, the bottom action is what it looks like when added - the middle action shows the Compare To variable (this is what I'm wanting for the message button and message Body variables. Not a big issue but just a nice to know.

Yip found the right click - very helpful.


--- Code: ---using UnityEngine;
using System.Collections;
using System.Collections.Generic;

namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("IOS LocalNotifications")]
[Tooltip("Sets a local notification")]
public class SetLocalNotification : FsmStateAction
{
[Tooltip("Button text")]
public FsmString messageButton;

[Tooltip("Message text")]
public FsmString messageBody;

[Tooltip("The amount of seconds from now til the message is displayed")]
[RequiredField]
public FsmInt secondsTilMessage;

[Tooltip("The sound file name to play on notification")]
public FsmString soundFile;

[Tooltip("Notification ID")]
public FsmInt badgeNumber;

[Tooltip("A different default.png to use when launching game")]
public FsmString launchImage;

public override void Reset()
{
messageButton = "";
messageBody = "";
secondsTilMessage = 0;
soundFile = "";
badgeNumber = 0;
launchImage = "";
}

public override void OnEnter()
{
EtceteraTwoBinding.scheduleLocalNotification( secondsTilMessage.Value , messageBody.Value, messageButton.Value , badgeNumber.Value , soundFile.Value, launchImage.Value );
Finish();
}
}
}
--- End code ---

escpodgames:
Interesting .... not sure what I did but its working now :)

Lane:

--- Quote from: LampRabbit on May 22, 2013, 06:37:23 AM ---Interesting .... not sure what I did but its working now :)

--- End quote ---

Thats generally how it works. =)

Navigation

[0] Message Index

[#] Next page

Go to full version