Hey folks,
Those following Please login to see this link. already know this, but I'm just writing this as is the usual tradition for released extensions.
This object was previously named Expression-Function object and Intense-Function object, before being named DarkScript.
What does DarkScript do?
This object allows you to run functions from expressions, which are implemented by events.
When you run a Func-like expression, it triggers On Function for that function name, allowing you to take the parameters you passed, and return data to the original event.
Please login to see this attachment.
This makes it very easy to make app-wide changes, without changing the events using them:
Please login to see this attachment.
You can read the passed parameters using expressions, too.
Please login to see this attachment.
This sort of hot-swappable, separated nodes of code, is called modular programming, and is extremely useful for reducing your code to small, predictable easily-optimized and repaired parts.
How does it compare with other function objects?
DarkScript supports a vast amount of function-related features; I designed it with everything I could think of, to be a function object that replaced the similar function objects.
There are several function objects, some basic ones even dating back to Fusion 1.5 days; Fast Function object, FuncLoop, Advanced Function Object, PowerFunction, and a newer Func from defisym.
And frankly, this one knocks all of those out of the park. All of them have a fraction of the power and flexibility of this object, partly due to how this object is designed under the hood, but mostly from the sheer flexibility it offers and the thought into its design.
Perhaps most importantly, those other objects are not portable, and tend to obliterate the object selection.
But DarkScript is compatible with Fusion 2.0, 2.5, 2.5+, and can target Windows, Android, iOS, and Mac.
It may be ported to HTML5 and UWP later.
Okay, but can it...?
Yes. DarkScript can do:
- Functions called from expressions – including functions called inside those.
Pass 0-6 parameters of any type.
Functions are invoked by a very obvious pattern; you can add a parameter by adding a letter to the expression, or change the return type with a single character. CF2.5+ users can use Find All (Ctrl-Shift-F) to find all usages of their function.
You can see above in the last two images, in event 1, how simple it is to modify the parameters passed to expression. - Functions that inherit the calling event's object selection (K functions)
- Delayed functions – including running by ticks or by timer, cancelling, and optionally keeping them across Fusion frame switches
- Repeating functions (fastloop) – although, unlike Fusion's fastloops, they don't break object selection in calling event.
- Foreach functions – they run in-line, not at end of event like Fusion's built-in foreach.
- And you can nest the foreach, unlike Fusion's built-in foreach, which will deselect the outer foreach loop's object.
- You can run foreachs on qualifiers, and have On Function [qualifier] only, or On Function [any object in qualifier] as well.
- Similarly, you can run foreach on singular objects and have On Function [qualifier that has object in it] trigger too.
- These foreachs also don't break object selection in the calling event.
- Stopping functions midway. This is fairly strong by itself. You can:
- > interrupt foreach loops (not possible in Fusion)
- > interrupt fastloops and keep running On Loop for the current loop index (Fusion's fastloop behaviour)
- > interrupt fastloops and stop running On Loop for the current loop index (not possible in Fusion)
- > interrupt On Function events for a non-loop function (effectively a CF2.5+ Break action)
- Call functions that have their code in a subapp (or call a parent app's function from subapp)
- Functions called by reading a text expression (scripting)
This is rudimentary at the moment, but is planned to be expandable to a full script engine later. - Templates of functions, with your specific parameter types, which allow you to check for the right data being passed.
Never pass a damage number of "apple" to your again!
Or you can enable template-less functions (so you can just write the code that calls them, no pre-planning of types). - Variable-parameter functions (variadic functions) - so you can pass 1 or 5 parameters to the same function, think of Excel's SUM function .
This is very useful for writing logging or language translating functions. - Easy temporary local variables, inherited by sub-functions, and deleted when the function ends
- Strict typing, and weak types; prevent reading a text parameter as number, or permit automatic conversion between float, int, string
- It has support for recursion (functions calling themselves), and it checks for accidental recursion – and you can disable recursion globally
- Aborting a whole function chain during error scenarios, which aborts the function and its parent function(s) as you want.
(This is called "throwing exceptions" in other coding languages, but your app will continue running, no worries there.) - Function chain reading – you can find what Fusion event line called this function, and what line called that, etc.
It also works well with foreach and delayed functions.
Please login to see this attachment.
You can also get all the passed parameters and their types in one text expression; very useful for making your own script debugger. - Function redirection – you can have a "SetNameDebug" function with a lot of debug stuff and "SetName" without; and when you want to debug it, redirect SetName to SetNameDebug.
- Function disabling – disabled functions won't trigger any events and will instead instantly return their default value to the caller.
When some functionality in your app is not needed, this will let you turn it off without rewiring most of your code.
Anything you need more complicated turning off for, there's function redirection! - etc...
If you can come up with any other features, I'll be impressed.
Oh, and DarkScript comes with a full help file.
Shut up and take my money!
This object is going for the vast sum of $10 per platform; sign up on Please login to see this link., stay subbed to support development, or buy more directly via Please login to see this link.. Or direct bank transfer.
If you're buying for non-Windows, you'll have to buy Windows with it for the editor version.
You keep the version forever and can use it in unlimited projects; just don't hand it out to others. If you're subscribed, you'll get updates as they come out, otherwise you can get other extensions each month.
However, if you buy once, you only have that version, and will have to buy again for updates.
Thanks for your interest and support so far!