## WeBWorK Problems

### Scoring based only on problemPanic.pl hints

by Albin Niva Printz -
Number of replies: 1
Hi,

We have a setup in which there are problems without answer inputs, but only problemPanic.pl hints. We would like the score to be registered when the student presses the hint button. I believe this is the way it used to work in a previous webwork version. Does anyone know how to get this to work?

Here's an example scenario:

DOCUMENT();

PGstandard.pl
problemPanic.pl
));

TEXT(beginproblem());

BEGIN_TEXT
Press the button, hint should be registered
$PAR \{ Panic::Button(label => "Request a Hint (25% Penalty)", penalty => .25) \} END_TEXT if ($panicked) {
BEGIN_TEXT
$PAR${BBOLD}Hint:${EBOLD} Here's a hint!$PAR
END_TEXT
}

ENDDOCUMENT();

Pressing the Request a hint button displays the green all of the answers above are correct", but 0% correct is registered.

Thanks!

-Albin
In reply to Albin Niva Printz

### Re: Scoring based only on problemPanic.pl hints

by Davide Cervone -
install_problem_grader(sub {
return ({score=> 1, recorded_score => 0, type=>'always_right'},
{num_of_correct_ans => 0, num_of_incorrect_ans => 0});
});

just after the
TEXT(beginproblem());

and see if that doesn't do it. This should provide a normal score of 1, (without the penalty) and .25 if the panic button was pressed.

If you want 0 unless the panic button was pressed, then use

install_problem_grader(sub {
return ({score=> ($main::panicked ? .25 : 0), recorded_score => 0, type=>'always_right'}, {num_of_correct_ans => 0, num_of_incorrect_ans => 0}); });  Again, the panicked score is .25, but you can change that to 1 if you prefer: install_problem_grader(sub { return ({score=> ($main::panicked ? 1 : 0), recorded_score => 0, type=>'always_right'},
{num_of_correct_ans => 0, num_of_incorrect_ans => 0});
});

Hope that works for you.

Davide