Yes I put %m in the wrong place

Change var %i = 1 to var %i = 1,%m

Change var %n = $v1,%m to var %n = $v1

Maybe that's why it didn't work, I tried it after the change and
it worked perfectly. Re-copy it from last post, it's been edited.