|
Group: Administrators
Posts: 13K,
Visits: 109K
|
+x+xHi, I adapted the Continuous Inclusion of Other in the Self (Continuous IOS) script from the Inquisit test library. However, instead of measuring circle overlap, I would like to measure perceived social distance using draggable dots on a continuous line scale (similar to a slider). Specifically: * In the first part, participants would drag a dot on the right side (representing one identity) along a line to indicate the perceived distance between two identities (measured in millimetres or pixels), while the dot on the left side remains fixed. * In the second part, participants would drag three dots (e.g., self, friend, stranger) on the same line to represent the relative distances between identities. Does anyone know how this could be implemented in Inquisit? Any suggestions would be greatly appreciated! There are plenty of drag and drop examples available in the library as well as in this forum, and measuring distance is trivial and has also been discussed here many times (e.g. https://forums.millisecond.com/Topic22122.aspx , https://forums.millisecond.com/Topic33516.aspx, https://forums.millisecond.com/Topic32322.aspx ). So, what part are you struggling with concretely? Maybe start with working up a small demo for part 1 ("In the first part, participants would drag a dot on the right side (representing one identity) along a line to indicate the perceived distance between two identities (measured in millimetres or pixels), while the dot on the left side remains fixed.") and once you have that running, expand from there. A simple example: Place three dots anywhere on the line, calculate the distances when done. <defaults> / canvasAspectRatio = (4,3) </defaults>
<script> // function to calculate the euclidean distance between two points function calculateDistance(x1, y1, x2, y2) { let deltaX = x2 - x1; let deltaY = y2 - y1; return Math.sqrt(deltaX ** 2 + deltaY ** 2) } </script>
<values> / dotFriendPositioned = false / dotSelfPositioned = false / dotStrangerPositioned = false
/ distanceSelfFriend = "n/a" / distanceSelfStranger = "n/a" </values>
<block myBlock> / trials = [1=startThreeDots] </block>
<trial startThreeDots> / onTrialBegin = { // reset dots to their starting positions shape.dotFriend.hPosition = 60%; shape.dotFriend.vPosition = 40% ; shape.dotSelf.hPosition = 50%; shape.dotSelf.vPosition = 40%; shape.dotStranger.hPosition = 40%; shape.dotStranger.vPosition = 40%; // dots have not been positioned yet values.dotFriendPositioned = false; values.dotSelfPositioned = false; values.dotStrangerPositioned = false; // reset distances from previous round values.distanceSelfFriend = "n/a"; values.distanceSelfStranger = "n/a"; } / stimulusFrames = [1=clearScreen] / trialDuration = 0 / inputDevice = mouse / validResponse = (noResponse) / branch = { return trial.positionThreeDots } / recordData = false </trial>
// <trial positionThreeDots> / onTrialBegin = { // if any of the dots hasn't been positioned yet if (!values.dotFriendPositioned || !values.dotSelfPositioned || !values.dotStrangerPositioned) { button.doneButton.skip = true; // don't show the done button } else { button.doneButton.skip = false; // otherwise show it } } / onTrialEnd = { // if a given dot has been positioned, set its position flag to true if (this.lastDropSource == "dotFriend") { values.dotFriendPositioned = true; }; if (this.lastDropSource == "dotSelf") { values.dotSelfPositioned = true; }; if (this.lastDropSource == "dotStranger") { values.dotStrangerPositioned = true; }; } / stimulusFrames = [1=clearScreen, line, dotFriend, dotSelf, dotStranger, doneButton, debug] / inputDevice = dragDrop / validResponse = (line, doneButton) / recordData = false / branch = { // if participants says they're done positioning if (this.response == "doneButton" && values.dotFriendPositioned && values.dotSelfPositioned && values.dotStrangerPositioned) { return trial.endThreeDots // go to the end trial } else { return trial.positionThreeDots // otherwise keep positioning } } </trial>
<trial endThreeDots> / onTrialBegin = { // calculate distance between the placed dots values.distanceSelfFriend = display.getMMX(calculateDistance(shape.dotSelf.xPx, shape.dotSelf.yPx, shape.dotFriend.xPx, shape.dotFriend.yPx)); values.distanceSelfStranger = display.getMMX(calculateDistance(shape.dotSelf.xPx, shape.dotSelf.yPx, shape.dotStranger.xPx, shape.dotStranger.yPx)); } / stimulusFrames = [1=clearScreen, line, dotFriend, dotSelf, dotStranger, debug] / inputDevice = mouse / validResponse = (lButtonDown) </trial>
<shape line> / shape = rectangle / size = (90%, 2%) / color = black / erase = false / dropTarget = true / hPosition = 50% / vPosition = 60% / dropPosition = (anywhere, shape.line.vPosition) </shape>
<shape dotStranger> / shape = circle / size = (display.getPixelsY(0.01*display.canvasHeight), display.getPixelsY(0.01*display.canvasHeight)) / color = red / erase = false / hPosition = / dropSource = true / position = (40%, 40%) </shape>
<shape dotFriend> / shape = circle / size = (display.getPixelsY(0.01*display.canvasHeight), display.getPixelsY(0.01*display.canvasHeight)) / color = green / erase = false / dropSource = true / position = (60%, 40%) </shape>
<shape dotSelf> / shape = circle / size = (display.getPixelsY(0.01*display.canvasHeight), display.getPixelsY(0.01*display.canvasHeight)) / color = blue / erase = false / dropSource = true / position = (50%, 40%) </shape>
<button doneButton> / caption = "Done" / fontStyle = ("Arial", 4%, true) / erase = false / size = (25%, 10%) / position = (50%, 90%) </button>
<text debug> / items = (" Self Positioned = <%values.dotSelfPositioned%> Friend Positioned = <%values.dotFriendPositioned%> Stranger Positioned = <%values.dotStrangerPositioned%>
Distance Self - Friend = <%values.distanceSelfFriend%> Distance Self - Stranger = <%values.distanceSelfStranger%>") / erase = false / position = (50%,10%) </text>
|
|
Group: Administrators
Posts: 13K,
Visits: 109K
|
+xHi, I adapted the Continuous Inclusion of Other in the Self (Continuous IOS) script from the Inquisit test library. However, instead of measuring circle overlap, I would like to measure perceived social distance using draggable dots on a continuous line scale (similar to a slider). Specifically: * In the first part, participants would drag a dot on the right side (representing one identity) along a line to indicate the perceived distance between two identities (measured in millimetres or pixels), while the dot on the left side remains fixed. * In the second part, participants would drag three dots (e.g., self, friend, stranger) on the same line to represent the relative distances between identities. Does anyone know how this could be implemented in Inquisit? Any suggestions would be greatly appreciated! There are plenty of drag and drop examples available in the library as well as in this forum, and measuring distance is trivial and has also been discussed here many times (e.g. https://forums.millisecond.com/Topic22122.aspx , https://forums.millisecond.com/Topic33516.aspx, https://forums.millisecond.com/Topic32322.aspx ). So, what part are you struggling with concretely? Maybe start with working up a small demo for part 1 ("In the first part, participants would drag a dot on the right side (representing one identity) along a line to indicate the perceived distance between two identities (measured in millimetres or pixels), while the dot on the left side remains fixed.") and once you have that running, expand from there.
|
|
Group: Forum Members
Posts: 20,
Visits: 354
|
Hi,
I adapted the Continuous Inclusion of Other in the Self (Continuous IOS) script from the Inquisit test library. However, instead of measuring circle overlap, I would like to measure perceived social distance using draggable dots on a continuous line scale (similar to a slider).
Specifically: * In the first part, participants would drag a dot on the right side (representing one identity) along a line to indicate the perceived distance between two identities (measured in millimetres or pixels), while the dot on the left side remains fixed. * In the second part, participants would drag three dots (e.g., self, friend, stranger) on the same line to represent the relative distances between identities.
Does anyone know how this could be implemented in Inquisit? Any suggestions would be greatly appreciated!
|