3
Python 2, 290
It's probably really bad, but I tried :D
The output contains trailing spaces, but that is not forbidden in the spec.
m=x=y=c=0
l,f=1,[31*[' ']for t in[0]*31]
for i in[0]*input():
k=m%4
f[14+y+(2<m<6)][14+x-(m>3)],x,y,c='|/_\\'[k],x+(k>0)*(2*(4>m)-1),y+(k!=2)*(2*(2<m<6)-1),c+1
...