Hi David,<br><br><br>In your code there seem to be some additions compared to the original dohittest provided by PST, which I do not think you need and may also form your problem.<br><br>As for the error code: every IF THEN statement shoudl be either placed on a single line or closed with and END IF statement and similarly for conditional statements like the DO WHILE loop etc. The error occurs because there is an END statement misplaced or missing, cause the program to get 'lost'. <br><br>As for your code: I think you added several lines that involve a do while statement and also have to do with the exact names of the buttons that were clicked on.<br><br>Neither of these are needed for your purpose (if I understood you correctly: you have two boxes, only one needs to be clicked on and the name of that object needs to be logged or uses for accuracy logging - right?). <br><br>'Designate "theState" as the Default Slide State, which is the<br> 'current, ActiveState on the Slide object "Stimulus"<br><br> Dim theState as SlideState<br> Set theState = Slide5.States("Default")<br><br> Dim next_mX as Long, next_mY as Long<br><br> Dim strHit As String<br> Dim theMouseResponseData As MouseResponseData<br><br> Do until (strHit = "leftbutton" or strHit = "rightbutton") <font style="color: rgb(153, 0, 255);" color="#ff0000"><= this line seems superfluous to me; in the next line (.count > 0) it is determined wheter a click is made, so there is no point in determining it also in the previous line, moreover, strhit does not yet have a value (was created only two lines above) and will also never get the value of the button that was clicked with and lastly a do until loop in this script is not needed. </font><br> 'Was there a response?<br> If Slide5.InputMasks.Responses.Count > 0 Then<br><div><br> 'Get the mouse response<br> Set theMouseResponseData = CMouseResponseData(Slide5.<wbr>InputMasks.Responses(1))<br><br> 'Determine string name of Slide or SlideText object at<br> 'mouse click coordinates. Assign that value to strHit<br> strHit = theState.HitTest(<wbr>theMouseResponseData.CursorX,<wbr>theMouseResponseData.CursorY)<br><br> 'Compare string name where mouse click occurred to CorrectAnswer<br> 'attribute on each trial, and score response<br> 'NOTE: This comparison is case sensitive<br> If strHit = "leftbutton" or strHit = "rightbutton" Then<br> GoTo begingame<br><br> End if <span style="color: rgb(153, 0, 255);"><^= with this IF THEN loop you tell the program to goto a label (I suppose? begingame?) if strhit contains the value of either of your response buttons - but strhit will never holds that value, in the strHit= line four lines above it is given the value of name of the subobject that the mouseclick was made on (I.e. textbox1 or image1 or whatever name you defined for this subobject). StrHit will remain empty ("") if the click was made anywhere else than on a subobject on the slide. </span><br><br> Do Until (strHit = "leftbutton" or strHit = "rightbutton") <span style="color: rgb(153, 0, 255);"></span><br> ' capture & process further mouse clicks:<br> If (Mouse.Buttons And ebMouseButton1) Then<br> <wbr> Mouse.GetCursorPos next_mX, next_mY<br> <wbr> strHit = theState.HitTest( next_mX, next_mY )<br> End If<br><br> If strHit = "leftbutton" or strHit = "rightbutton" Then<br> GoTo begingame<br> End If<br><br> Loop <span style="color: rgb(153, 0, 255);"><^= similar to previous do until loop, this one is not useful and I actually do not quite understand what it does :s <br><br>So... I think this more original code (which a slight addition) should actually work for your purpose:<br></span></div><br> Set theState = Slide5.States("Default")
<br>
<br> 'Was there a response?
<br> If Slide5.InputMasks.Responses.Count > 0 Then
<br><div>
<br> 'Get the mouse response
<br> Set theMouseResponseData =
CMouseResponseData(Slide5.<wbr>InputMasks.Responses(1))
<br>
<br> 'Determine string name of SlideImage or SlideText object at
<br> 'mouse click coordinates. Assign that value to strHit
<br> strHit = theState.HitTest(<wbr>theMouseResponseData.CursorX,
theMouseResponseData.CursorY)
<br>
<br> 'if strhit is empty (""), which is the case when the click was made outside an slide subobjct, the<br> ' program is redirected to 'begingame' which is a label preceding the slide.<br><br> If strHit = ("") Then
<br> Goto begingame<br> Else
<br> c.SetAttrib "response", strHit
<br><br> End if<br> <br> Else
<br>
<br> End If
<br>
<br><br></div><br><br>Place this code in an inline following your slide. On the slide itself give names to each of the two subobjects that can be clicked on and also (if needed?) create an attribute in your list called CorrectAnswer, for which each cell holds the name of the subject that is the correct answer in that trial (if there is no correct anwer the lines from "If strhit =" to the next "End IF" can be removed. <br><br><br>On Sunday, 15 July 2012 08:04:05 UTC+2, David Wang wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><p style="text-align:center;clear:both"><a style="margin-left:1em;margin-right:1em" href="https://lh3.googleusercontent.com/-AOA1B2sdj6g/UAJdRKd8hAI/AAAAAAAAAD4/4CPkYnpqzd8/s1600/error.jpg" target="_blank"><img origsrc="https://lh3.googleusercontent.com/-AOA1B2sdj6g/UAJdRKd8hAI/AAAAAAAAAD4/4CPkYnpqzd8/s320/error.jpg" border="0" height="171" width="320"></a></p>This is the error screen I get when I try to generate script.<br></blockquote>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "E-Prime" group.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msg/e-prime/-/F5-FlLXgFoUJ">https://groups.google.com/d/msg/e-prime/-/F5-FlLXgFoUJ</a>.<br />
To post to this group, send email to e-prime@googlegroups.com.<br />
To unsubscribe from this group, send email to e-prime+unsubscribe@googlegroups.com.<br />
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en.<br />