playMaker

Author Topic: Confused about Events -or- How to do something On Update/On Enable etc  (Read 3558 times)

davidosullivan

  • Playmaker Newbie
  • *
  • Posts: 10
I am looking to try to re-create some c# scripts I have made recently using PlayMaker but have really fallen at the first hurdle...

Basically nothing I have written that I am trying to recreate in PlayMaker does anything onStart but this seems to be all that PlayMaker is geared up for.

I do things 'onUpdate' or 'onEnable' or 'onGUI' or using Unity Events like 'onValueChange(d)'

I was really expecting to be able to change 'START' in the Playmaker' window to one of these things or to be able to create if necessary my own Event, something different to START like 'ONUPDATE' or 'ONVALUECHANGE'.

I am sure I am totally misunderstanding how playmaker works, but it seems very much orientated to 'in game' events, like mouse events and so on...

So any clarification of this would be really helpful.

I also think that while Playmaker is geared towards people not having to script anything, i.e. non coders,  it would be very helpful to have a 'coders' tutorial showing how to do things from a coders point of view.

What I'm imaging is tutorials like "say you have coded something like this, you could create that in PlayMaker like this"... Something where you describe how things coders are used to *translate* into the PlayMaker system's way of doing things...

Right now I am trying to create a bunch of triggers I have made and UI interpreters and just cannot see how to even get started, because everything is based on the 'START' event which I dont even need...

davidosullivan

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Confused about Events -or- How to do something On Update/On Enable etc
« Reply #1 on: December 06, 2015, 07:35:09 PM »
In the example scene '3Buttons' for example this appears to have three starting states: 'MOUSE EXIT', 'MOUSE ENTER' and 'MOUSEDOWN' and all of these are separate from each other, as if they were different methods that occur in reaction to some listener, but how does that happen?

Auggie

  • Playmaker Newbie
  • *
  • Posts: 6
Re: Confused about Events -or- How to do something On Update/On Enable etc
« Reply #2 on: December 07, 2015, 08:35:01 PM »
This page in the wiki pretty much explains it
https://hutonggames.fogbugz.com/default.asp?W128

Basically there are system events and user events. The systems events are sent automatically.

The user events you set up as you like. To set up a user event just make a normal event and then hit the toggle to make it into a global event.  Then you when you set a transition for that state use your global transition.

Then whenever you want to call that state you need to use the Send Event action.
and put your global event into it. 

davidosullivan

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Confused about Events -or- How to do something On Update/On Enable etc
« Reply #3 on: December 08, 2015, 07:57:51 PM »
Thanks Auggie,

How come there are no System events for stuff like 'Update' or 'OnGUI'? The system events seem to be like I say, entirely orientated about the sorts of things that might happen 'in game', not what one as a developer might choose to trigger on...

I guess I am still a bit confused about how Playmaker works.  If its a component, that generates code then why doesn't it have access to any other event that any other component has?

davidosullivan

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Confused about Events -or- How to do something On Update/On Enable etc
« Reply #4 on: December 08, 2015, 08:01:16 PM »
I suppose what I mean is why do I have to use 'START', why not 'ONENABLE' or 'UPDATE', why aren't those included as system events? Its really confusing

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Confused about Events -or- How to do something On Update/On Enable etc
« Reply #5 on: December 09, 2015, 08:01:07 AM »
Hi,

 I guess the shot answer would be because it's been designed this way.

The best way is to first understand how to work with what's available.

 typically, what would be the difference for you between "START" and "ONENABLE". "START" is implemented in PlayMaker, and will be called everytime the Fsm component is enabled. so indeed START includes ONENABLE.

For UPDATE. All actions that can be ran everyframe (UPDATE) have a checkbox "Everyframe" which means that it will be executed every update. There is no UPDATE system event in PlayMaker because this is implemented within the Action itself.

 so within a State that is active, some actions can be executed only once when the state is entered, or on every udpate if the option "Everyframe" is checked or if the action has been designed to run every frame by default.

Does that help understanding a bit more?

Bye,
 
Jean