Problem with while loop in included script

Working with URSim version 3.3.2.266 (Sep 05)
I’m having a problem with subroutines that include a while loop in a program. (I haven’t tried other kinds of loops)

A simple program that shows the problem is:

The offending subroutine script is:

The saved full offending script is:

If I comment out the “while” and “end” lines the script works fine -so the problem seems to be with them.

Can you see anything I’m doing wrong?

I’m having similar problems with “if” clauses.

Is it possible that theSubProgram file is a .script file? It has to be a .urp file.

1 Like

Yes it is a script file.

Am I misunderstanding the The URScript Programming Language manual (Version 3.2 April 15, 2016 page 4)?

That seems to show that “while” and “if” clauses are part of the script language…

ifand whilestatements are fully a part of the URScript language.
But @poproulx is right that is has to be a .urp file when included as a subprogram.

@poproulx @jbm

Thanks, somehow I missed that.