HELP - Storyline 360 - Adjusting a Variable on Button State Change

Jan 22, 2019

SUMMARY: I can't work out how to change a variable when a button changes its state back to normal after getting bumped in a Drag-and-Drop interaction.

 

I am trying to set up a Drag-and-Drop interaction that auto-submits once all of the selections have been dragged and dropped.

This is a fairly simple interaction, as long as I limit the functionality of the interaction - like disabling a button once it's dropped, so that the user can't change their selection. However, I need a complex and dynamic interaction for my users.

My solution for this has been:

  • Create a Boolean variable on each selection that assigns value to 1/True when dropped on the hotspots.
  • Created a variable (lets call it Var_Count) that gets 1 added to it when the selection variables are 1/True; and gets 1 subtracted when the selection variables are 0/False (if they were previously 1/True).
  • Created a variable (Var_Check) that tracks whether Var_Count has reached a value that equals the amount of selections that can be made and, if so, submits the Drag and Drop interaction - triggering the Incorrect or Correct result layers.

This largely works. Where it breaks down is when the user drags a selection off the answer hot spots (and it snaps back to it's start position) or if the user bumps a selection back to the start position by dropping a second selection on to it.

I have found a solution to the manually dragging it back - an On Intersect interaction with a "Start Position" Hot Spot, that assigns each selection's variable a 0/False. This prevents the Var_Count from hitting the Var_Check value when a selection is not in an answer position.

The part I can't crack though is when a selection is bumped back to the start position.

I can't find any triggerable way of knowing that a selection has been bumped to the start position. A bumped selection doesn't interact with an On Intersect trigger, nor does it with the Object Dragged Over or Object Dropped On, or any others that I could find.

The only thing that I've been able to think of is having the selection variable change with a state change, which luckily for me does happen on a bump.

As default behaviour, a shape/button selection will change from it's Drop Correct/Drop Incorrect states to its Normal state when bumped back to its start position. However, no matter what I do, I can not for the life of me get a variable to change when the selection object's state is set to Normal on a bump.

Hell, I can't get a variable to change reliably on a regular old button. I just tested a button with 2 of the default states, Normal and Selected, and set the button's initial state to Selected. On the slide I have a slide trigger that sets variable StateOfButton equal to False when the timeline starts. On the button I have a trigger that sets StateOfButton equal to True when the state of the button is Normal.

On testing, the scene starts with the variable set to True. Even though I've used a slide trigger to explicitly set it to False and I've explicitly set the button's initial state to be Selected.

I don't get it and I've burned out on this challenge, for now.

Anyone with fresh eyes able to help out?

Thank you.

7 Replies
Leslie McKerchie

Hello Tyler,

Thanks for reaching out and sharing the details on what you are seeing in your course.

With your permission, I'd like to take a look at your project file to investigate what's happening. You can share it publicly here (which will allow some community eyes as well), or send it to me privately by uploading it here. I'll delete it when I'm done troubleshooting.

Tyler Sabourin

OK, here is the cleaned up story file of my project. The first slide is set up like my example in my initial post (I had to remake it as I had ripped apart my working file trying to find a solution). The second slide was my attempt and showing the behaviour of what's happening during a bump in a Drag-and-Drop interaction.

So, Slide 1 has a Drag-and-Drop interaction with 4 buttons, each with an associated number variable - POI1-4. These variables are initially set to 0. They are set to 1 when dropped onto an answer hot spot and are set to 0 when dragged off of the answer hot spots (through an intersect trigger with a hot spot in the button start area).

There is a number variable called POI_Count that increases by 1 whenever a POI# changes to 1, and decreases by 1 whenever a POI# changes to 0.

There is a number variable called POI_Check that is set to 1 when POI_Count reaches 4. It then submits the Drag-and-Drop interaction.

This interaction works when dragging buttons onto and off of the answer hot spots, but it doesn't work when a button gets bumped.

I have set up a trigger on Button 1 to set POI1 to 0 when the state of Button1 = Normal, but that doesn't work.

Any ideas on how I can track whether a button has been bumped?

Thanks,
Tyler

Tyler Sabourin

Hi Leslie, I've emailed back to support, but I think my response to them might help other people that may be having the same issue as me so I'm going to share it here. I also solved my issue, through a rather ... interesting work around - which I will share with a post a bit later.

------

In a Drag-and-Drop interaction, users have the ability to drop an object onto another object - this results in the initial object getting "bumped" back to its start position, switching from whichever state it was in (either a user-set state or the built in Drop Correct or Drop Incorrect states) to its Normal state.

This state change cannot be used as a trigger however.

Whatever the mechanics of the "bump" are, it seems to change the state of the object in look only and will still project itself as its previous state. This can be seen on my second slide when "Selection 2" gets bumped, the variables tracking its states don't update - they stay either as Drop Correct = True, or Drop Incorrect = True.

Now this may be an issue exclusive to "bumping," but through some other testing I believe that there is a fundamental problem with the Normal state. 

A simple test is to make a shape or button with 2 states: The built-in Normal and Selected states. Identify the states through different colours or labels, and then set up a few variables and triggers:

T/F Variable - IsNormal
T/F Variable - IsSelected

Set IsNormal equal to True, When the state of Rectangle 1 - "... is Normal
Set IsSelected equal to True, When the state of Rectangle 1 - "... is Selected
Set IsNormal equal to False, When the state of Rectangle 1 - "... not Normal
Set IsSelected equal to False, When the state of Rectangle 1 - "... not Selected

Preview that slide and you will see that IsNormal never changes to False. IsSelected works as expected, switching to True when the rectangle is selected and changing to False when it is not. But IsNormal doesn't... my guess is that the Normal state is set to exclusively stay on and the only way to get the Normal state to turn off is by setting it to disabled... but that's just a guess, as I haven't tested it.

 Good luck with tracking this down. It's a particularly frustrating thing to have to work with.

Tyler Sabourin

So, I managed to solve my issue with a workaround that skips trying to track the Normal states of my objects (which I believe is not working as intended, as shown in my previous post).

The solution was to add a “Trigger” layer – a layer with a timeline of 0.25 seconds and an invisible box – which would run through a series of triggers and then either submit the Drag-and-Drop interaction or hide the layer.

On the base layer, each selection object was given a trigger to show Layer-Trigger when dropped onto one of the answer hotspots.

The triggers on Layer-Trigger are:

Set PIO# equal to 0
                When the Timeline starts
                If Button# - “...”’s state is not Drop Correct
                AND Button# “...”’s state is not Drop Incorrect

(With a copy of this trigger for each selection button you have.)

Set PIO_Check equal to 0
                When the timeline starts
                If PIO# is equal to 0
                etc...

Submit interaction Drag and Drop
                When the timeline starts
                If PIO_Check is equal to 1

Hide layer this layer
                When the timeline ends

The reason that the PIO# triggers have the two clauses instead of one “state is not Normal” is because that detection just doesn’t work. You can only get around it by explicitly saying which exact states the button is not – in this case, not Drop Correct or Drop Incorrect.

And then the Set PIO_Check = 0 trigger is a workaround for how the triggers are affecting the variables on the base layer.

One thing I found is that when you had three selections on answer hotspot and then bumped one of them, even though the PIO_Count would display as remaining at 3 (because when selections get bumped their variable gets set to 0 and PIO_Count subtracts 1 from their value, but the new selection would add 1 to PIO_Count) it would still trigger PIO_Check to change to 1, because for a split second PIO_Count was actually 4.

So, the PIO_Check=0 trigger preempts that behaviour by saying “Hey, if any of those objects have been bumped, set me to 0.”

This has solved my issue. I can now allow my users to change their answers around however much they want through either bumping or dragging off the answer hotspots and then automatically submit the interaction once all selections have been dropped onto answer hotspots.

It’s a logically-sound, though laborious, way of making it work, but it works.

I’ve attached my story file so that you can check it out :)

Tyler

This discussion is closed. You can start a new discussion or contact Articulate Support.