I'm working on a character sheet for the Fate RPG, which rates its skills with a numerical scale that corresponds to an adjective scale. I've been trying to write a macro that will take \skillAdj{4} and turn it into "Great" in a more elegant way than with these conditionals.
Ideally, I'd be able to do lookup in both directions, but I'm more concerned with going from number to adjective.
\usepackage{calc}
\usepackage{ifthen}
%
\newcounter{skillcounter}
\set{skillcounter}{0}
%
\newcommand[1]{\skillAdj}{\ifthenelse{\equal{#1}{8}
Legendary
}
{\ifthenelse{\equal{#1}{7}
Epic
}
{\ifthenelse{\equal{#1}{6}
Fantastic
}
{\ifthenelse{\equal{#1}{5}
Superb
}
{\ifthenelse{\equal{#1}{4}
Great
}
{\ifthenelse{\equal{#1}{3}
Legendary
}
{\ifthenelse{\equal{#1}{2}
Legendary
}
{\ifthenelse{\equal{#1}{1}
Legendary
}
{\ifthenelse{\equal{#1}{0}
Mediocre
}
{\ifthenelse{\equal{#1}{-1}
Poor
}
{\ifthenelse{\equal{#1}{-2}
Terrible
}
{\ifthenelse{\equal{#1}{-3}
Awful
}
{\ifthenelse{\equal{#1}{-4}
Abysmal
}
{Error}}}}}}}}}}}}}
This is the scale.
+8 Legendary
+7 Epic
+6 Fantastic
+5 Superb
+4 Great
+3 Good
+2 Fair
+1 Average
+0 Mediocre
-1 Poor
-2 Terrible
-3 Awful
-4 Abysmal
I'd really appreciate any helpful advice people have. I haven't found anything in the documentation of any of the packages that seem like they might provide this function.




xstring; but I'd prefer the first one that, however, requires a very up-to-date TeX distribution. – egreg May 13 '13 at 17:10