PennController for IBEX › Forums › Support › SetCounter("label", *number*) doesn't seem to work
- This topic has 3 replies, 2 voices, and was last updated 4 years, 7 months ago by
Jeremy.
-
AuthorPosts
-
December 31, 2019 at 2:11 pm #4662
Umesh
ParticipantI 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, 8 months ago by
Umesh.
January 5, 2020 at 8:35 pm #4665Jeremy
KeymasterHi 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,
JeremyJanuary 29, 2020 at 3:03 am #4678Umesh
ParticipantHi Jeremy,
Thanks a lot for the fix!Two follow-ups:
1. The option ofSetCounter("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 pageYou 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.January 29, 2020 at 10:52 am #4681Jeremy
KeymasterThank 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
-
This topic was modified 4 years, 8 months ago by
-
AuthorPosts
- You must be logged in to reply to this topic.