By zajac - 2/13/2014
Hi guys. I am doing a fair bit of programming on a small laptop, but the actual testing of participants is done on 22" monitors. If I set my position parameters in %, I can't control the distance between them (in terms of pixels). If I define positions using pixels, then the way I define them for the bigger monitors means they won't display properly on a smaller monitor.
Imagine the following scenario. I have four squares that I want to display centrally. Each square will be positioned 50px from the centre most point. The large monitors have a vertical resoultion of 1080, so mid screen is 510px. On the laptop though, vertical resolution is 768px. So if I use the same program on the laptop it won't display centrally.
What I'm thinking is dynamically defining a position. For instance, can I create a variable (displaypos) which equals (verticalresolution/2)? Then, I could display images using verticalposition = displaypos?
Hoping someone has a fix for this issue. Maybe it's easier than I think? Anyway, thanks in advance for any advice!
Ian.
|
By Dave - 2/13/2014
> What I'm thinking is dynamically defining a position. For instance, can I create a variable (displaypos) which equals (verticalresolution/2)?
Yes, you can do that. You'll want to use the display.width and/or display.height properties to do that. Details can be found in the documentation for the <display> element. Note that width and height are returned as pure integers, so you'll have to multiply by 1px to convert to pixels.
|
By zajac - 2/15/2014
Ok, so I'm not really getting anywhere with this. I have the following trial which is a cue image which I want to display centrally. I'm trying to set the position to be defined using an expression. I know that I can show centrally using 50%,50%. I'd rather use the expression for consistency though, and as a test to check I'm getting it right.
I first tried to define a vertical resolution and horizontal resolution value so that I can call these in expressions.
<values> / vertres=display.height / horizres=display.width </values>
Then, I tried to call these for the position of the trial as follows:
<picture cuepic> / items = ("cue.jpg") / size = (100px,100px) / position = (values.vertres/2,values.horizres / 2) </picture>
I'm not getting any errors and the script runs ok, I just can't see the cue at all. What am I doing wrong?
Thanks in advance
|
By Dave - 2/15/2014
As already mentioned in my previous reply, you ought to multiply by pixels to cast the expression to the correct unit:
<values> / vertres = 1px * display.height / horizres = 1px * display.width </values>
|
By zajac - 2/15/2014
Apologies for missing that part, Dave. Thanks for your help. All sorted.
|
By Dave - 2/15/2014
No worries -- I probably should have made the point more salient to begin with. Let me know if anything else comes up!
|
By zajac - 2/16/2014
Now just another quick question about <summarydata> : Can I get it to store meanlatency for an RT task, as per the last line of the raw data file? I'm guessing that I will need to define this in the script somewhere within values or variable, and then enter it as a summary column (i.e., values.meanlatency)
I've had a bit of a look through the help documentation, but am admittedly a little lost.
|
By Dave - 2/16/2014
You either need to compute mean latency using <values> and log the respective value to the data file or do the same using one of the built-in meanlatency properties.
|
By zajac - 2/23/2014
Dave - just a quick question again: Is it possible to have a sound stimulus play on response? We're trying to put together a 'fruit squash' type game and when participants press the fruit we'd like to have a 'squash' sound played. Is this possible?
|
By zajac - 2/23/2014
Never mind - I'm pretty sure I can call it as a correctmessage=true(sound,200) etc.....
|
By Dave - 2/23/2014
Using /correctmessage, /responsemessage or /branch to another <trial> that plays the respective <sound> are all valid approaches.
|