Return Events

JasonJonesLASM 3 years ago updated 3 years ago 10

Return events are three Macros: Return Event, Trigger Return Event, and Return.

Trigger Return Events pass arguments to a Return Event and wait for it to be returned to with some or no kind of result using the Return macro (make sure the events 'Event Data' is set to the Return Units input of the same.). Once a Return node is executed with the proper Event Data routed to it, it will send an event back to the trigger to exit with a returned result.

DOWNLOAD Version 1.2.1 (Bolt 1.4+)

Bolt Version:
Unity Version:
Scripting Backend:
.NET Version (API Compatibility Level):

Very nice, and useful too! But, it's a GoSub Unit, really. Not to be a pedant, but I think it's important to use the proper CS terms wherever possible. Bolt attracts people with NO experience. They need to know the concepts they are working with.  When I hear 'return' I think 'return values', not 'go back to'. 

func myReturn { return "DONE"};

What you've built here is a gosub:

10 Print "Gosub:"
20 gosub 40
30 Print "Done"
40 Print "Surprise!"
50 endsub
60 end



Except it does return a value of object even if it's returns null. Out of the gate Bolt does not handle a true immediate return of a specific type as a graph.  That would do away with any over time stuff, which I can't enforce (A new graph type would be needed for this.) This does not return a specific type because that is your job on how you handle that. 

Trigger (now exits flow) ----> receiver gets signal with optional argument ----> does stuff -----> returns value back to triggers output and exits.

Sounds like a Func to me. 

Invoke Func --->  Do something ---> return value to original point we called it in the script.

I appreciate that you enjoy it though, thank you!

On the other hand think it sounds fine and don't care about semantics, I'm an visual person first, so I choose on purpose to write more human. I am not in favor of continually complicating things for people. I'm in tune with making it easier and simpler for everyone, which includes non coders. 

I appreciate the goal, but, if a dog is a dog and you call it a cat, how does that simplify things in the larger sense?

And yeah, null funcs and gosubs are pretty much the same thing, if separated by a few years.

Lol whatever you say captain.

Just discussing. Awesome graph :D


Update: Return Events version 1.1.1

While creating some other assets utilizing these, I found I never added the extra return security to prevent conflicts. Now we have a new object hashcode set and cached every trigger, and checked upon return. Some extra commenting inside as well, to help understand what is going on under the hood.

DOWNLOAD Version 1.1

* EDIT:  Added a fix for creating the hashcode only once. 

DOWNLOAD Version 1.1.1

Update: Return Events version 1.2

This will probably be last of these frequent updates. I can't foresee many other options. But if you got them, I'll implement them. 

Added Exit Control Output for Exiting immediately after trigger. So even if you have delays, you can still perform right after the trigger actually takes place.

DOWNLOAD Version 1.2

Version 1.2 link off :/ 

will help this function a lot in college games <3

Good! And thanks for the heads up. Fixed now.

Update: Return Events version 1.2.1

Quick fix, now works with Bolt 1.4.

Download Version 1.2.1 (Bolt 1.4+)