Why specify the InputMask in the script when using goto after TextDisplay.run to terminate TextDispl

David McFarlane mcfarla9 at msu.edu
Mon Aug 13 21:41:23 UTC 2012


Paul Groot may have adequately answered this (complete with example 
program!), but here are my thoughts anyway...

Sigh.  First, please please when you post this sort of thing, do 
*not* set it in some hard-to-read font, just leave it as plain text 
-- I had to copy & paste your code into a text editor, next time 
don't expect us to go through that much trouble to help you.

Now first, I generally think it poor practice to assign .Text and 
other object properties directly from inline code.  Unless you have a 
*very* good reason to do so and can explain that decision in depth 
(and supply that as extensive comments in your program), you should 
always use attribute references for at least three reasons:  (1) 
Using attribute references often simplifies the code.  (2) Attribute 
references in the stimulus object act as clues to the reader that 
values will be supplied at run time.  (3) Attributes get logged to 
the .edat file, fully documenting the values used during the run.

So, lines like

     EndPrac.Text = "Well done."

should read instead

     c.SetAttrib "EndPracText", "Well done."

and then you should use [EndPracText] in your TextDisplay object (or, 
consider using a Slide with multiple states).

Second, I generally think it a bad practice to use the .Run method to 
run a stimulus from inline code.  E.g., I would not use EndProc.Run.

Instead, your CheckACC inline should read merely

     If (PracticeACC.Mean >= .80)  Then
         c.SetAttrib "EndPracText", "Well done."
     Else
         c.SetAttrib "EndPracText", "Try again."
     End If

(actually, it should read simply

     c.SetAttrib "EndPracText", Iif( (PracticeACC.Mean >= .80), _
         "Well done.", "Try again." )

but that's an advanced coding lesson.)

Then, you should follow EndPrac with another inline that simply goes

     If (PracticeACC.Mean >= .80)  Then Goto Label2

and then E-Prime will take care of the rest (set up the input mask, 
run EndPrac).

Yes, I know it seems to redundantly perform the "If 
(PracticeACC.Mean >= .80)" conditional across two inlines, but that's 
how we do things in E-Prime.

-----
David McFarlane
E-Prime training 
online:  http://psychology.msu.edu/Workshops_Courses/eprime.aspx
Twitter:  @EPrimeMaster (twitter.com/EPrimeMaster)


At 8/13/2012 04:53 PM Monday, Paul Groot wrote:
>Hi Jakob,
>
>I'm not 100% sure about this, but my guess is that E-Studio 
>generates code where the inputmask of an object is initialized just 
>before running the object (you can check this in the full-script 
>tab). And, since you run the object explicitly in your own script in 
>the try-again scenario, you also have to initialize the inputmask 
>explicitly yourself because the generated initialization code is not 
>yet called when you execute the run-statement.
>
>There are several workarounds for this. I will only explain a 
>scenario that doesn't use a goto-label, because goto's often have 
>negative side effects. My advise would be to put the practice block 
>procedure in another  block list that repeats several times 
>(PracMasterList::Exit List = 999). Then, instead of using a 
>goto-label construct, simply call the terminate method in case the 
>ready-criteria are met (PracMasterList.Terminate)
>
>If PracticeACC.Mean >= .80 Then
>    EndPrac.Text = "Well done"
>    PracMasterList.Terminate
>else
>    EndPrac.Text = "Try again"
>end if
>
>You might have to tweak other objects, such as the practice 
>introduction screen, to complete it: If the instruction should not 
>repeat, then you can simply place it before the practice master 
>list. If the practice instructions should repeat with different 
>content, you could make use of a Slide object having different tab's 
>(SlideStates) with specific instructions for the first and repeating 
>runs. The Slide's ActiveState property can be used to select the 
>visible tab. The attached example shows how you can do this. Sounds 
>complicated, but is rather straightfoward without additional inline 
>script. (In words: Define an attribute for the active state in 
>PracMasterList. Use the []-syntax to specify the name of this 
>attribute in the ActiveState property of the Slide. Set the list 
>ordering to sequential and include as many rows as required. 
>Configure the required active state for each row. Exit list should 
>be reset to 1 cycle in this case because the number of 'trials' 
>determine how many times the practice block.)
>
>Cheers,
>Paul
>
>
>
>
>2012/8/13 Jakob 
><<mailto:jakob4resilience at gmail.com>jakob4resilience at gmail.com>
>Hello everyone!
>
>I would really appreciate if someone could help me understand the following:
>
>I have a conditional practice block with a script that displays one 
>text in the following text-object if the accuracy-criterium is met. 
>If the criterium is not met it displays another text in the same 
>text-object and then jumps back to a label (goto). If the criterium 
>is met everything works as intended. But in the case of the 
>criterium not being met the text-object only terminates with input 
>if I manually specify the InputMask for the text-object in the 
>script, not if I merely specifiy the input in the GUI of the 
>text-object (see below)
>I'd really like to understand this enigma! ;)
>
>Thanks in advance!
>Jakob
>
>Here is the relevant part of the experimental procedure and the 
>script in question (CheckACC):
>--------------------------------------------------------------------------------------------------
>PracticeBlockProcedure
>Setup (Script that sets a Summation Variable)
>
>PracticeInstruction (TextDisplay Object)
>
>Label2 (Label)
>
>Reset (Script that resets the Summation Variable)
>
>Practice List (List Object)
>
>PracticeListProcedure
>
>PracticeDisplay (ImageDisplay Object)
>
>PracticeFeedback (FeedbackObject)
>
>AddObservation (Script that adds the ACC of the PracticeDisplay to 
>the Summation Variable so it can be compared to the criterium later on)
>
>CheckACC (Script that checks if the ACC criterium has been met and 
>branches accordingly; the line in question is in talics - see below)
>
>EndPrac (TextDisplay Object that displays a text depending on the 
>CheckACC script)
>
>-------------------------------------------------------------------------------------------------- 
>
>
>CheckACC-Script:
>If PracticeACC.Mean >= .80  Then
>EndPrac.Text = "Well done."
>Else
>EndPrac.Text = "Try again."
>EndPrac.InputMasks.Add Keyboard.CreateInputMask("{SPACE}", "", 
>CLng(Pause.Duration), CLng("1"), ebEndResponseActionTerminate, 
>CLogical("Yes"), "", "", "ResponseMode:All ProcessBackspace:Yes")
>EndPrac.Run
>Goto Label2
>End If

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com.
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



More information about the Eprime mailing list