Proxy variables in snippets

0 votes
18 views
asked Apr 12, 2016 by anonymous
edited Apr 13, 2016 by qandaadmin
We have problems with sending codes in the report. Sometimes we want to send 2 successive codes or more in the same snippet of an event, for example “Control Loop”. This seems to work in most cases, but sometimes it seems that sending the second code deletes the first code. For example, we show a stimulus on activation and then in 3 successive loops we wait for a short period of time before:

1. showing the targets (code 80),

2. giving a GO signal (code 83), and

3. waiting for the monkey to release the touch (code 64).

When we look at the report, code 80 doesn’t appear but codes 83 and 64 do. We know that the code for code 80 is correctly running because we can see the targets on screen so target visible is changed. We have avoided putting these elements in separate events because it seems lighter on code to run them sequentially in one snippet. Perhaps that’s a bad habit we’ve brought from coding in Cortex, Pascal, etc...?

The question is: is there something that we don’t understand about the running of report? It looks like the code 80 is deleted by the code 83 but if that’s the case, why is the code 83 not deleted by the code 64? Is there a limit on the number of codes we can send per snippet? Is there an easy fix for this?

1 Answer

0 votes
answered Apr 12, 2016 by Maria Molodova (8,320 points)
selected Apr 13, 2016 by qandaadmin
 
Best answer

There is one particularity about using proxy variables in snippets that can explain your problem. Inside snippets, proxy variables are not accessed directly, a snippet works with virtual copy of the string Report variable (for sake of performance). Accordingly, changes of Report variable inside of snippet are not immediately recorded into a file. This implies that only the last content of Report variable will be written into a file (writing occurs after snippet is completed). For example, if you have inside the same snippet:

Report=”Word1”; // This does not causes immediate writing to data report.
Report=”Word2”;


The only “Word2” will be actually recorded in the Report. The fix is easy, if you just re-write as:

Report=”Word1”;
Report=Report+”Word2”;


In this case, a composite string, “Word1 Word2”,  will be recorded.
This is what may happened in your code, the first assignment of the Report variable is overwritten by the second one. The same principle is applied to other proxies. For example, when you change the Renderer's position in snippets:

Position=new clPoint(20,20);
Position=new clPoint(200,200);

the first assignment will be ignored and rendered will be moved directly to 200,200, after snippet  call is completed.

Welcome to EventIDE Q&A forum where you can ask questions about EventIDE software and receive answers from other members of the community

FAQ questions

Installation and License


Coding


Eye-tracking


EEG Analysis


Visual Stimuli


Runtime and Data Collection


Hardware

...