Help with survey page 'error' script


Author
Message
GeeP
GeeP
Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)
Group: Forum Members
Posts: 81, Visits: 118

Dear All,



I have the following conditional script for launching error messages when completing a rank-ordering (pasted below). However, when I run the script, inquisit says that 'trial.error1' is an invalid or unknown expression. This is the only issue that inquisit pops up when I try to run the entire script. I am stuck and unable to understand what is wrong. If anyone can suggest why this may be so, I would be extremely grateful!



Thank you in advance


Best


-G




<surveypage rankselfsurvey>


/ fontstyle = ("Arial", 2.31%, true, false, false, false, 5, 0)


/ questions = [1=rankself1; 2=rankself2; 3=rankself3; 4=rankself4] 


/ branch = [if (textbox.rankself1.response + textbox.rankself2.response + textbox.rankself3.response + textbox.rankself4.response != 10) trial.error2]


/ branch = [if (textbox.rankself1.response > 4) trial.error1]


/ branch = [if (textbox.rankself1.response < 1) trial.error1]


/ branch = [if (textbox.rankself2.response > 4) trial.error1]


/ branch = [if (textbox.rankself2.response < 1) trial.error1]


/ branch = [if (textbox.rankself3.response > 4) trial.error1]


/ branch = [if (textbox.rankself3.response < 1) trial.error1]


/ branch = [if (textbox.rankself4.response > 4) trial.error1]


/ branch = [if (textbox.rankself4.response < 1) trial.error1]


</surveypage>



<trial error2>


/ stimulusframes = [1=error2]


</trial>



trial error1>


/ stimulusframes = [1=error1]


</trial>




<text error1>


/items = errormessages


/ select = 1


/ txcolor = red


/ position = (50%, 50%)


/ fontstyle = ("Verdana", 4%)


</text>



<text error2>


/items = errormessages


/ select = 2


/ txcolor = red


/ position = (50%, 50%)


/ fontstyle = ("Verdana", 4%)


</text>



<item errormessages>


/ 1 = "Error: Please enter a number between 1 and 4 only."


/ 2 = "Error: The four numbers must sum to a total of 10."


</item>



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K


trial error1>


/ stimulusframes = [1=error1]


</trial>



Note the missing '<'.



GeeP
GeeP
Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)
Group: Forum Members
Posts: 81, Visits: 118

OMG!!! Thanks a ton Dave!



I feel like an idiot, but also as if I won a million dollars! I have been at this script for hours now...I guess I need a break!! :)


GeeP
GeeP
Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)
Group: Forum Members
Posts: 81, Visits: 118

Hi Dave,



I am having issues with branching, would you mind helping me with this script?


I have two error scripts:


error 1: that when rank ordering the 4 ranks (1, 2, 3 and 4) must add up to 10, else the error. However, I have another error for urging people to enter only numbers between 1-4. I have specified the range but I don't know what script I should add to define the branching when an error is made. Kindly help me when you get a chance. Here is the script:


The script is in bold and I have underlined it. When I run it, 'error2' works well, but error1 does nothing! :(



<surveypage rankselfsurvey>


/ fontstyle = ("Arial", 2.31%, true, false, false, false, 5, 0)


/ questions = [1=rankself1; 2=rankself2; 3=rankself3; 4=rankself4] 


/ branch = [if (textbox.rankself1.response + textbox.rankself2.response + textbox.rankself3.response + textbox.rankself4.response != 10) trial.error2]


/ branch = [if (textbox.rankself1.response > 4) trial.error1]


/ branch = [if (textbox.rankself1.response < 1) trial.error1]


/ branch = [if (textbox.rankself2.response > 4) trial.error1]


/ branch = [if (textbox.rankself2.response < 1) trial.error1]


/ branch = [if (textbox.rankself3.response > 4) trial.error1]


/ branch = [if (textbox.rankself3.response < 1) trial.error1]


/ branch = [if (textbox.rankself4.response > 4) trial.error1]


/ branch = [if (textbox.rankself4.response < 1) trial.error1]


</surveypage>





<trial error2>


/ stimulusframes = [1=error2, back]


/ correctresponse = (back)


/ inputdevice = mouse


/ branch = [if (trial.error2.correctstreak >= 1) surveypage.rankselfsurvey]


</trial>



<trial error1>


/ stimulusframes = [1=error1, back]


/ correctresponse = (back)


/ inputdevice = mouse


/ branch = [if (trial.error1.correctstreak >= 1) surveypage.rankselfsurvey]


</trial>



Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

(1) Generally:


that when rank ordering the 4 ranks (1, 2, 3 and 4) must add up to 10, else the error.


Is that really such a good idea? Sure enough, 1+2+3+4 equals 10, but so does 2+2+2+4, 2+2+3+3, 1+3+3+3, 1+1+4+4, ...


(2) What does "does nothing" mean when you say


The script is in bold and I have underlined it. When I run it, 'error2' works well, but error1 does nothing! :(


? You have to be way more specific than that. Also, the conditions in your /branches seem unnecessary:


/ branch = [if (trial.error2.correctstreak >= 1) surveypage.rankselfsurvey]


will always be true in the context of your <trial> setup. So why not go for the less arcane, unconditional


/ branch = [surveypage.rankselfsurvey]


instead?


(3) When posting code, it is sometimes helpful to provide something that can actually be run, i.e., stuff including all necessary elements (but nothing more). To post longer scripts, you may use the forum's attachment facility (see the 'Options' tab when writing a post.


(4) Also note that you can directly restrict the input a <textbox> will accept via /mask and /range (see the Inquisit documentation for details).


Regards,


~Dave


GeeP
GeeP
Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)
Group: Forum Members
Posts: 81, Visits: 118

Hi Dave,



I am sorry about the shoddy nature of the question.


What I meant was that for rank ordering 4 individuals, and to make sure that Ps assign only one rank per person and also to make sure that only numbers 1-4 have been used, I used 2 error scripts.


1. error1 pops up when a participant enters a number which is either < 1 or >4.


2. error2 pops up when a participant enters numbers which don't add up to 10 (1+2+3+4). I completely understand that this isn't a good idea, as they can enter 2+2+3+3 and still get away without an error.


The issue is I am not completely sure what method to use to make sure that once an individual has been assigned a rank, that rank is no longer available for assigning it to another. I am very new to inquisit and  am trying.


I had no idea that I could post the entire script here. However, is it OK to post something which is what we think is a very novel paradigm and are reluctant to share? OR may we just post that particular block?


Kindly pardon me for the previously ill-written request.


Best


-G


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

I am sorry about the shoddy nature of the question.


Don't be, there's no reason to be sorry. I just can't help you if there's insufficient or incomplete info available. Thus I'm pointing it out.


The issue is I am not completely sure what method to use to make sure that once an individual has been assigned a rank, that rank is no longer available for assigning it to another.


You might want to review my reply to your earlier post (https://www.millisecond.com/forums/Topic7524.aspx#7524), 'cause the code I posted there will do just that. It can be easily adapted to use <textbox> elements instead of <dropdown>s. Also see my previous reply in this thread re. restricting input on <textbox>es.


I had no idea that I could post the entire script here. However, is it OK to post something which is what we think is a very novel paradigm and are reluctant to share? OR may we just post that particular block?


I'd actually prefer if you do not post the whole script, which would inevitably include lots of stuff irrelevant to the question. Only the part highlighting the issue will suffice (including all the stuff necessary to run said part). The fewer lines of code, the easier it is for me to focus on the actual problem.


Thanks,


~Dave


GeeP
GeeP
Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)
Group: Forum Members
Posts: 81, Visits: 118

HI Dave! :)



I wanted to thank you for helping me with the rank ordering script! I used the drop down version you had suggested and it works perfect!  :)



Thanks a ton!


Best


-G


Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K

Okay, glad to hear that. For the sake of completeness, if you wanted to do the same thing using <textbox> elements, you'd simply go for something along the lines of


<values>
/ rankstring = ""
/ validranking = false
</values>

<block myblock>
/ trials = [1=mypage]
</block>

<surveypage mypage>
/ questions = [1=t01; 2=t02; 3=t03; 4=t04]
/ ontrialbegin = [values.rankstring=""]
/ ontrialend = [values.rankstring=concat(values.rankstring,textbox.t01.response)]
/ ontrialend = [values.rankstring=concat(values.rankstring,textbox.t02.response)]
/ ontrialend = [values.rankstring=concat(values.rankstring,textbox.t03.response)]
/ ontrialend = [values.rankstring=concat(values.rankstring,textbox.t04.response)]
/ ontrialend = [if (
        contains(values.rankstring,"1") &&
        contains(values.rankstring,"2") &&
        contains(values.rankstring,"3") &&
        contains(values.rankstring,"4")
    )
    values.validranking = true else values.validranking = false]
/ branch = [if ( values.validranking == false) surveypage.mypage]
</surveypage>

<textbox t01>
/ mask = positiveinteger
/ range = (1,4)
/ minchars = 1
/ maxchars = 1
</textbox>

<textbox t02>
/ mask = positiveinteger
/ range = (1,4)
/ minchars = 1
/ maxchars = 1
</textbox>

<textbox t03>
/ mask = positiveinteger
/ range = (1,4)
/ minchars = 1
/ maxchars = 1
</textbox>

<textbox t04>
/ mask = positiveinteger
/ range = (1,4)
/ minchars = 1
/ maxchars = 1
</textbox>


Regards,


~Dave


GeeP
GeeP
Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)Guru (8.6K reputation)
Group: Forum Members
Posts: 81, Visits: 118

Thanks a ton Dave! 


This was very helpful!


If you don't mind, I had a few questions about error srcipts. I am absolutely not sure how to do this:


1. How do I add an error script to open-ended questions?


here is the short script:



<expt 1>


/ blocks = [1=whyquestions]


 </expt>


<block whyquestions>


/ preinstructions = (whyquestions)


/ screencolor = (255, 255, 255)


/ trials = [1 = question_why1; 2 = question_why2]


 </block>


<openended question_why1>


/stimulustimes = [000=question_why1]


/ charlimit = 250


/ size=(400, 100)


</openended>


<openended question_why2>


/stimulustimes = [000=question_why2]


/ charlimit = 250


/ size=(400, 100)


</openended>


<text question_why1>


/ items = ("Why did you choose the individual whom you ranked the BEST?")


/ position = (50, 25)


</text>


<text question_why2>


/ items = ("Why did you choose the individual whom you ranked the LEAST?")


/ position = (50, 25)


</text>


 <page whyquestions>


Great job! We have a few questions.


 </page>


/ position = (50, 25)


</text>



2. How do I add a textbox for entering an ID number for Ps with a forced response? I want to add this at the end of the study. My study has two sessions and so this is important to link both sessions.


It would be a huge help you can let me know what to do!


Very grateful!


-G


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search