A few drag and drop queries

1) Is it possible to prevent an item from being dragged again after it has been placed into the correct drop target? I tried to set the state of the drag item to disabled, but I can still drag the item.

 

2) Is it possible to detect whether a drop target has been "occupied" by a drag target or not? I want to have an interaction occur if the player removes a drag target from a drop target, but have no idea how to do it.

 

3) Is it possible to have an interaction occur whenever a drag target is dropped on anything outside of specific drop targets? I originally thought to use "When the user drops object on the target" and selecting everything but the valid drop targets, but I realized that it doesn't activate if I just drop it on "white space" that is not occupied by any objects.

8 Replies
Maria Costa-Stienstra

Hi, Edmond.

The community will be the best place to get help with design questions! If you share your .story file here, I'm sure our talented members will be able to offer suggestions for your scenario. 

I wanted to share a few resources that might also give you some inspiration and steps to try:

I hope this helps!

Edmond Tan

Hi Maria.

 

I looked through the links and it doesn't solve the problems I have. I saw a few interesting workarounds that my client may or may not be satisfied with (client has not gotten back to me as of this reply), so I'll thank you for sharing that, but my initial problems remains.

 

I'm not sharing a storyline file because I am working with potentially sensitive information and don't want to get into legal trouble. I was just planning on just starting a new project and getting guidance from there if people agreed to a screen share.

Walt Hamilton

#1. Remember, this is a visual medium. Nothing has to do what you want it to, it only has to look like it is doing it. In this case, when the item is dropped, it disappears - therefore it can't be dragged again. The target changes to look like the item is dropped on it, so all is well. One way to do this is to create a state for the target that has the item dropped on it. When the item is dropped, change it to hidden, and change the state of the target to the "correct drop" state. This probably will mess up the regular submit and check process, so you may have to copy the Hidden state and name it "Drop Correct"

#2. Put a shape immediately behind the target. Make it filled (or it won't register actions), transparency set to 95% or greater (to make it invisible), and larger than the target (so it will register even if the learner drags it fast). Tie your interaction to the item being dragged over the shape. (Perform interaction when item is dragged over shape.) The action will also occur when the shape is dragged onto the target, so depending on what the action is, it might cause problems. If so, set it up so the action takes place only if the item has been dropped.

1. Create a variable named something like "ItemIsDropped". Make it T/F, with a default value of false

2. Change the trigger to "Perform action when item is dragged over shape, if ItemIsDropped = true"

3. Create a trigger "Adjust variable set ItemIsDropped to true when item is dropped on target"

4. Create a trigger "Adjust variable set ItemIsDropped to false when item is dropped outside of target"

#3. Create an invisible shape like in step two, but large enough to cover all the white space. Place it on the timeline below the drag items, drag targets, and the shape in step 2, if you are using them together. Place it so it is above everything the item can be dropped on outside the specific drop targets. Create a trigger "Perform interaction when item is dropped on shape." 

In this case, you would use variables to tell SL if an object has been dropped on a specific target, which is something it wouldn't otherwise know. Use variables to tell the program what happened somewhere else, or that it can't normally know, like the following example.

I got home last night, and the cat insisted he had not been fed all day, and was STARVING. I hadn't been there all day, so I didn't know, and my wife was off to her quilting party, so I couldn't ask her. Fortunately, she left a note on the counter that said "I fed the cat", so I knew not to feed him again.
 
The note she left me is the variable. I couldn't see her feed the cat, but I could see the note and know what went on while I was gone. Storyline is just like I was. One slide has no way of knowing what happens on another slide, but it can read a message left for it in a variable, and know what the learner did on another slide, provided you, the developer used those actions on that other slide to change the contents of a variable.
 
The cat got pretty insistent, so I gave him a snack, crossed out her message, and wrote, "He's also had a bedtime snack", and went to my meeting.
 
The note is the variable. Everybody can see it, and it never changes unless you, the author, create a trigger to change it.
 
My wife is getting older (I'm not, just she), and takes a bunch of medicines. She puts them in one of those little plastic gadgets with seven boxes. Every night, (if she remembers :) ) she looks in the box for that day. If it is empty, she knows she has taken her pills that day.
 
The pill box is the variable. She can't always remember everything, but if the box has pills in it, she knows to take them. 
 
Variables are designed to be seen everywhere, but not heard (much like small children of a previous generation).  SL cannot multi-task, so only one slide at a time can be active. SL has no memory, so when a slide  becomes active, it can't know what went on while it was hibernating. That's why variables were invented.  Each slide can look at the note (variable) and by seeing what is on there now, it can know what went on somewhere else, or some other time. I couldn't hear my wife write the note, but I can read it and know what went on at home while I was not there.