HypeConditionLinker: Perform actions based on AND/OR conditions without JavaScript code

Interaction based on linked Conditions without scripting.
a testproject

that’s what’s possible:
linking conditions by “and” -> every condition must be met
linking conditions by “or” -> any condition can be met

When the count of triggered (running custombehaviors as hype-behavior) conditions is equal to the count of linked conditions the result will be examined and a predefined hype-custombehavior will be triggered.

////////////////
A scene or file can have several hypeConditionLinker-instances

To setup an instance you’ve got to add some data-attributes to an hypeelement:

data-logic-namespace -> the unique name for the instance
data-logic-if ->  a string that lists some custombehaviornames that are linked eather by "_and_" or "_or_"
data-logic-then -> a string that represents a custombehaviorname to be triggered*
data-logic-else -> a string that represents a custombehaviorname to be triggered

optional
data-documentwide -> a string: true. if set the instance will persist on scene changes

*when linking the instance with "_or_" data-logic-then is obsolete. instead a custom behavior will be called that includes the solved conditions as a name (-> condtionOne_conditionTwo_conditionX)

Feed an instance:
to feed an instance with a condition set up an empty custom behavior whose name includes the namespace of the instance and the current condition divided by a pipe -> namespace | condition
trigger this custom behavior from any in hype possible behavior … (timelinebavior, click, scene load …)

that’s it :slight_smile:

////////////

i guess this seemed more complicated than it is … :slight_smile:

the attached file will show a setup that combines two multiple choice questions to one unit. the result will be displayed in the last scene.

https://www2.aachener-zeitung.de/zva/karlo/test/HypeConditionsLinker/

hope it’ll work! :slight_smile:

HypeConditionsLinker.hype.zip (68.3 KB)

5 Likes

Is there a reason you minified the code? Makes it harder to quickly evaluate it. Is this already production ready? I looked at the logic part and I like the use of a setter and a conditional behavior trigger. As discussed, I’d also like to put this in my export script as most people don’t use them anyway I’d leverage the UI possibility. Do you mind if I add something similar to my current development?

1 Like

When I do not fill out the requisite number of answers in a scene there is no verification happening.

1 Like

you mean hitting next before doing the quiz¿ and then there is no notification at the end?

that’s true. every instance assumes all parts to be completely filled.
i should have blocked the next-buttons until its solved … my bad :slight_smile:

though you could bypass this, if you want, by triggering the expected behaviors on the next-button itsself.

anyway, thx for reporting, because it shows the script-intention:
just doing the logic part and let procedure/functionality to the user

////////////

Edit: i replaced link and file. now the next-buttons are disabled until a quiz is done.

2 Likes

it’s been a test of functionality, forgot to switch back … thx, i’ll do so

hey Max, it’s a playground! looking forward to it :slight_smile:

2 Likes

A small light-bulb-game.
Built experiences based on linked conditions without custom scripting.

https://www2.aachener-zeitung.de/zva/karlo/test/light-bulb-game/

light-bulb-game.hype.zip (65.4 KB)

5 Likes

there’s been a question regarding a parental gate that takes three numbers entered in the right order:

Here is a solution using the HypeConditionLinker
https://www2.aachener-zeitung.de/zva/karlo/test/Parental_gate/

This time it’s triggered by a few lines of code. just to show it’s extendable.
Parental_gate.hype.zip (28.8 KB)

///////////////////
Note: added a new feature to the script so that it can test for the right order too. to achieve this just add data-logic-mode-strict -> true as additional data-attribute for the instance. <- just avaiable for “and”-conditions …

https://www2.aachener-zeitung.de/zva/karlo/test/senso/

playground for this evening :slight_smile:

based on HypeConditionLinker.

in englisch it’s been called simon: https://en.wikipedia.org/wiki/Simon_(game)
some of you may remember it :slight_smile:

really not well tested. I’ll rework and post it after the holidays :slight_smile:

3 Likes