Almost forgot; formatting in the .pst file is important. In the example in my previous post, put the "if speed" lines AWAY from the left margin. If it's against the left margin, you'll get an undeclared variable error.
In the following code, I created 2 new functions that are triggered either automatically or by setting a switch in the Misc Value's Misc Integer section.
Note that the function name is all the way against the left margin, and the function itself is away from the margin.
Now, any time I want to call the pcorner_round function, I call it like this:
popnumber #Count Operations, add op type ()
op_number = op_number + 1
# = op_number
n, "(", stopno, op_number, " ", stoper, ")", e
pcorner_round #corner rounding ()
if mi5 = 1 & mr5 > 0 & flg_mi5 = 0,
sav_mr5 = mr5,
pbld, n, "G187", *sav_mr5, e
flg_mi5 = 1
if mi5 = 1 & mr5 = 0,
"( WARNING!! CORNER ROUNDING CONTROL HAS )", e
"( BEEN ENABLED WITHOUT A VALUE SET! USE )", e
"( MISC VALUES-MISC REALS TO SET A VALUE )", e
"( CORNER ROUNDING CONTROL IS DISABLED )", e
if mi5 = 0 & flg_mi5 = 1,
n, "G187", e
flg_mi5 = 0
Hope I'm not confusing you..
ptlchg0 #Call from NCI null tool change (tool number repeats)
pcorner_round <----------call this function
pcuttype<----------------then call this one
toolcount = toolcount + 1<------do some stuff here
if toolcountn <= tooltotal, nexttool = rbuf(4,toolcountn)<-----do some if then statements here
else, nexttool = first_tool
if mi10=one & op_id<>last_op_id, pstop <---- test an if then statement and call another function if true