Using the script.currenttime as an integer


Using the script.currenttime as an integer

Author
Message
audiosophy
audiosophy
Distinguished Member
Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)

Group: Forum Members
Posts: 62, Visits: 212
Hi I am having a problem whereby I want to branch in my study if the currenttime is over a certain value:

e.g. 

<trial Blockertrial>
/ ontrialbegin = [values.currenttime = script.currenttime]
/ stimulustimes = [1=Blocker]
/ trialduration = 5000
/ branch = [if (values.currenttime >= 11:56:01) surveypage.sliders]
</trial>

but inquisit is not liking the "11:56:01" part ("Expression contains unknown element or property name".) 

It's got me thinking - how can I use this figure with colons etc as a value? I thought that as perhaps it is a string, I could somehow remove the colons, and convert it to an integer somehow.

I tried using one of the functions: replaceall("<% values.currenttime %>", ":", "") but Inquisit doesn't 'see' the value rather just the actual characters (the greater than sign, the percentage sign and the letters)

Would greatly appreciate a response on this as I'm up against a deadline and can't figure this out! Thanks in advance
Dave
Dave
Supreme Being
Supreme Being (447K reputation)Supreme Being (447K reputation)Supreme Being (447K reputation)Supreme Being (447K reputation)Supreme Being (447K reputation)Supreme Being (447K reputation)Supreme Being (447K reputation)Supreme Being (447K reputation)Supreme Being (447K reputation)

Group: Administrators
Posts: 9K, Visits: 38K
audiosophy - Thursday, March 29, 2018
Hi I am having a problem whereby I want to branch in my study if the currenttime is over a certain value:

e.g. 

<trial Blockertrial>
/ ontrialbegin = [values.currenttime = script.currenttime]
/ stimulustimes = [1=Blocker]
/ trialduration = 5000
/ branch = [if (values.currenttime >= 11:56:01) surveypage.sliders]
</trial>

but inquisit is not liking the "11:56:01" part ("Expression contains unknown element or property name".) 

It's got me thinking - how can I use this figure with colons etc as a value? I thought that as perhaps it is a string, I could somehow remove the colons, and convert it to an integer somehow.

I tried using one of the functions: replaceall("<% values.currenttime %>", ":", "") but Inquisit doesn't 'see' the value rather just the actual characters (the greater than sign, the percentage sign and the letters)

Would greatly appreciate a response on this as I'm up against a deadline and can't figure this out! Thanks in advance

This should do the trick:

<values>
/ currenttime = 0
</values>

<block myblock>
/ trials = [1=Blockertrial]
</block>

<trial Blockertrial>
/ ontrialbegin = [values.currenttime = script.currenttime;
    values.currenttime = replaceall(values.currenttime, ":", "");
    ]
/ stimulustimes = [1=Blocker]
/ trialduration = 5000
/ branch = [if (values.currenttime >= 115601) surveypage.sliders]
</trial>

<text blocker>
/ items = ("This is the blocker trial.")
</text>

<surveypage sliders>
/ caption = "This is the slider page."
</surveypage>

seandr
seandr
Supreme Being
Supreme Being (65K reputation)Supreme Being (65K reputation)Supreme Being (65K reputation)Supreme Being (65K reputation)Supreme Being (65K reputation)Supreme Being (65K reputation)Supreme Being (65K reputation)Supreme Being (65K reputation)Supreme Being (65K reputation)

Group: Administrators
Posts: 1.2K, Visits: 917
One other thing to mention - if you're interested in the time relative to the start of the trial (as opposed to the time of day), check out the "elapsedtime" property. 

This returns an integer representing the number of milliseconds elapsed since the trial started, and is generally what we use for dynamically setting time limits and criteria. In that case, your code would look something like the following (assuming a 10 second criterion):

<trial Blockertrial>
/ stimulustimes = [1=Blocker]
/ trialduration = 5000
/ branch = [if (trial.Blockertrial.elapsedtime >=10000) surveypage.sliders]
</trial>


-Sean
Edited
5 Months Ago by seandr
audiosophy
audiosophy
Distinguished Member
Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)

Group: Forum Members
Posts: 62, Visits: 212
Ohhh sweet jesus thankyou!! That's fantastic Dave, so I have the blocker trial just looping if it isn't the right time and then when it gets to the right time it switches to the questions. Awesome.
audiosophy
audiosophy
Distinguished Member
Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)Distinguished Member (2.9K reputation)

Group: Forum Members
Posts: 62, Visits: 212
seandr - Thursday, March 29, 2018
One other thing to mention - if you're interested in the time relative to the start of the trial (as opposed to the time of day), check out the "elapsedtime" property. 

This returns an integer representing the number of milliseconds elapsed since the trial started, and is generally what we use for dynamically setting time limits and criteria. In that case, your code would look something like the following (assuming a 10 second criterion):

<trial Blockertrial>
/ stimulustimes = [1=Blocker]
/ trialduration = 5000
/ branch = [if (trial.Blockertrial.elapsedtime >=10000) surveypage.sliders]
</trial>


-Sean

Ok yeah in this case it's the absolute time of day I'm interested in but that's good to know too thanks
GO


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....






Millisecond Forums


Search