Millisecond Forums

Inquisit 4 to Inquisit 3

https://forums.millisecond.com/Topic19007.aspx

By nonamenick - 5/3/2016

So I wrote the script for my experiment in Inquisit 4 but for the purpose of the lab it must also be compatible with Inqusist 3. After opening my experiment in Inquisit 3, I get a number of errors regarding the pictures I have in the script. 

It has trouble finding them, however, it works fine in Inqusit 4. All the pictures are in .jpg form and are located in the same file as the experiment. 

Here is an example of some script:

<picture risk_slides>
/items = ("1#5#13.jpg","1#8#13.jpg","1#20#13.jpg","1#50#13.jpg","1#125#13.jpg",
"1#5#25.jpg","1#8#25.jpg","1#20#25.jpg","1#50#25.jpg","1#125#25.jpg",
"1#5#38.jpg","1#8#38.jpg","1#20#38.jpg","1#50#38.jpg","1#125#38.jpg",
"1#5#50.jpg","1#8#50.jpg","1#20#50.jpg","1#50#50.jpg","1#125#50.jpg",
"1#5#75.jpg","1#8#75.jpg","1#20#75.jpg","1#50#75.jpg","1#125#75.jpg",)
/ size = (82%, 82%)
/ select = list.slidevalues.currentindex
</picture>

There are a few of these item lists for different pictures. There are also errors involving the list.slidevalues.currentindex, however, I think that is just an issue with the program not being able to find the pictures.

Any help would be much appreciated. 

Thanks

Nick
By Dave - 5/3/2016

There are no <list> elements in Inquisit 3 syntax. <list> elements were introduced in Inquisit 4. You need to replace them with the Inquisit 3 predecessor: <counter> elements.
By nonamenick - 5/3/2016

Oh. Ok. I use the list function quite a bit. I use it to pair up two different numbers with each picture (A winning amount and a winning percentage)

<list slidevalues>
/ items = (5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125)
/selectionmode = random
</list>

<list slideprob>
/ items = (13, 13, 13, 13, 13, 25, 25, 25, 25, 25, 38, 38, 38, 38, 38, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75)
/selectionmode = list.slidevalues.currentindex
</list>

I could not find anything on counters in the language reference, and simply replacing all the "list" language with counters did not work. Is there a certain way to pair these numbers with these pictures using the counter function?
By Dave - 5/3/2016

<counter> elements are covered in the Inquisit 4 language reference in the Inquisit 4 documentation; a better place to look is the Inquisit 3 documentation. I would in addition recommend (re-)writing / modifying your script using Inquisit 3 if that's the version you are ultimately going to use / collect data with. In addition, hundreds of examples using <counter> elements are available in the Inquisit 3 section of this forum: https://www.millisecond.com/forums/Forum12.aspx

The equivalent to

<list slidevalues>
/ items = (5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125)
/selectionmode = random
</list>

<list slideprob>
/ items = (13, 13, 13, 13, 13, 25, 25, 25, 25, 25, 38, 38, 38, 38, 38, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75)
/selectionmode = list.slidevalues.currentindex
</list>

would be

<counter slidevalues>
/ items = (5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125,5,8,20,50,125)
/ select = noreplace
</counter>

<counter slideprob>
/ items = (13, 13, 13, 13, 13, 25, 25, 25, 25, 25, 38, 38, 38, 38, 38, 50, 50, 50, 50, 50, 75, 75, 75, 75, 75)
/ select = current(slidevalues)
</counter>

with

<trial sometrial>
/ ontrialbegin = [values.s_value = counter.slidevalues.selectedvalue;
    values.s_prob = counter.slideprob.selectedvalue; ]
...
</trial>

<values>
/ s_value = 0
/ s_prob = 0
</values>

to sample items from the two counters.

I've laid out the most important differences between Inquisit 4 and 3 syntax, including what you need to change to go from 4 to 3, throughout various threads. See e.g. https://www.millisecond.com/forums/Topic16606.aspx and https://www.millisecond.com/forums/Topic15587.aspx#bm15588 .
By nonamenick - 5/5/2016

Thank you. These changes have been working so far (I'm going through it slowly section by section), however, one problem keeps on occurring. The program is not finding my pictures. 

/items: Unable to load the picture 'H:\Test Expmnt\1#5#13.jpg'. Verify that the file exists and is of a supported format.


This is the error I keep on getting. The pictures are in jpg format and are located in the same file as the .exp file. 

I've haven't been able to find anything about errors loading pictures. Is there a specific way to organize pictures in the script for Inquisit 3 vs. Inquisit 4?

Should the pictures have their own item script and then have the picture script select them like this:

<picture ptask1picture>
/ items = ptask1items
/ select = sequence(1,2,3,4)
/size = (792px, 612px)
</picture>

<item ptask1items>
/1 = "Breakfast.jpg"
/2 = "Rollercoaster.jpg"
/3 = "WrongWay.jpg"
/4 = "Detergent.jpg"
</item>

or is it fine the way I had it shown above?

Thanks as always!

By Dave - 5/5/2016

> /items: Unable to load the picture 'H:\Test Expmnt\1#5#13.jpg'.

The file name referenced in the above error message is not anywhere among those referenced in the <picture> element & associated <item> element, so my assumption would be that error pertains to a different <picture> element in your script. It may also be that you are running into some kind of encoding issue (Inquisit 4 is a Unicode application and its files are encoded in UTF-8; Inquisit 3 is *not* a Unicode application, and it expects files to be encoded according to your system's codepage). Before transitioning to Inquisit 3, make sure to save your script in the legacy *.exp format via File -> Save As... in Inquisit 4.

Beyond that, no, there is no difference between Inquisit 3 and 4 in terms of loading and handling images.
By nonamenick - 5/9/2016

I'm still having an issue loading these pictures.

I have made sure to save it as a .exp, and I have tried testing it with other pictures and those are working fine, its only the picture files I need that are not working. Originally these files were used on a Mac for Inqusisit 4. I have moved them to a PC and changed the extension (.png to .jpg). It seems like there is something wrong with the picture properties. I have tried many different options but I can't seem to get these photos to load. 
By Dave - 5/9/2016

> I have moved them to a PC and changed the extension (.png to .jpg)

There's your problem. Changing a file's *extension* does not change the file's *format*. A PNG with a JPG extension is still a PNG, just like a Word DOC with a PDF extension is still a Word Document which no PDF reader will open: Changing the extension does not magically transform the file into something else.

Inquisit 3 does not support PNGs. What you need to do is open the PNGs in your preferred image editor and *convert* them to JPG, usually via FIle -> Save As...
By nonamenick - 5/10/2016

Thank you! That was very frustrating but I was able to export the pictures into a jpg format and the program now runs on Inquisit 3. 

The final issue I'm having with the transition is involving appending an item. I couldn't find anything involving the language for Inquisit 3 and wasn't sure about how to go about handling it.

what I have right now looks like this 

<trial fixedtrial>
.........
.........
/ ontrialend = [item.endslide.appenditem(picture.risk_slides.currentitem)]
........
</trial fixedtrial>


<trial payouttrial>
/ stimulusframes = [1=payoutmsg, payout, trialmsg]
/ validresponse = (57)
</trial>

<block payoutblock>
/ trials = [1=chosenslide; 2=payouttrial]
</block>

<text payoutmsg>
/ items = ("Your payout is")
/ position = (50%, 40%)
</text>

<text payout>
/ items = storedwinnings
</text>

<text trialmsg>
/ items = ("which is the amount you won in trial #<%text.payout.currentitemnumber%>.
")
/ position = (50%, 60%)
</text>

<item storedwinnings>
</item>

<trial chosenslide>
/stimulusframes = [1=endslide,chosentext, spacebar]
/inputdevice = mouse
/validresponse = (spacebar)
</trial>

<text chosentext>
/ items = ("This trial was picked at random. Continue to see what you won!")
/fontstyle = ("Arial", 4%)
/ position = (50%, 20%)
</text>

<picture endslide>
/ items = endslide
/ select = current(payout)
/ size = (50%,50%)
/ position = (50%,55%)
</picture>

<item endslide>
</item>


The purpose of this is to randomly select a single trial from the experiment and recall the picture of the trial, their response, and how much they won. 
If it is easier, I would not be opposed to simply recalling a random trial and having them complete the single trial again to determine what they have won. 



By Dave - 5/10/2016

Inquisit 3 syntax does not have object- or member-functions.

The equivalent to

<trial fixedtrial>
.........
/ ontrialend = [item.endslide.appenditem(picture.risk_slides.currentitem)]
........
</trial>

would simply be

<trial fixedtrial>
.........
/ ontrialend = [item.endslide.item = picture.risk_slides.currentitem]
........
</trial>


By nonamenick - 5/13/2016

Thank you, the experiment is running however, it is appending only the first item and not a random trial. And on the payout page, it is saying that trial number picked at random is trial 1 and it does not show the payout. I'm not sure if its a problem with the script in the trials above or an error with the trials for the payout page that i've posted here.

<trial chosenslide>
/stimulusframes = [1=endslide]
/inputdevice = keyboard
/validresponse = ("q")
</trial>

<picture endslide>
/ items = endslide
/ select = current(payout)
/ size = (50%,50%)
/ position = (50%,55%)
</picture>

<trial payouttrial>
/ stimulusframes = [1=payoutmsg, payout, trialmsg]
/inputdevice = keyboard
/ validresponse = ("q")
</trial>

<text payoutmsg>
/ items = ("Your payout is")
/ position = (50%, 40%)
</text>

<text payout>
/ items = storedwinnings
</text>

<text trialmsg>
/ items = ("which is the amount you won in trial #<%text.payout.currentitemnumber%>.")
/ position = (50%, 60%)
</text>

<item storedwinnings>
</item>

<item endslide>
</item>


By Dave - 5/13/2016

The code is too incomplete to say anything specific. Note that the selection in your <picture> element is set to depend on the selection in some other element:

<picture endslide>
/ items = endslide
/ select = current(payout)
/ size = (50%,50%)
/ position = (50%,55%)
</picture>

For this to make sense, the selection in the "payout" element has to happen *before* you ever try to display the <picture>. That would be a good place to start looking for your error.
By nonamenick - 5/13/2016

Ok, I changed the select so that it is it is the text payout that is selecting the endslide instead of the opposite way. The trial number is coming up using this <%text.payout.currentitemnumber%>. 

The only thing still not showing up is storedwinnings. After each trial is changes the win value to either 0, 5, or a win amount depending on the outcome of the lottery. 

I don't have anything for storedwinnings in the trial script. 

<trial fixedtrial>
/ ontrialbegin = [values.probamount=counter.slidevalues.selectedvalue; values.prob=counter.slideprob.selectedvalue; values.win=0; ]
/ ontrialbegin = [values.randomnumber = rand(0,100); ]
/ ontrialbegin = [picture.risk_slides]
/ ontrialend = [if (trial.fixedtrial.response=="3") {values.win=values.fixedamount; }; ]
/ ontrialend = [if (trial.fixedtrial.response=="1" && values.prob >= values.randomnumber) {values.win=values.probamount; }; ]
/ ontrialend = [if (trial.fixedtrial.response=="1" && values.prob < values.randomnumber) {values.win=0; }; ]
/ ontrialend = [item.endslide.item = picture.risk_slides.currentitem]
/ stimulusframes = [1=3, 1, risk_slides]
/ inputdevice = mouse
/ response = timeout(10000)
/ validresponse = (3, 1)
/ posttrialpause = 500
</trial>

and was wondering if it had to be in there or if the value gets stored with the item.endslide

<text payout>
/ items = storedwinnings
/ select = current(endslide)
</text>

<text trialmsg>
/ items = ("which is the amount you won in trial #<%text.payout.currentitemnumber%>.")
/ position = (50%, 60%)
</text>

<item storedwinnings>
</item>

Does something involving the win.value need to go into the storedwinnings item? 

By Dave - 5/13/2016

> Does something involving the win.value need to go into the storedwinnings item?

I cannot answer this question but you should be able to. You wrote the original Inquisit 4 code that used those <item> elements and that should tell you where they were used and what for.

All I can say is that you have a <text> element

<text payout>
/ items = storedwinnings
/ select = current(endslide)
</text>

<item storedwinnings>
</item>

that references <item storedwinnings> and that the selection in the <text> element depends on the selection in "endslide". If you don't ever add any items to <item storedwinnings>, it obviously cannot display anything.