Programing logic with interactions

Quick question, is there a way to reverse how the interaction logic works in the Events/Actions setup on Active Presenter ?

My issue is the following: I want the same condition to allow for a large set of events to occur upon clicking on a button once.

The tedious but intuitive way to do this would be to set up something like

On click:
Hide 1
if condition A
Show 2
if condition A
Play audio 3
if condition A
Adjust variable 4
if condition A
Adjust Variable 5
if condition A
Change object state 6
if condition A
Change object state 7
if condition A

Whereas the ideal way would be to be able to declare:

On click:
if condition A:
Hide 1
Show 2
Play audio 3
Adjust variable 4
Adjust Variable 5
Change object state 6
Change object state 7

Given I have this pattern about 50 or 60 times in my project, is there any way to do it this way ? That would save me hours of tedious work.

Thanks in advance!

ActivePresenter version: ActivePresenter Pro Edition
Version 9.3.0 - 64-bit build. (Released: 2025.04.08)

OS: Windows

I would say this is a good use case for JavaScript and a function.
Place the function in the onLoad event of the slide.
Basic setup would be something similar to this…

window.myCustomFunction = function() {
    if (prez.variable("myVar") == "someValue") {
        prez.object("myShape").hide();
        prez.object("myOtherShape").show();
        prez.variable("someVar", "newValue");
        prez.object("myShape").state("stateName");
        etc...
    }
}

Now - wherever you need all these things to happen - all you need to do is call the function.
onClick
Execute JavaScript

myCustomFunction();

Hopefully this helps.
I talk a bit about functions in this resource as well.

2 Likes

Thank you for the quick reply!

I will see what I can do, and turn back to you if I need further clarification.

Hi Marco,

You can use Advanced Actions feature in ActivePresenter to achieve your goal.
It helps you create multiple actions and reuse them for other objects without having to repeat the same manipulations.
Kindly take a look at this article to learn more about this feature:

Besides, I also attach a sample project based on your above description for your reference:

advanced actions.approj (360 KB)

Hope that it helps, @Marco_Buisson.
Thank @gregs for your prompt assistance :star:

BR,
Thuy

1 Like

Hi,
Thank you for the sample project as well, you guys rock!
I managed to do everything I wanted to do with JS code, it is pretty handy once you get the gist of it.
I have another question a bit off topic here, but I thought it would be best to include it in this thread rather than create another post.
I really enjoy the text ‘fade in’ animation letter by letter, giving a dynamic flow to text that is intended to be discourse. However, I only managed to make it happen when the text first appears in its default state, and do not know how to apply it to text object state change, as I use the same text objects with differents states to represent the next dialog lines.
How would you solve this issue ?

Best Regards,
Marco