mawilson

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • in reply to: Non-breaking space in items? #11008
    mawilson
    Participant

    I ended up figuring something out; here’s the code I used in case it’s of use to anyone else.

    PennController.ResetPrefix(null)
    
    Sequence(
        'example',
        SendResults()
    )
    
    Template('example.csv', item => {
        var sentence = item.sentence.split(' ')
        var s_array = []
        for (var word of sentence) {
            word = word.replace(' ', ' ')
            s_array.push(word)
        }
        sentence = s_array
        
        return [
            'example',
            'DashedSentence', 
            {s: sentence, display: 'in place'}
        ] 
    })
    

    The basic idea is to modify the item prior to running each trial. I split the sentence on spaces (which won’t split the literal  ). Replace the  s with actual spaces, and then pass that array to the controller instead of the sentence stored in the csv.

    • This reply was modified 1 month, 1 week ago by mawilson. Reason: make MWE more minimal
    • This reply was modified 1 month, 1 week ago by mawilson. Reason: fix formatting
    • This reply was modified 1 month, 1 week ago by mawilson.
    • This reply was modified 1 month, 1 week ago by mawilson.
    in reply to: Server issues? #9684
    mawilson
    Participant

    Ah, that’d be it—I’ve changed institutions and hadn’t updated the email address. Thank you!

    in reply to: Server issues? #9680
    mawilson
    Participant

    Ah, I see. Thanks for the info!

    I don’t think I’m on the mailing list; would it be possible for me to sign up for it so I can get these announcements directly? I can’t seem to find anything on the main site (but I could well be missing something).

    • This reply was modified 1 year, 6 months ago by mawilson.
    in reply to: Removing default text when participant enters text #9631
    mawilson
    Participant

    Thank you!

    in reply to: Bug with end() before newMouseTracker #8412
    mawilson
    Participant

    Oh, forgot to add: I’m using whatever version of PennController is currently on the PCIbex Farm (which I think is 1.9).

    mawilson
    Participant

    Okay, so after some testing I’ve been able to pare this issue down to what I think is the bare minimum. Using end() in a trial with a MouseTracker before the MouseTracker is initialized causes the script to freeze with the error above in the JavaScript console. Here’s a much more minimal example that shows the problem (link same as before, https://farm.pcibex.net/r/BtxkDp/):

    
    PennController.ResetPrefix(null) // Shorten command names (keep this line here)
    
    Sequence('trial')
    
    newTrial('trial',
        newText('').log(), // this is just so there's a result to send, otherwise it spins forever
        end(),
        newMouseTracker('mouse') // comment out this line, or put it before end(), and it works
    )
    
    • This reply was modified 1 year, 7 months ago by mawilson. Reason: code formatting
    in reply to: Concatenating variables and text #8400
    mawilson
    Participant

    I’ve realized how to deal with my case; it’s actually pretty easy since JavaScript lets you use addition to concatenate variables of different types.

    
    newVar('grandaveragepercent')
        .set(getVar('grandaverage'))
        .set(v => Math.round(v * 100) + '%.')
    

    Then just display the text as before, minus the .after(newText('%.')).

    (I’d still be curious how this would work if I had two text variables I wanted to concatenate, since IIRC the way variables work in PCIbex wouldn’t just let you do getVar('mytextvariable1') + getVar('mytextvariable2').)

    in reply to: Conditional feedback based on DragDrop response #8303
    mawilson
    Participant

    Thank you for the help—this is working great now!

    in reply to: MouseTracker only while dragging for use with DragDrop #8295
    mawilson
    Participant

    Perfect—thank you so much!

    in reply to: Logging value of randomly chosen text #8289
    mawilson
    Participant

    Nevermind; I figured out how to do this. I’ll post it in case anyone else comes across a similar issue.

    
    Template("practice.csv", variable => {
        var word = variable['word_' + Math.floor(Math.random() * 12)];
        return newTrial("trial_prac",
            // ... whatever else you want here
            newText("word", word)
            // ... whatever else you want here
        ).log("word", word)
    })
    
    mawilson
    Participant

    Thank you! It’s working great now!

    mawilson
    Participant

    Thank you for the help!

    in reply to: Can counterOverride be used instead of URL parameter? #6183
    mawilson
    Participant

    Thanks! It does appear to be working. I just wasn’t sure if it would since the groups are set a bit differently than in base Ibex.

    in reply to: Enabling a button after text is entered without pressing Enter #6155
    mawilson
    Participant

    This is probably similar enough to fit in this thread, but is there a way to do this for a checkbox (i.e., only enable the button when the checkbox is selected). This one is more crucial since it’s for an HTML consent form, and I want to make absolutely sure people can’t get past the form unless the box saying they consent is checked.

    in reply to: Enabling a button after text is entered without pressing Enter #6150
    mawilson
    Participant

    No worries! Thank you for all the help!

Viewing 15 posts - 1 through 15 (of 19 total)