Selecting an item causes havoc


Author
Message
NicoB
NicoB
New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)
Group: Forum Members
Posts: 7, Visits: 11
Dear Members,
I recently ran into trouble trying to assign multiple elements of a certain index of an item (eg. 5,6,7 and 8) to elements in my trial.
My goal is to get a random number and then present the picture at that (and exactly that) index as well as the 3 following.
To make a many hour story short, selecting an item at an index seems to cause some sort of havoc to the items, making it impossible for me to select the items I need.
I boiled the problem down a bit and my question is the following: Is there any way to access the item at the index on every trial.


<list fragen>
/ poolsize = 4
/ selectionmode = random
/ itemprobabilities = uniform
</list>

<item auswahl1>
/ 1 = "1"
/ 2 = "2"
/ 3 = "3"
/ 4 = "4"
</item>

<text t1>
/ items = auswahl1
</text>

<trial t1>
/ ontrialbegin = [
   
    //alternative 1, was actually a mistake but gives me at least 4 distinct values (however, not same as index)
    //text.t1.setitem(item.auswahl1.item((list.Fragen_SuR.nextindex), 1));
   
    //alternative 2, doesn't always even give me 4 distinct values
    //text.t1.setitem(item.auswahl1.item(list.Fragen_SuR.nextindex), 1);

   //One seemingly doesnt even need the 1, though removing has no effect either
    //text.t1.setitem(item.auswahl1.item(list.Fragen_SuR.nextindex));
    //text.t1.setitem(item.auswahl1.item((list.Fragen_SuR.nextindex)));

   // I tried items.auswahl1.reset(); as well as text.t1.resetselection();, neither seems to help
]
/ stimulusframes = [1 = t1]
/ inputdevice = mouse
/ validresponse = (text.t1)
</trial>

<block tr>
/ trials = [1-4 = t1]
</block>


I hope this question hasn't been asked yet, I, for my part, was unable to find an answer.

Dave
Dave
Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)
Group: Administrators
Posts: 11K, Visits: 71K
NicoB - 7/20/2021
Dear Members,
I recently ran into trouble trying to assign multiple elements of a certain index of an item (eg. 5,6,7 and 8) to elements in my trial.
My goal is to get a random number and then present the picture at that (and exactly that) index as well as the 3 following.
To make a many hour story short, selecting an item at an index seems to cause some sort of havoc to the items, making it impossible for me to select the items I need.
I boiled the problem down a bit and my question is the following: Is there any way to access the item at the index on every trial.


<list fragen>
/ poolsize = 4
/ selectionmode = random
/ itemprobabilities = uniform
</list>

<item auswahl1>
/ 1 = "1"
/ 2 = "2"
/ 3 = "3"
/ 4 = "4"
</item>

<text t1>
/ items = auswahl1
</text>

<trial t1>
/ ontrialbegin = [
   
    //alternative 1, was actually a mistake but gives me at least 4 distinct values (however, not same as index)
    //text.t1.setitem(item.auswahl1.item((list.Fragen_SuR.nextindex), 1));
   
    //alternative 2, doesn't always even give me 4 distinct values
    //text.t1.setitem(item.auswahl1.item(list.Fragen_SuR.nextindex), 1);

   //One seemingly doesnt even need the 1, though removing has no effect either
    //text.t1.setitem(item.auswahl1.item(list.Fragen_SuR.nextindex));
    //text.t1.setitem(item.auswahl1.item((list.Fragen_SuR.nextindex)));

   // I tried items.auswahl1.reset(); as well as text.t1.resetselection();, neither seems to help
]
/ stimulusframes = [1 = t1]
/ inputdevice = mouse
/ validresponse = (text.t1)
</trial>

<block tr>
/ trials = [1-4 = t1]
</block>


I hope this question hasn't been asked yet, I, for my part, was unable to find an answer.

Completely unclear to me what the example code you provided is supposed to do in the first place. Please provide a clearer explanation of what exactly you want to do.
Dave
Dave
Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)
Group: Administrators
Posts: 11K, Visits: 71K
Dave - 7/20/2021
NicoB - 7/20/2021
Dear Members,
I recently ran into trouble trying to assign multiple elements of a certain index of an item (eg. 5,6,7 and 8) to elements in my trial.
My goal is to get a random number and then present the picture at that (and exactly that) index as well as the 3 following.
To make a many hour story short, selecting an item at an index seems to cause some sort of havoc to the items, making it impossible for me to select the items I need.
I boiled the problem down a bit and my question is the following: Is there any way to access the item at the index on every trial.


<list fragen>
/ poolsize = 4
/ selectionmode = random
/ itemprobabilities = uniform
</list>

<item auswahl1>
/ 1 = "1"
/ 2 = "2"
/ 3 = "3"
/ 4 = "4"
</item>

<text t1>
/ items = auswahl1
</text>

<trial t1>
/ ontrialbegin = [
   
    //alternative 1, was actually a mistake but gives me at least 4 distinct values (however, not same as index)
    //text.t1.setitem(item.auswahl1.item((list.Fragen_SuR.nextindex), 1));
   
    //alternative 2, doesn't always even give me 4 distinct values
    //text.t1.setitem(item.auswahl1.item(list.Fragen_SuR.nextindex), 1);

   //One seemingly doesnt even need the 1, though removing has no effect either
    //text.t1.setitem(item.auswahl1.item(list.Fragen_SuR.nextindex));
    //text.t1.setitem(item.auswahl1.item((list.Fragen_SuR.nextindex)));

   // I tried items.auswahl1.reset(); as well as text.t1.resetselection();, neither seems to help
]
/ stimulusframes = [1 = t1]
/ inputdevice = mouse
/ validresponse = (text.t1)
</trial>

<block tr>
/ trials = [1-4 = t1]
</block>


I hope this question hasn't been asked yet, I, for my part, was unable to find an answer.

Completely unclear to me what the example code you provided is supposed to do in the first place. Please provide a clearer explanation of what exactly you want to do.

That said, there are a couple of problems and mistakes here:

(1)

<text t1>
/ items = auswahl1
</text>

selects from its items (the four in <item auswahl1> randomly without replacement. That's the default if you do not explicitly specify any other selection behavior. Consequence:
Just because you set the 1st item to something else via some /ontrialbegin logic, does not mean the 1st item will be randomly selected in that instance of the trial.

(2) The fundamental problem with all of these approachses is that you are changing which item is at which index throughout.

//alternative 1, was actually a mistake but gives me at least 4 distinct values (however, not same as index)
  //text.t1.setitem(item.auswahl1.item((list.Fragen_SuR.nextindex), 1));
 
  //alternative 2, doesn't always even give me 4 distinct values
  //text.t1.setitem(item.auswahl1.item(list.Fragen_SuR.nextindex), 1);

 //One seemingly doesnt even need the 1, though removing has no effect either
  //text.t1.setitem(item.auswahl1.item(list.Fragen_SuR.nextindex));
  //text.t1.setitem(item.auswahl1.item((list.Fragen_SuR.nextindex)));


Take

//text.t1.setitem(item.auswahl1.item((list.Fragen_SuR.nextindex), 1));


You pull a random integer between 1 and 4 from the list, let's say that integer is 3 on the first trial.
Then you set the text's 1st item to the item residing at that index. Now you effecitvely have changed

<item auswahl1>
/ 1 = "1"
/ 2 = "2"
/ 3 = "3"
/ 4 = "4"
</item>

to

<item auswahl1>
/ 1 = "3"
/ 2 = "2"
/ 3 = "3"
/ 4 = "4"
</item>

and so forth.

Edited Last Month by Dave
NicoB
NicoB
New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)
Group: Forum Members
Posts: 7, Visits: 11

Thanks Dave, your reply has already helped me quite a lot in grasping some of my mistakes.
However, as I am still unable to solve my problem, I shall do my best in trying to rephrase it.

In my /ontrialbegin logic I want to (essentially) select an item for my stimulus at a specific index of my <item auswahl1> in order to be presented on the screen during the trial. As I want to repeat that trial multiple times (always with an item at a different index), Therefore I am not interested in, which is to say that I try to avoid mucking up the order of my <item auswahl1>.
There are certainly easier ways to accomplish this result in the example I have given you, but I fear that the logic of my main programm requires me to accomplish it this way (this way meaning changing the selected item of my stimulus in /ontrialbegin).
In other words, in an ideal world I would like to run /select = ... for my stimulus in /ontrialbegin.

One scenario for my exemplary code:
1. trial: I want the value at index 1                => displays 1
2. trial: I want the value at index 4                => displays 4               
3. trial: I want the value at index 3                => displays 3
4. trial: I want the value at index 2               => displays 2

I very much hope I managed to expressed myself more clearly this time.


NicoB
NicoB
New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)
Group: Forum Members
Posts: 7, Visits: 11
NicoB - 7/20/2021

Thanks Dave, your reply has already helped me quite a lot in grasping some of my mistakes.
However, as I am still unable to solve my problem, I shall do my best in trying to rephrase it.

In my /ontrialbegin logic I want to (essentially) select an item for my stimulus at a specific index of my <item auswahl1> in order to be presented on the screen during the trial. As I want to repeat that trial multiple times (always with an item at a different index), Therefore I am not interested in, which is to say that I try to avoid mucking up the order of my <item auswahl1>.
There are certainly easier ways to accomplish this result in the example I have given you, but I fear that the logic of my main programm requires me to accomplish it this way (this way meaning changing the selected item of my stimulus in /ontrialbegin).
In other words, in an ideal world I would like to run /select = ... for my stimulus in /ontrialbegin.

One scenario for my exemplary code:
1. trial: I want the value at index 1                => displays 1
2. trial: I want the value at index 4                => displays 4               
3. trial: I want the value at index 3                => displays 3
4. trial: I want the value at index 2               => displays 2

I very much hope I managed to expressed myself more clearly this time.

"Changing the selected item of a stimulus in /ontrialbegin" would have made for a far better title as well.....

Dave
Dave
Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)Supreme Being (950K reputation)
Group: Administrators
Posts: 11K, Visits: 71K
NicoB - 7/20/2021
NicoB - 7/20/2021

Thanks Dave, your reply has already helped me quite a lot in grasping some of my mistakes.
However, as I am still unable to solve my problem, I shall do my best in trying to rephrase it.

In my /ontrialbegin logic I want to (essentially) select an item for my stimulus at a specific index of my <item auswahl1> in order to be presented on the screen during the trial. As I want to repeat that trial multiple times (always with an item at a different index), Therefore I am not interested in, which is to say that I try to avoid mucking up the order of my <item auswahl1>.
There are certainly easier ways to accomplish this result in the example I have given you, but I fear that the logic of my main programm requires me to accomplish it this way (this way meaning changing the selected item of my stimulus in /ontrialbegin).
In other words, in an ideal world I would like to run /select = ... for my stimulus in /ontrialbegin.

One scenario for my exemplary code:
1. trial: I want the value at index 1                => displays 1
2. trial: I want the value at index 4                => displays 4               
3. trial: I want the value at index 3                => displays 3
4. trial: I want the value at index 2               => displays 2

I very much hope I managed to expressed myself more clearly this time.

"Changing the selected item of a stimulus in /ontrialbegin" would have made for a far better title as well.....

Why don't you simply do:

<list fragen>
/ poolsize = 4
/ selectionmode = random
</list>

<item auswahl1>
/ 1 = "A"
/ 2 = "B"
/ 3 = "C"
/ 4 = "D"
</item>

<values>
/ myindex = 1
</values>

<text t1>
/ items = auswahl1
/ select = values.myindex
</text>

<trial t1>
/ ontrialbegin = [
    values.myindex = list.fragen.nextindex;
]
/ stimulusframes = [1 = t1]
/ inputdevice = mouse
/ validresponse = (text.t1)
</trial>

<block tr>
/ trials = [1-4 = t1]
</block>

NicoB
NicoB
New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)New Member (30 reputation)
Group: Forum Members
Posts: 7, Visits: 11
Dave - 7/20/2021
NicoB - 7/20/2021
NicoB - 7/20/2021

Thanks Dave, your reply has already helped me quite a lot in grasping some of my mistakes.
However, as I am still unable to solve my problem, I shall do my best in trying to rephrase it.

In my /ontrialbegin logic I want to (essentially) select an item for my stimulus at a specific index of my <item auswahl1> in order to be presented on the screen during the trial. As I want to repeat that trial multiple times (always with an item at a different index), Therefore I am not interested in, which is to say that I try to avoid mucking up the order of my <item auswahl1>.
There are certainly easier ways to accomplish this result in the example I have given you, but I fear that the logic of my main programm requires me to accomplish it this way (this way meaning changing the selected item of my stimulus in /ontrialbegin).
In other words, in an ideal world I would like to run /select = ... for my stimulus in /ontrialbegin.

One scenario for my exemplary code:
1. trial: I want the value at index 1                => displays 1
2. trial: I want the value at index 4                => displays 4               
3. trial: I want the value at index 3                => displays 3
4. trial: I want the value at index 2               => displays 2

I very much hope I managed to expressed myself more clearly this time.

"Changing the selected item of a stimulus in /ontrialbegin" would have made for a far better title as well.....

Why don't you simply do:

<list fragen>
/ poolsize = 4
/ selectionmode = random
</list>

<item auswahl1>
/ 1 = "A"
/ 2 = "B"
/ 3 = "C"
/ 4 = "D"
</item>

<values>
/ myindex = 1
</values>

<text t1>
/ items = auswahl1
/ select = values.myindex
</text>

<trial t1>
/ ontrialbegin = [
    values.myindex = list.fragen.nextindex;
]
/ stimulusframes = [1 = t1]
/ inputdevice = mouse
/ validresponse = (text.t1)
</trial>

<block tr>
/ trials = [1-4 = t1]
</block>

I am ashamed to admit that I just didn't think of it. 
Thank you very much Dave!

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search