# Programmatically highlighting element in beamer presentation

I am creating a presentation using latex and beamer. I plan to have a roadmap shown at certain points in the presentation. To this purpose, I have defined

\newcommand{\roadmapframe}[1]{
\begin{frame}

\setbeamercovered{transparent}

% if #1 (first argument) is not defined, print the whole thing.
%  Otherwise highlight only the one passed as #1. How to do this?

\begin{itemize}
\item<1> El 1
\item<1> El2
\item<0> El3

\end{frame}

}


I would like to behave it this way: If I call \roadmap, then all three items are printed with full opacity. If I call \roadmap{2}, then only the 2 element is at full opacity and the other two are transparent.

How can I achieve this?

\documentclass{beamer}
\usepackage{ifthen}

\ifthenelse{\equal{#1}{}}{%
}{
}
\setbeamercovered{transparent}
\ifthenelse{\equal{#1}{}}{%
\begin{itemize}[<+->]
\item El 1
\item El2
\item El3
\end{itemize}
}{
\begin{itemize}[<+>]
\item El 1
\item El2
\item El3
\end{itemize}
}
\end{frame}
}

\begin{document}

\end{document}


Don't know whether you want that or what @samcarter posted. This leads to the same like @samcarter's, but you can specify the relations to the number in the optional argument in \roadmapitem's argument.

\documentclass[]{beamer}

\makeatletter
{%
\expandafter\@firstoftwo
\else
\expandafter\expandafter\expandafter\@firstoftwo
\else
\expandafter\expandafter\expandafter\@secondoftwo
\fi
\fi
{\item}{\item<0>}%
}
\makeatother
{%
\begin{frame}%
\setbeamercovered{transparent}%

\begin{itemize}