(chvars "612" "Three" (cdr (nth 2 n)) (cdr (nth 3 n)))
This example will be the same for all. First, the routine sees the name chvars, it looks for a function called chvars. When it finds it, it looks in the argument list to see if there are any required arguments:
(defun chvars (required arg's here / local variables)
(...)
)
What you are doing with the example at the top is telling chvars to set each argument to what comes after the chvars call at the top. Since there are currently four required arguments, you need to call chvars with four values. Calling each value is like doing this in each successive call:
(defun chvars ()
(setq clay (setvar 'clayer "612")
lintype (setvar 'celtype "Three")
lscale (setvar 'ltscale (getvar 'ltscale))
plwid (setvar 'plinewid (getvar 'plinewid))
)
(setvar 'clayer clay)
(setvar ''celtype lintype)
(setvar 'ltscale lscale)
(setvar 'plinewid plwid)
)
With reusable functions, you wouldn't have to type all that each time. This portion may not be the best place for reusable functions, because you aren't changing all values in each condition, but I was hoping to give you an understanding of modular programming (reusable code). I know we discussed this in the past and I think it was over your head then. I know it can be. The first time I saw a function with arguments, I didn't understand how that was possible. Really, until you write one, it won't make sense.