Error manipulating item-Elemts


Author
Message
luffy
luffy
Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)
Group: Forum Members
Posts: 7, Visits: 26

I'm trying to change the contents of an item-element but always get the errormessage:
"Unable to initialize <picture animal> item number 1. Verify the item exists and is correctly defined." 


Example:


<item Animal> / 1 = "dog.png" </item>


<picture animal> / items = Animal </picture>


 


<trial dog>


/ stimulustimes = [0=animal] / timeout = 1000


</trial>


 


<trial cat>


/ ontrialbegin = [item.Animal.setitem("cat.png",1)]


/ stimulustimes = [0=animal] / timeout = 1000


</trial>


 


<trial cat2>


/ ontrialbegin = [setitem(item.Animal,"cat.png",1)]


/ stimulustimes = [0=animal] / timeout = 1000


</trial>


Trial "dog" is working. For the other two i get the error. The help-page for the item-element lists "setitem" as a function, but not the other way round. Does this mean it is not possible to do this? Manipulating the picture-element would be a bad option for me because i have several of those referencing the same set of items.



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 13K, Visits: 108K

If you wanted to do this, you would first have to make Inquisit aware that a file called "cat.png" actually exists and make it available to it as an object:


<block mmyblock>
/ trials = [1=sequence(dog, cat)]
</block>

<item Animal>
/ 1 = "dog.png"
</item>

<picture animal>
/ items = Animal
</picture>

<trial dog>
/ stimulustimes = [0=animal]
/ timeout = 1000
</trial>

<trial cat>
/ ontrialbegin = [setitem(item.Animal,"cat.png",1)]
/ stimulustimes = [0=animal]
/ timeout = 1000
</trial>

<picture dummy>
/ items = myitems
</picture>

<item myitems>
/ 1 = "cat.png"
</item>


However, this approach is both inefficient as well as prone to runtime errors. The proper way to do this is:


<block mmyblock>
/ trials = [1-2=sequence(dog, cat)]
</block>

<values>
/ itemnumber = 1
</values>

<item Animal>
/ 1 = "dog.png"
/ 2 = "cat.png"
</item>

<picture animal>
/ items = Animal
/ select = values.itemnumber
</picture>

<trial dog>
/ ontrialbegin = [values.itemnumber=1]
/ stimulustimes = [0=animal]
/ timeout = 1000
</trial>

<trial cat>
/ ontrialbegin = [values.itemnumber=2]
/ stimulustimes = [0=animal]
/ timeout = 1000
</trial>


luffy
luffy
Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)Respected Member (398 reputation)
Group: Forum Members
Posts: 7, Visits: 26

Thank you!


Will try this out after the weekend.


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search