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

494 просмотра
Перейти к первому непрочитанному сообщению

Jakob

не прочитано,
13 авг. 2012 г., 13:29:3913.08.2012
– e-p...@googlegroups.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
 
 
 
 
 
 
 


Paul Groot

не прочитано,
13 авг. 2012 г., 16:53:2013.08.2012
– e-p...@googlegroups.com
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 <jakob4re...@gmail.com>
 


--
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-p...@googlegroups.com.
To unsubscribe from this group, send email to e-prime+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/e-prime/-/atKZiK1ES_MJ.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

ConditionalPractice.es2

David McFarlane

не прочитано,
13 авг. 2012 г., 17:41:2313.08.2012
– e-p...@googlegroups.com
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)
><<mailto:jakob4re...@gmail.com>jakob4re...@gmail.com>

Jakob

не прочитано,
20 авг. 2012 г., 05:17:5520.08.2012
– e-p...@googlegroups.com
Thank you Paul and David for your in-depth help and comments! I will try it out.

@David: Sorry for the extra work. In fact the manual formating (wich took me a lot of time) was meant to make things easier for you. I thought it would be confusing to have the procedural-structure and script in the same format and indent as the rest of the text. As for the hard-to-read-font, I didn't change it, only the size (which you can adjust with "ctrl+"). Anyway, next time I will use plain text... will save you and me a lot of work. Thanks for still reading through it and answering!

Jakob
Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений