pseudo-randomization in OSWeb and setting the underscores of the associated character in SPR
Hi, I am currently designing an opensesame experiment that will later be carried out on Jatos. Now I have encountered two problems. So I am asking for your help here.
1. I have a total of 3 categories of items: category 1 (abbreviated as C1) and category 2 (C2) both contain critical items, but they are different from each other. Category 3 (F) contains the fillers. Now I want to pseudorandomize the items so that the critical items from the same category (C1 or C2) do not appear consecutively. The fillers, on the other hand, can appear one after the other. The possible arrangements are, for example, as follows:
C1-C2-F-C1...
C1-F-C1...
C1-F-F-C1...
How can I implement this pseudo-randomization in OSWeb?
2. The underscores that represent the words that have already been shown or will be shown are not as wide as the characters. That is why the display always jumps back and forth.
The following pictures show the problem:
As you can see, the underscore is shorter than the phrase associated with it.
On another program, the length of the underscore can correspond to that of the character, as in the following screenshot:
Do you have a solution as to how can I adjust the length of the underscore so that it matches the length of the associated character?
I look forward to any advice and thanks a lot in advance!
Lili
Comments
Hi @deandgei ,
Loop constraints are not supported in OSWeb, as you probably noticed. So you need to write a script that applies these constraints for you. The general logic is always the same:
In your case, the constraint boils down to checking whether there are two consecutive conditions that are identical and that are not 'F'. The script below shows how you can do that. This would go in the prepare phase of an
inline_javascript
at the start of the experiment.Then, at the start of each trial, again in the prepare phase of an
inline_javascript
, you simply get the last element from the array and assign it to thecondition
variable, which you can then use in the normal way.Does that make sense?
Regarding the length of the characters: Chinese characters are essentially a monospace font where each character sits in a box of a fixed size. Latin characters are not, and even a monospace Latin font will not be matched in size to Chinese characters. The most pragmatic way to work around this is to use one of the Chinese punctuation characters instead of an underscore, because these are matched in length to the Character boxes. For example, below you can see that the Chinese full stop actually matches the widths of the characters:
Hope this helps!
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi @sebastiaan,
thank you very much for your detailed reply.
I have copied your code in the prepare phase of an inline_javascript at the start of the experiment and also added
vars.condition = vars.conditions.pop()
at the start of each trial in the prepare phase of aninline_javascript
for
loop in theneedsShuffle(conditions)
a little, now it looks like this:for (let i = 0; i <= conditions.length - 1;i++)
After I saved everything, two critical items belong to the same type would still show continuously. I tried to solve this problem these three days, but I can still not figure it out. I am sorry if it is too basic. Could you please help me solve this problem?
This is where I fill my stimulus. In the column "condition", the condition in row 1-10 is "F", row 11 -17 is condition "C1", row 18-25 is condition "C2".
Besides, using one of the Chinese punctuation characters instead of an underscore solves the problem with the display.
Thank you very much for your help! I am looking forward to your advice.
Lili
Hi @deandgei ,
These scripts replace the
condition
column in the block loop (so this column should be removed from new_loop), and the second script should be at the start of each trial, so at the start of trial_sequence_1.Looking at your loop table, your situation is a bit more complex than I initially thought though, because you have a lot of other variables that, I assume, should be kept together with the
condition
variable. Is that right?What you could do is define a slightly more complex array of conditions, where each condition is itself an object with multiple variables (instead of only the name of the condition). For two trials and two variables (
condition
andID
) this would look like this:This would also require a few tweaks to the other scripts. Specifically, you'd have to change
needsShuffle()
so that it compares thecondition
variable only. And you'd need to change the script at the start of the trial so that each variable is assigned to an experimental variable (i.e. as a property of thevars
object). I'll leave that to you to play around with though!— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!