playMaker

Author Topic: Interaction with normal scripting [SOLVED]  (Read 2115 times)

thierry_st_malo

  • Junior Playmaker
  • **
  • Posts: 58
Interaction with normal scripting [SOLVED]
« on: November 27, 2017, 12:32:50 PM »
Hi,

I try to add a Playmaker FSM to a game that was created with normal scripting, and in my FSM a Get Key Down action doesn't work, as if the keyboard events were "hidden" from PlayMaker. What might me the cause?

Thanks.
« Last Edit: November 30, 2017, 09:52:30 AM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Interaction with normal scripting
« Reply #1 on: November 27, 2017, 07:38:24 PM »
Hi,
Is the action triggering?
Can you give some more information? (images/videos from the issue)

thierry_st_malo

  • Junior Playmaker
  • **
  • Posts: 58
Re: Interaction with normal scripting
« Reply #2 on: November 28, 2017, 04:41:45 AM »
No, it doesn't trigger.

And, as I wanted to start with a very simple test, it is just an "Application Quit" action launched with a "Get Key Down f8".

Thanks for your help.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Interaction with normal scripting
« Reply #3 on: November 28, 2017, 12:46:25 PM »
Hi,
I tested the action with f8 and other keys, they seem to work fine on my end.

Can you maybe show your setup (fsm/states/actions) and the issue in a video, Pictures or gif

thierry_st_malo

  • Junior Playmaker
  • **
  • Posts: 58
Re: Interaction with normal scripting
« Reply #4 on: November 29, 2017, 05:25:08 AM »
Thanks, I can do that but it gave me the idea of something even more useful:

Can a standard C# script send an event that will be detected by a given state in a given FSM and use it (perhaps in a transition) to trigger a state or an action? If so, how to do that?

Thanks in advance. For me at least, that would greatly increase PlayMaker's usefulness !

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Interaction with normal scripting
« Reply #5 on: November 29, 2017, 05:05:35 PM »
Hi.
Yes you can :D

1st you need :
Code: [Select]
using HutongGames.PlayMaker;
then a variable for the fsm :
Code: [Select]
public PlayMakerFSM myFSM;
if the script and the fsm are in the scene from the start, then you can drop in the fsm.
if you need to get the fsm from another object, select the object with the script
Then on the inspector click on the lock to lock it.
then click on the right side of the lock, select add tab and select inspector.
you will now have 2 inspectors drag it somewhere so you can see both inspectors and the select the object with the fsm you need.
now you can drag in the fsm.

Another way to get it is for example like this :
Code: [Select]
myFSM= gameObject.FindWithTag("tagOnMyFSMobject").GetComponent.<PlayMakerFSM>();
to send a event you can do :
Code: [Select]
myFSM.Fsm.Event("theEventToSend");
you can find some API references here :
https://hutonggames.fogbugz.com/default.asp?W127

thierry_st_malo

  • Junior Playmaker
  • **
  • Posts: 58
Re: Interaction with normal scripting [CLOSED]
« Reply #6 on: November 30, 2017, 04:11:08 AM »
Many thanks !