If...Or...Then
Michiel Spape
Michiel.Spape at nottingham.ac.uk
Thu Sep 23 09:17:31 UTC 2010
Hi,
It gives me headache just looking at it! I'm sure David mcF would be better at cleaning this up, but:
1. try to separate multiple AND/ORs using brackets, unless you're REALLY sure about eBasic's priority: does AND go before =, does equal go before OR, does AND go before OR? I'm assuming you mean IF (LotteryChoice.RESP = "1" and (c.GetAttrib("Feedback1") = "0" or c.GetAttrib("Feedback2") = "0" or c.GetAttrib("Feedback3") = "0") then.
2. AND ...(c.GetAttrib("Feedback1") = "0" OR ... etc
Is the same as c.GetAttrib("Feedback1") * c.GetAttrib("Feedback2") * c.GetAttrib("Feedback3") = 0. Awesome trick, no?
3. how about:
----
If (c.GetAttrib("FeedBack1") * c.GetAttrib("FeedBack2") * c.GetAttrib("Feedback3")) = 0 then
Set Slide1.ActiveState = "Default" & LotteryChoice.RESP ' ...assuming it can be 1 to 3
End if
....
4. Do stuff with else and cases. Also, you might wish to nest bits.
5. The problem, if you say every IF here turns out wrong is indeed either in your ifs, so you need to clean those up, or in the premises (LotteryChoice.RESP, c.GetAttrib("Feedback")). Why don't you debug.print what the answer to the premises is?
Debug.print "LotteryChoice.RESP was " & LotteryChoice.RESP
Debug.print "Feedback1 was: " & c.GetAttrib("Feedback1").
If it so happens that these are correctly found at the level of your script, and your IF statements still all turn false, then your IF statements are false, so your IF-THENs are not working (I also make messy ones from time to time!).
Cheers,
Mich
If LotteryChoice.RESP = "1" And c.GetAttrib("FeedBack1") = "0"
OR c.GetAttrib("FeedBack2") = "0" OR c.GetAttrib("FeedBack3") = "0"
Then
Set Slide1.ActiveState = "Default1"
End If
If LotteryChoice.RESP = "2" And c.GetAttrib("FeedBack1") = "0" OR
c.GetAttrib("FeedBack2") = "0" OR c.GetAttrib("FeedBack3") = "0" Then
Set Slide1.ActiveState = "Default2"
End If
If LotteryChoice.RESP = "3" And c.GetAttrib("FeedBack1") = "0" OR
c.GetAttrib("FeedBack2") = "0" OR c.GetAttrib("FeedBack3") = "0" Then
Set Slide1.ActiveState = "Default3"
End If
If LotteryChoice.RESP = "1" And c.GetAttrib("FeedBack1") = "1" OR
c.GetAttrib("FeedBack2") = "1" OR c.GetAttrib("FeedBack3") = "1" Then
Set Slide1.ActiveState = "Victory1"
End If
If LotteryChoice.RESP = "2" And c.GetAttrib("FeedBack1") = "1" OR
c.GetAttrib("FeedBack2") = "1" OR c.GetAttrib("FeedBack3") = "1" Then
Set Slide1.ActiveState = "Victory2"
End If
If LotteryChoice.RESP = "3" And c.GetAttrib("FeedBack1") = "1" OR
c.GetAttrib("FeedBack2") = "1" OR c.GetAttrib("FeedBack3") = "1" Then
Set Slide1.ActiveState = "Victory3"
End If
If LotteryChoice.RESP = "1" And c.GetAttrib("FeedBack1") = "2" OR
c.GetAttrib("FeedBack2") = "2" OR c.GetAttrib("FeedBack3") = "2" Then
Set Slide1.ActiveState = "Lose1"
End If
If LotteryChoice.RESP = "2" And c.GetAttrib("FeedBack1") = "2" OR
c.GetAttrib("FeedBack2") = "2" OR c.GetAttrib("FeedBack3") = "2" Then
Set Slide1.ActiveState = "Lose2"
End If
If LotteryChoice.RESP = "3" And c.GetAttrib("FeedBack1") = "2" OR
c.GetAttrib("FeedBack2") = "2" OR c.GetAttrib("FeedBack3") = "2" Then
Set Slide1.ActiveState = "Lose3"
End If
Michiel Spapé
Research Fellow
Perception & Action group
University of Nottingham
School of Psychology
www.cognitology.eu
-----Original Message-----
From: e-prime at googlegroups.com [mailto:e-prime at googlegroups.com] On Behalf Of Matt Paffel
Sent: 22 September 2010 22:35
To: E-Prime
Subject: If...Or...Then
Hello
I have Multiple slideslates that I'm tring to change based on the
script below, however the script isn't performing as I'd like it to.
The message from the output window after debugging states:
3Lose3
False
2Lose3
False
1Lose3
False
This tells me that it's collecting the responses correctly and setting
a slide state but it looks as though the program is going through the
arguments and declaring them all false, which is not the case. Is
there something I need to include as the arguments make use of the
"OR" statement or is something else such as my overzealous use of the
If...Then statement?
Note: I've added indents here to make it easier to look at.
If LotteryChoice.RESP = "1" And c.GetAttrib("FeedBack1") = "0"_
OR c.GetAttrib("FeedBack2") = "0" OR c.GetAttrib("FeedBack3") = "0"
Then
Set Slide1.ActiveState = "Default1"
End If
If LotteryChoice.RESP = "2" And c.GetAttrib("FeedBack1") = "0" OR
c.GetAttrib("FeedBack2") = "0" OR c.GetAttrib("FeedBack3") = "0" Then
Set Slide1.ActiveState = "Default2"
End If
If LotteryChoice.RESP = "3" And c.GetAttrib("FeedBack1") = "0" OR
c.GetAttrib("FeedBack2") = "0" OR c.GetAttrib("FeedBack3") = "0" Then
Set Slide1.ActiveState = "Default3"
End If
If LotteryChoice.RESP = "1" And c.GetAttrib("FeedBack1") = "1" OR
c.GetAttrib("FeedBack2") = "1" OR c.GetAttrib("FeedBack3") = "1" Then
Set Slide1.ActiveState = "Victory1"
End If
If LotteryChoice.RESP = "2" And c.GetAttrib("FeedBack1") = "1" OR
c.GetAttrib("FeedBack2") = "1" OR c.GetAttrib("FeedBack3") = "1" Then
Set Slide1.ActiveState = "Victory2"
End If
If LotteryChoice.RESP = "3" And c.GetAttrib("FeedBack1") = "1" OR
c.GetAttrib("FeedBack2") = "1" OR c.GetAttrib("FeedBack3") = "1" Then
Set Slide1.ActiveState = "Victory3"
End If
If LotteryChoice.RESP = "1" And c.GetAttrib("FeedBack1") = "2" OR
c.GetAttrib("FeedBack2") = "2" OR c.GetAttrib("FeedBack3") = "2" Then
Set Slide1.ActiveState = "Lose1"
End If
If LotteryChoice.RESP = "2" And c.GetAttrib("FeedBack1") = "2" OR
c.GetAttrib("FeedBack2") = "2" OR c.GetAttrib("FeedBack3") = "2" Then
Set Slide1.ActiveState = "Lose2"
End If
If LotteryChoice.RESP = "3" And c.GetAttrib("FeedBack1") = "2" OR
c.GetAttrib("FeedBack2") = "2" OR c.GetAttrib("FeedBack3") = "2" Then
Set Slide1.ActiveState = "Lose3"
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 this group at http://groups.google.com/group/e-prime?hl=en.
This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
--
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