You could use a custom grader to make something like this happen. For example,
DOCUMENT(); # This should be the first executable line in the problem.
loadMacros(
"PGstandard.pl",
"MathObjects.pl",
"PGcourse.pl",
);
TEXT(beginproblem);
Context("Numeric");
BEGIN_TEXT
The ratio of the circumference of a circle to its diameter is: \{ans_rule(10)\}
END_TEXT
ANS(pi->cmp);
@hints = (
"It is a famous number.",
"It is represented by a greek letter.",
"It is better than cake!",
);
install_problem_grader(sub {
my ($result,$state) = avg_problem_grader(@_);
if ($state->{num_of_correct_ans} == 0) {
my $n = $state->{num_of_incorrect_ans} - 1;
$n = $#hints if $n > $#hints;
if ($n >= 0) {
$result->{msg} .= '</i><p><b>Note:</b> <i>' if $result->{msg};
$result->{msg} .= $hints[$n];
}
}
($result,$state);
});
ENDDOCUMENT(); # This should be the last executable line in the problem.
Here, the hints are stored in an array (
@hints) and the grader displays the proper one, depending on the number of answers that are incorrect so far. The last hint will be repeated if he student gets the problem wrong more times than there are hints. (You could make the last hint be something like "There are no more hints" if you don't want the last hint shown more than once.) When the student gets the problem right, no more hints will be shown (even if he or she submits additional wrong answers).
The hint will be preceded by the word "Note", but unfortunately, there is no way to prevent that, as it is added by the page layout engine and can't be overridden. It would be possible to use CSS style commands to style the hint text, like make it red or not italic, for example.
Note that this grader calls avg_problem_grader to do the work of grading the problem, which gives partial credit when one part is right in a multi-answer question. You could substitute std_problem_grader if you would prefer the answer to be right only when all the parts are answered correctly.
Hope that helps.
Davide