forcing to choose only two object by click

liwenna liwenna at gmail.com
Fri Mar 2 12:09:30 UTC 2012


Oh, the linebreaking is not always correct >.<

Moreover: I realise now that you'll want to move the

 " dim CheckEven as string
dim CheckOdd as string

if clicknumber mod 2 = 1 then checkodd = ("Check" & nCheck")
if clicknumber mod 2 = 0 then checkeven = ("Check" & nCheck") "

up to above the part of code were you change the image from checkempty
to checkfull. This part of the code should be made to also be
dependent on the values stored in checkodd and checkeven, while all
other boxes should be set to checkempty. If you don't do that, than
checkboxes won't be 'unchecked'.

Also in the lines  checkodd = empty & checkeven = empty (the first
line was forgotten in the second part, sorry!), 'empty' is just a word
to 'empty' that string variable, so it should possible be => CheckOdd
= "empty" (note the "s).



On 2 mrt, 12:54, liwenna <liwe... at gmail.com> wrote:
> Hello Güzin,
>
> I more or less agree with David. Nonetheless I tried to conjure up
> something. This is written without e-prime, so it probably won't work
> right away and perhaps it will not work at all... but it might get you
> going again and point towards the solution to your problem.
>
> I've rewriten your code. You need to make a few new things elsewhere
> in the program too.
> On the usertab of the script window (bottom lef of the script window)
> you need to declare a variable called 'clicknumber', that will keep
> track of whether the number of clicks made. This is needed to store
> two consecutive answers separately. Write " dim clicknumber as integer
> " on the usertab to declare it.
>
> At the begining of the script the variable clicknumber is increased by
> 1 so that it keeps cound of the clicks (it's 0+1 = 1 after click1, 1+1
> =2 after click 2 etc). Then a large part of your own script follows.
>
> I started modifying again following the part where the chechbox image
> is changes.
>
> Here I create two new variables Checkodd and Checkeven. In the next
> part clicknumber is checked to see whether the 'current click' (click
> number) is an odd or an even number (based on mod 2, see explanations
> elsewhere). If the clicknumber is odd, the given response is stored in
> the variable 'CheckOdd', if it's even it is stored under 'CheckEven'.
>
> For the next part of the script you'll need to make two attributes (in
> your lists) called correcresponse1 and correctresponse2. These should
> contain the right answers (i.e. check4 and check5). If the answer that
> is currently given and the previous given answer (both stored under
> checkodd and checkeven) are both found in correctresponse1 and
> correctresponse2, the program is send to a label called endlabel (goto
> endlabel, first clicknumber, checkodd and checkeven are reset for the
> next trial). You should make this label after the inline script. If
> the two last answers are not the answers in corectresponse1 and
> correctresponse2, then the program is send back to the label called
> ChooseAgain.
>
> The script doesn't store answers yet, nor does it keep an accuracy
> count. You could still add those if you need them (or store
> clicknumber to have a count of the total answers given before the
> correct answers were given).
>
> Hope this helps.
>
> Best,
>
> AW
>
> 'AW note: clickbnumber should be declared on the usertab, it keeps
> count of the number of clicks made
> clicknumber = clicknumber + 1
>
> 'existing script
>
> 'Designate "theState" as the Default Slide State, which is the
> current, ActiveState
> 'on the Slide object "Stimulus"
> Dim theState as SlideState
> Set theState = Stimulus.States("Default")
>
> 'Variable for holding the name of the sub-object clicked by the
> subject.
> Dim strHit As String
>
> 'Variable for holding the subject's response information.
> Dim theMouseResponseData As MouseResponseData
>
> 'Was a response made?
> If Stimulus.InputMasks.Responses.Count > 0 Then
>
>         Set theMouseResponseData =
> CMouseResponseData(Stimulus.InputMasks.Responses(1))
>
>         strHit = theState.HitTest(theMouseResponseData.CursorX,
> theMouseResponseData.CursorY)
>
>         'If a check box was clicked, check or uncheck it based on its
> current
> state.
>         If Mid(strHit, 1, 5) = "Check" Then
>
>                 'Store the number of the checkbox clicked.
>
>                 nCheck = CInt(Mid(strHit, 6, 1))
>                 Debug.Print nCheck
>
>                 If c.GetAttrib("Check" & nCheck & "Image") =
> "checkempty.bmp" Then
>
>                  c.SetAttrib "Check" & nCheck & "Image",
> "checkfull.bmp"
>
>                 End If
>
> 'AW note: CheckEven and CheckOdd will contain the answers (checkx)
> given on the last odd and the last even (thus the last two) clicks
> dim CheckEven as string
> dim CheckOdd as string
>
> if clicknumber mod 2 = 1 then checkodd = ("Check" & nCheck")
> if clicknumber mod 2 = 0 then checkeven = ("Check" &
> nCheck")
>
> 'AW note: compare the answers in CheckOdd and CheckEven to the correct
> answers stored in the attributes correctresponse1 and
> 'correctresponse1. If both are found, then resent the check and click
> variables and terminate by goto endlabel
> ' else goto the label called ChooseAgain
>
> If checkodd = c.getattrib ("correctresponse1") and checkeven =
> c.getattrib (correctresponse2") then
> checkodd = empty
> checkeven = empty
> clicknumber = 0
> goto endlabel
>
> If checkodd = c.getattrib ("correctresponse2") and checkeven =
> c.getattrib (correctresponse1") then
> checkeven = empty
> clicknumber = 0
> goto endlabel
>
> else
>
> Goto ChooseAgain
>
> end if
>
> On 1 mrt, 18:35, David McFarlane <mcfar... at msu.edu> wrote:
>
> > Güzin,
>
> > I think the reason you do not get a response to
> > this question is because it is just too complex
> > for this type of forum.  The short answer is, to
> > do what you want will take some careful, complex,
> > and intricate coding, which you will need to
> > figure out for yourself based on all the working
> > elements that you already have on hand (or hire
> > someone else to do it, if you could find such a
> > person).  To take an analogy, if this were a
> > music writing forum, you might reasonably ask how
> > to transpose "Mary Had a Little Lamb" from
> > C-major to G-major.  But aking how to rewrite
> > Beethoven's "Moonlight Sonata" in the style of
> > Rachmaninoff might not get a response.
>
> > But PST Web Support sometimes helps out with
> > complex projects like this, so you might try
> > contacting them athttp://support.pstnet.com/e%2Dprime/support/login.asp.
>
> > ---
> > David McFarlane
> > E-Prime training
> > online:  http://psychology.msu.edu/Workshops_Courses/eprime.aspx
> > Twitter:  @EPrimeMaster (twitter.com/EPrimeMaster)
>
> > At 3/1/2012 07:09 AM Thursday, you wrote:
>
> > >Hi, I have written before the same problem but I could not get any
> > >reply neither in pst forum (http://support.pstnet.com/forum/
> > >Topic5781-23-1.aspx) nor in googlegroups.  I think I wrote a bit
> > >complicated with my limited English. I am writing again i a simple
> > >way.
>
> > >I have 8 checkboxes on a slide (checkboxes are an empty square image
> > >on the slide and named, Check1, Check2….. Check8).
> > >Participants must choose two of them for each trial by clicking on the
> > >checkboxes. When they click on a checkbox, it fill with black to show
> > >as it is checked. There are two correct checkboxes out of eight for
> > >each trial. But I want that participant must choose only two of the
> > >checkboxes and not being allowed to choose a third one. If they click
> > >on a third one their last selection will be disappear and replace with
> > >third click.
> > >How can I limit checking checkboxes to two while they could change
> > >their selections without exceeding two limit? My code is below;
>
> > >'Designate "theState" as the Default Slide State, which is the
> > >current, ActiveState
> > >'on the Slide object "Stimulus"
> > >Dim theState as SlideState
> > >Set theState = Stimulus.States("Default")
>
> > >'Variable for holding the name of the sub-object clicked by the
> > >subject.
> > >Dim strHit As String
>
> > >'Variable for holding the subject's response information.
> > >Dim theMouseResponseData As MouseResponseData
>
> > >'Was a response made?
> > >If Stimulus.InputMasks.Responses.Count > 0 Then
>
> > >         Set theMouseResponseData =
> > >CMouseResponseData(Stimulus.InputMasks.Responses(1))
>
> > >         strHit = theState.HitTest(theMouseResponseData.CursorX,
> > >theMouseResponseData.CursorY)
>
> > >         'If a check box was clicked, check or uncheck it based on its current
> > >state.
> > >         If Mid(strHit, 1, 5) = "Check" Then
>
> > >                 'Store the number of the checkbox clicked.
> > >                 Dim nCheck As Integer
> > >                 nCheck = CInt(Mid(strHit, 6, 1))
> > >                 Debug.Print nCheck
>
> > >                 If c.GetAttrib("Check" & nCheck
> > > & "Image") = "checkempty.bmp" Then
>
> > >                         c.SetAttrib "Check" &
> > > nCheck & "Image", "checkfull.bmp"
>
> > >                                 'If a box has
> > > been checked, log the RT and RESP.
>
> > >                                 Else
>
> > >                         c.SetAttrib "Check" &
> > > nCheck & "Image", "checkempty.bmp"
> > >                         c.Setattrib "Check" & nCheck & "RESP", ""
>
> > >                 End If
> > >                                 End If
>
> > >                         if c.GetAttrib("Check4Image")="checkfull.bmp" and
> > >c.GetAttrib("Check5Image")="checkfull.bmp" and
> > >c.GetAttrib("Check1Image")="checkempty.bmp" and
> > >c.GetAttrib("Check2Image")="checkempty.bmp" and
> > >c.GetAttrib("Check3Image")="checkempty.bmp" and
> > >c.GetAttrib("Check6Image")="checkempty.bmp" and
> > >c.GetAttrib("Check7Image")="checkempty.bmp" and
> > >c.GetAttrib("Check8Image")="checkempty.bmp" Then
> > >                      'if strHit = "Check5" and strHit = "Check4" Then
> > >                                 Stimulus.ACC = 1
>
> > >                         else Stimulus.ACC = 0
> > >                         End if
> > >         If strHit <> "Next" Then
> > >                 Goto ChooseAgain
>
> > >         End If
>
> > >End If
>
> > >Thank you
> > >Güzin

-- 
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 this group at http://groups.google.com/group/e-prime?hl=en.



More information about the Eprime mailing list