playMaker

Author Topic: Is there a coroutine action here in playmaker?  (Read 378 times)

mrminico

  • Junior Playmaker
  • **
  • Posts: 75
    • View Profile
Is there a coroutine action here in playmaker?
« on: August 20, 2018, 10:53:51 AM »
Hello everyone,

I've noticed most actions here has an every frame option. I was brainstorming of possible ways to do things on every frame within a set amount of time and read on how coroutines work. I was looking at this video

https://www.youtube.com/watch?v=bM3CXzj5xM4

and saw that coroutines would be great to have for small tasks that you don't need to call on every frame.

Does anyone know how to achieve this functionality in playmaker with current actions? or is it something I'll need to find a programmer to do?



 

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3664
    • View Profile
    • jinxtergames
Re: Is there a coroutine action here in playmaker?
« Reply #1 on: August 20, 2018, 11:12:39 AM »
Hi.
In The sample he showed i would do something like this :

State 1:
action 'Get distance'
Then a 'float compare' and if less than 0.05 go to next state.
Then the lerp stuff on line 20

state 2 :
print reached the target
'wait' set to 3 sec and finish

state 3
coroutine finished

there are many other similar ways you can use this.

for example on state 1 send a event (doSomething) to another fsm
then on state 2 send a event (StopDoSomething)

on the other fsm have 2 global transitions (doSomething and StopDoSomething)
and set them to global.

Here is a video about local/global :


mrminico

  • Junior Playmaker
  • **
  • Posts: 75
    • View Profile
Re: Is there a coroutine action here in playmaker?
« Reply #2 on: August 20, 2018, 04:36:30 PM »
Hi.
In The sample he showed i would do something like this :

State 1:
action 'Get distance'
Then a 'float compare' and if less than 0.05 go to next state.
Then the lerp stuff on line 20

state 2 :
print reached the target
'wait' set to 3 sec and finish

state 3
coroutine finished

there are many other similar ways you can use this.

for example on state 1 send a event (doSomething) to another fsm
then on state 2 send a event (StopDoSomething)

on the other fsm have 2 global transitions (doSomething and StopDoSomething)
and set them to global.

Here is a video about local/global :


Hi Djay thanks for the tip and video link. Conceptually I'm aware there are ways to mimic the functionality of a coroutine but the method you purposed isn't exactly what I was questioning. The video was just an example hahaha ^_^'.

To put it in better words is there an action that can yield to then continue where it last left as would a coroutine?

A good example would be having a wait timer that's interrupted the moment you exit. When you go back to the state the wait resumes from the last float it was in.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3664
    • View Profile
    • jinxtergames
Re: Is there a coroutine action here in playmaker?
« Reply #3 on: August 20, 2018, 08:22:16 PM »
Hi,
So i did some quick testing,
and i updated an older action of mine called "Countdown Timer"
If you set the same variable in 'Time' and 'Store value' it will continue where it left.

To restart the timer you will need to set the value back to the time you wish tho.(use set float value)

you can get it on the Ecosystem

mrminico

  • Junior Playmaker
  • **
  • Posts: 75
    • View Profile
Re: Is there a coroutine action here in playmaker?
« Reply #4 on: August 21, 2018, 09:19:59 PM »
Hi,
So i did some quick testing,
and i updated an older action of mine called "Countdown Timer"
If you set the same variable in 'Time' and 'Store value' it will continue where it left.

To restart the timer you will need to set the value back to the time you wish tho.(use set float value)

you can get it on the Ecosystem

Thanks for the action update I didn't know countdown timer was even a thing haha. So functionality wise I'm guessing the timer be used as if you're running a coroutine while having additional actions that "store variables". I'll mess around with it when I get the chance.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 3664
    • View Profile
    • jinxtergames
Re: Is there a coroutine action here in playmaker?
« Reply #5 on: August 22, 2018, 02:31:25 AM »
Hi.
Its good to look around in the ecosystem

You can even search using parts of c# codes, which i do often

Let me know if you got some results :)