I’m trying to create a Drag and Drop question scene. I’ve got 4 DropTarget objects and 4 Drag objects.
On the Drop object, I set a variable “CurrentAnswer.”
When I drop one of the drag targets onto it, I update that target with the name of the Drag object I dropped.
So, if I have previously dropped Drag1 onto Drop1, the value of Drop1.currentAnswer is “Drag1”
If I then decide to drop Drag2 onto Drop1, I want to be able to send Drag1 back to start. But I’d rather not have to care WHICH drag was there, just be able to use a variable as a path. So instead of :
Tween the position of Drag1 to x: Drag1.Originalx() …What I’d rather be able to do is :
Tween the position of [Drop1.currentAnswer] to x: [Drop1.currentAnswer].OriginalX()…
Then I wouldn’t have to write separate conditions for each drag object and it could be more generic.
And while I’m asking about variables… How the heck do you check to see if two string variables have the same value? EDIT: Disregard this last question. I got the part figured out. Still haven’t figured out a way to address the main issue about using a variable as a path/parameter in an action.
Go to other condition tab - < advanced
I appreciate the answer. I hadn’t seen that option. But it still doesn’t seem to be working correctly. Here’s what I’ve got:
When I run in debug mode, I can see the value of the two variables. I can see that the default value of “currentAnswer” is set to “0” and the value of “correctAnswer” is set to “Drag1”. They are clearly NOT equal. But the animation still remains on the “Correct” animation. And as I update that variable, the animation never changes.
Though I noticed a couple of suspicious things…
If I change the order, such that the one checking for a value of "0: is at the end, then that one is the one that stays triggered. And looking at the debug it shows the variables as “instance variables” even though the action I’m using is supposed to be setting “object variable.” So I suspect that somehow I’m not getting the variable I think I’m getting. But I don’t know why.
I just don’t see how the heck it’s evaluating this as true:
currentAnswer a string? In that case the problem is you’re checking for the wrong variable type.
Here is your expression:
When it should be:
That would also explain why it’s returning
So an example event with
Compare two strings would be:
Drop1.VariableString(currentAnswer) = Drop1.VariableString(correctAnswer)
Set animation of CorrectCheck1 to "Corrrect"
Yes. This was the correct answer I figured out just a little while ago. Using the built in tools, it kept trying to do that ToString. I had to manually edit it to use VariableString.
Now if only I could figure out an answer for using something like a variable in a path. Or even a way to reference the objects identified in the Condition side and specify that as the object I want to affect in the actions side.
You’re checking the answer variable of Drop1 against the answer variable of Drop1 (i.e. against itself). I think one of them needs to be Drag1 instead…
Then what you need to do is a variable comparison, not a string comparison. Among the conditions is
Text of an object variable. Select the object and object variable you’d like to test. This way, it will only affect the object that matches your condition. Like this:
No, I was checking it against a different variable on itself (correct vs current). But I already got that part sorted out. It was because the tool kept resorting to a Variable() check, and I had to manually change it to a VariableString() check like OongusBoongus said.