send command with two tasks
Posted: Mon Oct 22, 2012 8:48 pm
Hello! I have been using LiveCode for about 6 months and it has been going really well. I have programmed several types of programs, but I recently ran into a problem (that I eventually solved) but the solution seems to be a less than efficient way to do it.
I need to run two tasks in an experiment simultaneously. In one task subjects are presented a list of words, one word at a time every 3 seconds. At the exact same time subjects are hearing single digits spoken every 1 second through the "say" command for applescript (they have to press a key if they hear 3 odd digits in a row).
Here is a simplified version of the method that I did that currently "works" but may not be the best method:
on task
send sayone to me in 1000 milliseconds
send saytwo to me in 2000 milliseconds
send "put factory into me" to me in 3000 milliseconds
send saythree to me in 3001 milliseconds
send sayfour to me in 4000 milliseconds
send sayfive to me in 5000 milliseconds
send "put tower into me" to me in 6000 milliseconds
end task
on sayone
do item 1 of line 1 of fld "Say Digits" as applescript
end sayone
on saytwo
do item 1 of line 2 of fld "Say Digits" as applescript
end saytwo
....
Note that here "me" = a fld, and that I am calling the "do" commands from another field with a list of the applescript commands
Any ideas on how to improve this method please let me know, otherwise it's going to be a while before I get this program done haha!
Thanks!
Josh
I need to run two tasks in an experiment simultaneously. In one task subjects are presented a list of words, one word at a time every 3 seconds. At the exact same time subjects are hearing single digits spoken every 1 second through the "say" command for applescript (they have to press a key if they hear 3 odd digits in a row).
Here is a simplified version of the method that I did that currently "works" but may not be the best method:
on task
send sayone to me in 1000 milliseconds
send saytwo to me in 2000 milliseconds
send "put factory into me" to me in 3000 milliseconds
send saythree to me in 3001 milliseconds
send sayfour to me in 4000 milliseconds
send sayfive to me in 5000 milliseconds
send "put tower into me" to me in 6000 milliseconds
end task
on sayone
do item 1 of line 1 of fld "Say Digits" as applescript
end sayone
on saytwo
do item 1 of line 2 of fld "Say Digits" as applescript
end saytwo
....
Note that here "me" = a fld, and that I am calling the "do" commands from another field with a list of the applescript commands
Any ideas on how to improve this method please let me know, otherwise it's going to be a while before I get this program done haha!
Thanks!
Josh