How do I define more than 9 points in a tikzset with the let operation?

As shown in the code below \p10 will make an error, preventing long drawings.

How does one overcome this?

I think this is asked here but the answer is unclear for this aplication.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\tikzset{my doodle/.pic=%
{%
\coordinate (-A) at (0,0);
\coordinate (-B) at (1cm, 0);
\coordinate (-C) at (1cm, -1cm);
\coordinate (-D) at (0, -1cm);
\draw[line width=1.5mm,red!40!orange!30!yellow] (-A) -- (-B) -- (-C) -- (-D) -- cycle; % gold rectangle
% blue line
\coordinate (-D1) at (-0.055cm,-1.07cm);                                % starting point of blue line
\path let \p1=(-D1) in coordinate (-D2) at (-0.25cm,\y1+0.1cm);         % go to starting position of pattern
\path let \p2=(-D2) in coordinate (-D3) at (-0.1cm,\y2-0.05cm);         % step 1
\path let \p3=(-D3) in coordinate (-D4) at (-0.25cm,\y3+0.25cm);        % step 2
\path let \p4=(-D4) in coordinate (-D5) at (-0.1cm,\y4-0.05cm);         % step 3
\path let \p5=(-D5) in coordinate (-D6) at (-0.25cm,\y5-0.05cm);        % step 1
\path let \p6=(-D6) in coordinate (-D7) at (-0.1cm,\y6+0.25cm);         % step 2
\path let \p7=(-D7) in coordinate (-D8) at (-0.25cm,\y7-0.05cm);        % step 3
\path let \p8=(-D8) in coordinate (-D9) at (-0.1cm,\y8-0.05cm);         % step 1
\path let \p9=(-D9) in coordinate (-D10) at (-0.25cm,\y9+0.25cm);   % step 2
\path let \p10=(-D10) in coordinate (-D11) at (-0.1cm,\y10-0.05cm);
\draw[thick, blue] (-D1) -- (-D2) -- (-D3) -- (-D4) -- (-D5) -- (-D6) -- (-D7) -- (-D8) -- (-D9) -- (-D10) -- (-D11);%
}%
}

\NewDocumentCommand{\doodle}{ O{black} O{0.18pt} r() }{
\begin{tikzpicture}[overlay,remember picture]
\pic[draw=#1, line width=#2]
at (#3) {my doodle};
\end{tikzpicture}
}

\doodle(0,-2)
\end{document}


I stumbled on the solution by accident - changing both \p10 and \y10 to \p{10} AND \y{10}.
• I think that the number is actually an argument to the macro \p, so without the braces only the first number is grabbed by the macro. Jan 7, 2022 at 9:06