SetCounter("label", *number*) doesn't seem to work

PennController for IBEX Forums Support SetCounter("label", *number*) doesn't seem to work

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4662
    Umesh
    Participant

    I am trying to use the command ‘SetCounter’ with the syntax “PennController.SetCounter( “label” , number )”. If I understand the wiki page (https://www.pcibex.net/wiki/penncontroller-setcounter/) correctly, the number argument specifies the increment size for the counter. Somehow it doesn’t seem to work. So (a) below works, but for (b) I get the error message “ERROR: There must be some items in the running order!”.

    (a)

    PennController.Sequence("Setcounter", randomize("Experiment"), "SendResults");
    PennController.SetCounter("Setcounter");

    (b)

    PennController.Sequence("Setcounter", randomize("Experiment"), "SendResults");
    PennController.SetCounter("Setcounter", 4);

    I have four groups (lists) and want to gather more subjects only for one of the groups to balance the number of subjects across groups. Is there any other way to achieve that?

    • This topic was modified 4 years, 4 months ago by Umesh.
    #4665
    Jeremy
    Keymaster

    Hi Umesh,

    Thank you for reporting this, and sorry for the late reply. There is a bug in how I coded the parser for the parameters of SetCounter—I just fixed it for the next release. In the meantime, you can do this instead:

    PennController.SetCounter("Setcounter", "inc", 4);

    and of course you can always use the native Ibex syntax, though it’s deprecated:

    var items = [
      ["Setcounter", "__SetCounter__", {inc: 4}]
    ];

    Note though that the intended meaning of SetCounter("label", 4) (and the way it will work in the next release) is to set the counter to 4, not increment it by 4.

    Best,
    Jeremy

    #4678
    Umesh
    Participant

    Hi Jeremy,
    Thanks a lot for the fix!

    Two follow-ups:
    1. The option of SetCounter("label", "inc", number) is not mentioned in the wiki (https://www.pcibex.net/wiki/penncontroller-setcounter/). If it’s going to be a permanent feature, it might be useful to have it there.

    2. If SetCounter("label", 4) means set the counter to 4, not increment it by 4 then it is not consistent with the details on the wiki page

    You can also pass a number, as the single argument if you define no label, or as the second argument if the first is a string for the label. The number will be used to increment (if positive) or decrement (if negative) the counter by its value.

    Best,
    Umesh.

    #4681
    Jeremy
    Keymaster

    Thank you Umesh, I have updated the wiki page accordingly.

    I had meant SetCounter to increment (or decrement) the counter by default, but it appears I got lost somewhere along the way… I will change the behavior of the command in the next version of PennController (1.7)

    Jeremy

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.