DarkScript object release - run functions from expressions! ($10)

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • 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! ^^

    Darkwire Software Lead Programmer (C++ & C#)
    Please login to see this link. | Please login to see this link. | Please login to see this link. | Please login to see this link.

    Edited once, last by Phi (April 5, 2024 at 3:49 AM).

  • I'm very interested to this extension, however I prefer to wait until it's also available for HTML5.

    Yea, downside of HTML5/UWP is it's JavaScript only; the others are implemented with the same C++ codebase; easy to maintain that way, when a bug can be fixed for all platforms with one change.

    I've heard from some users that HTML5 has very borked object selection, so we'll see. I am unsure about how it implements its ticking, with a perpetual setTimeout() finishing and calling next setTimeout(), so a few seconds in you've got hundreds of setTimeout() in the function chain...

    Currently no code exists for the HTML5 version, but I do want to implement it there. HTML5 and UWP differ only a minor amount, so hopefully it's minor even with this ext that fiddles with object selection, and I'll have both platforms ported at the same time.

    If I do go for making it HTML5, it'll be after a uPnP object that several users are very keen on.

    Darkwire Software Lead Programmer (C++ & C#)
    Please login to see this link. | Please login to see this link. | Please login to see this link. | Please login to see this link.

  • are there chances to see an HTML5-porting any soon ?

    The object's proven pretty stable, the issue would be in object selection. I added cross-platform object selection to DarkEdif extension SDK Please login to see this link., and made it consistent across runtimes, but DarkEdif isn't HTML5's JavaScript, it's C++, so it's a lot of legwork for DarkEdif as well as DarkSCript.

    Some work has been done porting it, but there's a bunch of deadline-powered priorities ahead of me porting it to HTML5. Still, I can say there is 186KB of code written for it, and the basics have been tested and work well. I don't recall what wasn't working where I left it, but other priorities and all.

    Darkwire Software Lead Programmer (C++ & C#)
    Please login to see this link. | Please login to see this link. | Please login to see this link. | Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!