Feedback on the same screen as stimulus

Beckerlab eprimebeckerlab at gmail.com
Tue May 22 14:22:03 UTC 2012


So, I have this written

If stimulus.ACC = 0 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") =
c.GetAttrib("Check1Image") Then

			c.SetAttrib "Check" & nCheck & "Image", "redbox.jpg"

		Elseif c.GetAttrib("Check" & nCheck & "Image") =
c.GetAttrib("Check2Image") Then

			c.SetAttrib "Check" & nCheck & "Image", "redbox.jpg"

		Elseif c.GetAttrib("Check" & nCheck & "Image") =
c.GetAttrib("Check3Image") Then

			c.SetAttrib "Check" & nCheck & "Image", "redbox.jpg"

		Else c.GetAttrib("Check" & nCheck & "Image") =
c.GetAttrib("Check4Image") Then

			c.SetAttrib "Check" & nCheck & "Image", "redbox.jpg"

End If

Where Check1Image (or Check2Image, etc) refers to an attribute on my
triallist. I keep getting an error that says "Can't assign to
constant" and it's referring to my "then"?  Any ideas what I did wrong
here?

Thanks again!

On May 22, 10:17 am, David McFarlane <mcfar... at msu.edu> wrote:
> See the "Mid", "Context.GetAttrib", and "Context.SetAttrib" topics in
> the E-Basic Help facility.
>
> As for "brackets vs. quotes"...  Well, this gets indirectly to a pet
> peeve of mine.  You see, rational programming languages (such as C)
> use the same sytax for "subroutines" and "functions", and the best
> languages eliminate that distinction altogether (e.g., in C
> everything is a function -- "subroutines" are nothing more than
> functions that return void).  Alas, VBA (and thus E-Basic) makes a
> hard distinction between these two concepts.  This includes different
> syntax.  The arguments to VBA Functions *must* be enclosed in
> parentheses (), while the arguments to VBA Subroutines must *not* be
> enclosed in parentheses!  Sheesh!  And if you fail to do that, then
> you will get an error message that is entirely unrelated to the
> syntax error!  I cannot tell you how many hours I have lost in
> debugging errors due to this absurd difference in syntax.
>
> Anyway, if you are unsure how to use E-Prime, then you should first
> follow my advice in these two essays:http://groups.google.com/group/e-prime/browse_thread/thread/5425e0396...http://groups.google.com/group/e-prime/browse_thread/thread/b0ce54870...
>
> It would also not hurt if you took a course specific to E-Prime,
> e.g.,http://psychology.msu.edu/Workshops_Courses/eprime.aspx.
>
> In short, as in any serious enterprise, you need to first take time
> out to get proper training, and that means including training time in
> projected deadlines.
>
> -- David McFarlane
>
> At 5/22/2012 09:49 AM Tuesday, Beckerlab wrote:
>
> >Hey David,
>
> >I understand the code (I think), up until here:
>
> >         If Mid(strHit, 1, 5) = "Check" Then
>
> >                 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"
>
> >I don't know what the numbers 5,1 and 6,1 refer to...or why GetAttrib
> >and SetAttrib have a different syntax (brackets vs. quotes?)...or what
> >they do.  I think it's if you click on one, the other image will show,
> >but I am not sure of the logistics... I am also not sure how I would
> >modify for my case. I need it so it's not a single image, but all of
> >the images in the attribute that change if clicked. How do I reference
> >attributes like this? Attributename.Triallist?
>
> >My deadline is approaching and I am still quite unsure of how to use E-
> >prime...I am also not new to programming, so I am very frustrated...
>
> >Thanks for any help in advance.
>
> >On May 21, 2:52 pm, David McFarlane <mcfar... at msu.edu> wrote:
> > > nCheck is a variable.  If you look further up in the code then you
> > > should be able to figure out what it does (that's all I would do).
>
> > > -- David McFarlane
>
> > > At 5/20/2012 06:11 PM Sunday, Beckerlab wrote:
>
> > > >Thanks for the reply David!
>
> > > >I have tried to combine the 2 segments, but it won't work for some
> > > >reason... I am not sure why... I am having trouble trying to decipher
> > > >what
> > > >"If c.GetAttrib("Check" & nCheck & "Image") = "checkempty.bmp" Then
>
> > > >                         c.SetAttrib "Check" & nCheck & "Image",
> > > > "checkfull.bmp" "
>
> > > >Means? What is nCheck?
>
> > > >I just wanted to have a statement where If the stringhit = 1, then if
> > > >you clicked on it a check will appear, else a red X... not sure what
> > > >I'm doing wrong
>
> > > >Thanks in advance!
>
> > > >On May 17, 2:10 pm, David McFarlane <mcfar... at msu.edu> wrote:
> > > > > Oops, I see that you already found the PST examples, so you are ahead
> > > > > of me, I should have looked first!   I think you are on the right
> > > > track here.
>
> > > > > -- David McFarlane
>
> > > > > At 5/16/2012 02:41 PM Wednesday, you wrote:
>
> > > > > >After even more searching...I am thinking of modifying
>
> > > > > >http://www.pstnet.com/support/samples.asp?Mode=View&SampleID=38
>
> > > > > >(Load image after mouseclick), so that the image unclicked will be my
> > > > > >4 options, and after clicking, it'll go to a red x
>
> > > > > >I'm thinking some script like this
>
> > > > > >If mouseclick is on a certain image and strHit=1,
> > > > > >  display checkmark
>
> > > > > >If mouseclick is on another image and strHit = 0
> > > > > >display X
>
> > > > > >and if they click the correct 1, it goes to the next slide?
>
> > > > > >Hopefully it works!

-- 
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