Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom Actions - Return Type (variable) #355

Open
2 tasks done
SalmanShhh opened this issue Sep 4, 2024 · 1 comment
Open
2 tasks done

Custom Actions - Return Type (variable) #355

SalmanShhh opened this issue Sep 4, 2024 · 1 comment

Comments

@SalmanShhh
Copy link

Reviewed guidelines

  • I have read and understand the suggestion guidelines

Checked for duplicate suggestions

  • I checked for existing similar suggestions

Summary

Custom Actions have been great for organising functions under objects especially in projects where theres heavy use of them for complex behaviours and even simpler ones in addition to make it easier to share code between projects.

if there was something missing it would be great to have the ability to return variables via custom actions similar to how they work in Functions but with the added benefits that come from picking with Custom Actions + organisational benefits of the actions being inside the objects when searching.

Possible workarounds or alternatives

currently its creating normal functions, but having to make variants of those functions with several layers of picking involved to pick the specific or correct instances to return the target type/data and dealing with issues in casting the correct type of variable.

Proposed solution

for example I use Custom Actions to sort out a save system that looks a lot like this.

image
with the need to get certain data back I needed to use a function purely dedicated to getting specific data. luckily in the example this can be totally fine but if it was dealing with several objects for different types of behaviours it would get very intensive very quickly.

Why is this idea important?

would love this to be considered, since it would open up more opportunities to do complex things that would help with improving workflow of projects and even making optimisation tricks such as Time-Slicing more feasible to do in Construct for large projects that would be able to make use of it.

Additional remarks

in a personal note it would greatly help with the development on the next title from Hibernian Workshop that I'm working on.

@ruskul
Copy link

ruskul commented Sep 17, 2024

I thought there was already a feature request for custom expressions, but I can't seem to find it now. +1

I will add that you an alternative that I use to pass data is an array. Whenever a custom action is called that has a return value, the caller passes a parameter "index" that indicates where in an array I should put the return value. If the custom action also calls other custom actions with return values, those actions are passed (index +1). This allows an arbitrary number of nested actions with minimal overhead and boiler plate.

Using it in action looks roughly like this:

CallAction(index , otherparameters)
SetSomeVar = ReturnArray.GetAt(index)

What I don't like is that it IS more work, and using it in conditions requires multiple events with sub events. and makes the events less legible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants