Monitoring current line of scipt the robot is executing

I just started working with the robot recently so apology if this is a dumb question. I typically use the script node to program the robots’ movements instead of using the pendant through waypoints. I wondering if there are any ways to track/view which line of the script the robot is executing (ie. which “movel” values) to keep track of the robot’s movements. Is there a way to do this through a variable or any other way? Any suggestions are greatly appreciated. My typical script would look something like below:

def Program():
toolTcp = p[0, 0, 0, 0, 0, 1.5708]
toolWeight = 0
toolCog = [0, 0, 0]
Speed000 = 0.08
Speed001 = 0.08
Zone000 = 0.001
Zone001 = 0.01
set_tcp(toolTcp)
set_payload(toolWeight, toolCog)
movej([1.5708, -0.8727, -2.0944, -1.5708, 1.6057, 3.1416], a=3.1416, v=0.2513, r=Zone000)
popup(“Moved to home position press CONTINUE to start the program”, “StartConfirmation”,warning=False,error=False,blocking=True)
movel(p[-0.12965, 0.6096, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
movel(p[-0.19262, 0.60576, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
movel(p[-0.25439, 0.59303, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
movel(p[-0.31308, 0.57, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
movel(p[-0.36665, 0.53675, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
movel(p[-0.41422, 0.49532, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
movel(p[-0.45701, 0.44892, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
movel(p[-0.49823, 0.4011, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
movel(p[-0.54279, 0.35645, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
movel(p[-0.59614, 0.32321, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
movel(p[-0.65779, 0.31157, 0, -2.22144, 2.22144, 0], a=1, v=Speed001, r=Zone001)
end

Not sure if there are better ways but the easiest would probably be the way you described, by simply incrementing a variable after each waypoint (wp_index = wp_index + 1)
You can then either look at the variable section to check the current value or use the textmsg() function to print it to the log.

Thank you for your response. The only drawback to this is that it’ll require this line of code (wp_index = wp_index + 1 ) after each line of code which essentially doubles the number of lines of code the program has unless I’m missing something… Any idea how I may be able to avoid this?

How long is your program and how are you sending it to the robot?
Doubling the number of lines should not be a big problem if your program has less than 10000 lines.