Help with a loop.

Hello, I'm not very good at scripting and most of what I do is pretty much edit scripts to fit my needs, although in very basic ways.

I'm currently editing a script and I've got the following code:
Code:
        this.drawText(textV_Line,lineX1, lineY, rect.width, 'left') // Draw an vertical line
        this.drawText(textV_Line,lineX1, lineY + 10, rect.width, 'left') // Draw an vertical line
        this.drawText(textV_Line,lineX1, lineY + 20, rect.width, 'left') // Draw an vertical line.
        this.drawText(textV_Line,lineX1, lineY + 30, rect.width, 'left') // Draw an vertical line.
        this.drawText(textV_Line,lineX1, lineY + 40, rect.width, 'left') // Draw an vertical line.
        this.drawText(textV_Line,lineX1, lineY + 50, rect.width, 'left') // Draw an vertical line.
        this.drawText(textV_Line,lineX1, lineY + 60, rect.width, 'left') // Draw an vertical line.
        this.drawText(textV_Line,lineX1, lineY + 70, rect.width, 'left') // Draw an vertical line.

I would like to do this but with a loop, so I don't have to copy and paste all this code, and get rid of this mess. it basically just adds 10 to the "lineY" variable.
But loops are something I've always struggled to understand. I'm an artist, so my brain is very slow to learn these things 😛

Can anyone help me on this?
In what context will you be using this? We don't usually put code like this in a loop, we usually put that in a method and just call the method when we need that piece of code executed.

EDIT: Assuming this is in a window, if you want to draw a line it's a lot better to use:
Code:
this.contents.fillRect(x, y, width, height, color)
Just set the width to the window width and the height to 1 or 2.
Hm I see, still got a lot to understand. In my head I could just repeat it enough times until it was done. Yes it is in a window, I was using the character " | " to draw a vertical line for lack of a better option 😛.

Oh, nice! I only knew about draw.Horzline, and after trying it, it would crash as undefined, but that does the job, thank you so much!

Original thread: https://forums.rpgmakerweb.com/threads/help-with-a-loop.117091/