Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[open] Display time left on form text input

edited January 2014 in OpenSesame

Hi,

I am trying to display the duration of time left on a form. For example, if participants have 2 minutes to finish a task that is presented on a form text input. I wish to show the total time allowed and the time left on a corner.

I was able to display time left on a canvas taking some bits of code from here http://forum.cogsci.nl/index.php?p=/discussion/38/solved-intentional-binding-paradigm-creating-animations/p1 but I am unable to find a way to present it on item itself (form_text_input).

Any insights and pointer will help.

Thanks in advance,
Asma

Comments

  • edited January 2014

    Hi all,

    So here is what I was able to achieve after posting the query-

    [pastebin:vPyqwLqT]

    Right now, I am able to create a canvas that shows the time lapsed in seconds and a form that consist of a task that I wish participants would do in allotted time. Although my script works in parts but does not achieve what I want. I want to display the time elapsed at the bottom of the form (not on a separate canvas as it is now), but right now it just shows the last value I get in the while loop present in the inline script.

    Any help will be much appreciated.

    Thanks!

  • edited 5:27AM

    Hi Ahani,

    Looking at your script it seems like you want a continuously running countdown timer in your experiment, is that correct? I'm afraid that this is not possible, at least not without extensive inline scripting.

    What you can do, however, is present a static countdown timer that is updated with, for example, every new trial. Would that be sufficient? The script below shows how you can keep track of the time that is left as the variable timeleft (see code comments for details). You can then use this variable to display the time left in sketchpad items, etc. But it will be a static message, not a running counter.

    # Total duration in seconds
    total_time = 60
    # Time passed since the start of the experiment, as determined by the
    # presentation timestamp of an `instructions` item.
    time_passed = (self.time() - self.get('time_instructions'))/1000
    # Set the time that is left
    exp.set('timeleft', total_time-time_passed)
    

    Cheers!
    Sebastiaan

  • edited 5:27AM

    Thanks Sebastiaan,
    I was able to display the total time passed. I wanted a dynamic display to show the time passed.

Sign In or Register to comment.