Redirecting participants to different websites, chosen within the experiment


Author
Message
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: 13K, Visits: 109K
Sercan - 10/20/2025
Dave - 10/20/2025
Sercan - 10/20/2025
It appears the issue was caused by my use of values.completioncode, which was not set anywhere in <values>; it was supposed to be parameters.completioncode. My use of values.completioncode in that if-statement caused the code to quit working from there and onward, without warning.

Okay, so is it sorted now? If yes, then I need not spend additional time reformatting and trying to understand that code. It's hard to say in its current state what it's even supposed to do, since it's lacking comments, missing statement separators to ease reading, seems to use if constructs in places where if - else if would seemingly be more appropriate, and gnerally I can't know what the task scripts do or do not do correctly in terms of setting variables.

Yes, it is settled.

Excellent, thank you.
Sercan
Sercan
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 37, Visits: 165
Dave - 10/20/2025
Sercan - 10/20/2025
It appears the issue was caused by my use of values.completioncode, which was not set anywhere in <values>; it was supposed to be parameters.completioncode. My use of values.completioncode in that if-statement caused the code to quit working from there and onward, without warning.

Okay, so is it sorted now? If yes, then I need not spend additional time reformatting and trying to understand that code. It's hard to say in its current state what it's even supposed to do, since it's lacking comments, missing statement separators to ease reading, seems to use if constructs in places where if - else if would seemingly be more appropriate, and gnerally I can't know what the task scripts do or do not do correctly in terms of setting variables.

Yes, it is settled.
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: 13K, Visits: 109K
Sercan - 10/20/2025
It appears the issue was caused by my use of values.completioncode, which was not set anywhere in <values>; it was supposed to be parameters.completioncode. My use of values.completioncode in that if-statement caused the code to quit working from there and onward, without warning.

Okay, so is it sorted now? If yes, then I need not spend additional time reformatting and trying to understand that code. It's hard to say in its current state what it's even supposed to do, since it's lacking comments, missing statement separators to ease reading, seems to use if constructs in places where if - else if would seemingly be more appropriate, and gnerally I can't know what the task scripts do or do not do correctly in terms of setting variables.
Sercan
Sercan
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 37, Visits: 165
It appears the issue was caused by my use of values.completioncode, which was not set anywhere in <values>; it was supposed to be parameters.completioncode. My use of values.completioncode in that if-statement caused the code to quit working from there and onward, without warning.
Sercan
Sercan
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 37, Visits: 165
Here is the full batch script. I've confirmed that everything before the // COMPLETION CODES // bit runs correctly.

<defaults>
/ minimumversion = "6.0.0.0"
/ txbgcolor = white
/ txcolor = black
/ finishpage = "https://app.prolific.co/submissions/complete?cc=INITIALIZED"
</defaults>


<batch fullexperiment>
/ file = "infopage.iqx"
/ file = "debug.iqx"
/ file = "induction.iqx"

/ file = "pre_likerts.iqx"
/ file = "delayaat.iqx"
/ file = "memorygrid.iqx"
/ file = "post_likerts.iqx"

/ file = "contingency.iqx"
/ file = "questionnaire_posttask.iqx"
/ file = "taskquestions.iqx"
/ file = "debqres.iqx"
/ file = "fcqtr.iqx"

/ file = "debriefing.iqx"
/ file = "attcatcher.iqx"

/ onscriptend = [
    
    // set language
    if(batch.fullexperiment.currentscript=="infopage.iqx"){
        parameters.languageshift=values.languageshift;
        parameters.finishpagetype=values.finishpagetype;
    }
    
    //////////////////////////////
    // record attention mishaps //
    //////////////////////////////
    if( batch.fullexperiment.currentscript == "delayaat.iqx" ||
        batch.fullexperiment.currentscript == "taskquestions.iqx" ||
        batch.fullexperiment.currentscript == "questionnaire_posttask.iqx" ||
        batch.fullexperiment.currentscript == "debqres.iqx" ||
        batch.fullexperiment.currentscript == "fcqtr.iqx"){
            parameters.attentionsuccess = parameters.attentionsuccess + values.attentionsuccess;
    }
    
    if(batch.fullexperiment.currentscript == "attcatcher.iqx" || batch.fullexperiment.currentscript == "debriefing.iqx"){
        if(parameters.attentionsuccess >=8){ //max is 9
            parameters.completioncode = values.correctcc;
        }else{
            parameters.completioncode = values.rejectcc;
        }
    }else{
        parameters.completioncode = batch.fullexperiment.currentscript;
        if(batch.fullexperiment.currentscript=="infopage.iqx"){
            parameters.completioncode=values.screenoutcc;
        }
    }
    
    //////////////////////
    // Completion codes //
    //////////////////////
    if(parameters.finishpagetype=="Other"){
        if(values.completioncode == values.correctcc){
            defaults.finishpage="XXX";
            if(parameters.languageshift==0){
                defaults.finishpage="XXX";
            }
            if(parameters.languageshift==1){
                defaults.finishpage="XXX";
            }
            if(parameters.languageshift==2){
                defaults.finishpage="XXX";
            }
        }
    }else if(parameters.finishpagetype=="Prolific"){
        defaults.finishpage = "https://app.prolific.co/submissions/complete?cc=<%parameters.completioncode%>";
    }else if(parameters.finishpagetype == "SalzburgUni"){
        if(parameters.completioncode == values.correctcc){
            parameters.completioncode = "XXXX";
        }
        defaults.finishpage = "https://salzburg.sona-systems.com/webstudy_credit.aspx?experiment_id=793&credit_token=<%parameters.completioncode%>";
        parameters.debug="Test.";
    }else{
        defaults.finishpage="google.com";
    }
    
    parameters.debug="I have run.";
]
</batch>

##############
# completion #

<values>
/ correctcc = "XXXX"
/ screenoutcc = "XXXX"
/ rejectcc = "XXXX"
/ attentionsuccess = 0
/ languageshift = 0
/ finishpagetype = 0
</values>

<parameters fullexperiment>
/ attentionsuccess = 0
/ completioncode = "INCOMPLETE"
/ finishpagetype = "indeterminate"
/ languageshift = 0
/ debug = 0
</parameters>

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: 13K, Visits: 109K
Sercan - 10/20/2025
If parameters.finishpagetype is set to anything else, then no such aborting occurs and the debug parameter at the end is set.

Again, whithout you showing the actual code you're talking about, there is no way for anybody to spot and point out where your syntax mistakes are.
Sercan
Sercan
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 37, Visits: 165
If parameters.finishpagetype is set to anything else, then no such aborting occurs and the debug parameter at the end is set.
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: 13K, Visits: 109K
Sercan - 10/20/2025
Some more testing reveals that the / onscriptend bit is aborted once it evaluates if(parameters.finishpagetype=="Other") as true
It does not run what's between the {} and it also does not run anything after that, including code that is not enclosed in {} brackets anymore, including the aforementioned setting of a debug variable.

Then you have syntax mistakes. You don't show the actual code, so there's no way for me to tell you where you're going wrong
Sercan
Sercan
Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)Expert (1K reputation)
Group: Forum Members
Posts: 37, Visits: 165
Some more testing reveals that the / onscriptend bit is aborted once it evaluates if(parameters.finishpagetype=="Other") as true
It does not run what's between the {} and it also does not run anything after that, including code that is not enclosed in {} brackets anymore, including the aforementioned setting of a debug variable.
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: 13K, Visits: 109K
Sercan - 10/20/2025
Unfortunately the issue persists. The issue seems to be that the /onscriptend bit in the batch script does not always run.
I now set a parameter in the following manner:
parameters.debug="I have run.";


And I've added a script debug.iqx that comes after the first script, with the following code:

<text debug>
/ items= ("<%parameters.debug%> is the debug value")
/ position = (50%, 95%)
/ size = (100%,10%)
/ valign = center
/ halign = center
/ vjustify = center
/ erase = false
/ txbgcolor = transparent
/ fontstyle = ("Arial", 2%, false, false, false, false, 5, 1)
</text>

<trial debug>
/ stimulustimes = [0=debug]
/ validresponse = (anyresponse)
</trial>

<parameters>
/ debug = 0
</parameters>


Most of the time this just gives me 0 even though I set the debug parameter in the batch script. What do you advise?

Then you're not actually setting the parameter.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search