This is a very simple perl script that casts a series of protection spells on your character, keeping grace at max throughout. Adjust the list of protection spells to include the ones you want to cast.
#!/usr/bin/perl use warnings; use strict; require "./subs.pl"; # get some subs to use $| = 1; # unbuffered output # The 'null' at the end is a simple way to make sure you're fully # graced up when this finishes. for my $type (qw( cold electricity poison confusion magic null )){ my @hp = request_line('stat hp'); my( $grace, $maxgrace ) = @hp[4,5]; while( $grace < $maxgrace ){ issue('use_skill praying'); @hp = request_line('stat hp'); ( $grace, $maxgrace ) = @hp[4,5]; } issue("invoke protection from $type"); } draw(3, "All protected!");