Accessing variables elsewhere in a program
I'm having trouble locating the semantics/syntax for accessing variables set elsewhere in a program. For example, suppose I have a loop (loop 2) embedded within a loop (loop 1). Associated with both loops are sketchpads and a keyboard. If I am in loop 2, how do I refer to a variable (such as live_row) in loop 1? I see the names of variables in the Variable Inspector, but plugging them into the code (either in brackets or with a var. appended to the front) doesn't seem to work... Thanks!
Comments
Maybe this helps:
http://forum.cogsci.nl/index.php?p=/discussion/comment/9066/#Comment_9066
Best,
Jarik
I'm close...
I have an inline script following a loop, sketchpad, and keyboard with the following code:
if var.correct == 0:
print var.live_row_loop1
var.live_row_loop1=0
When correct equals zero, the current live_row value of loop1 is printed. However, live_row is not reset at 0 to begin the loop again. How do I correctly do that?
thank you!
Using
items['loop1'].live_row = 0I got it working. But be careful this is not documented and I don't know what will happen to the randomization (when your loop order is random) for example. This might also be informative:Best,
Jarik