Now I'm a novice here so bare with me, but I think you are using the "Call" sub routine incorrect. And by luck it seems to be working in one direction....
You assume the variables you define in you Main program (Global variables) are also available in the Sub routine, this is wrong.
A sub routine uses "Local variable" and is, by default, not aware of the main program, or main program variables at all !
Now to use the "Call StartTool" you must send the variable to that sub routine, that the routine needs which is "NewTool and Tool"
So the correct code would look like "Call StartTool(Newtool,Tool)" here you send 2 values beloning to NewTool, and Tool AND IN THAT ORDER !!
Now the Sub Routine need to know what kind of information to recieve.
Again "Sub StartTool(Newtool, Tool)" AND IN THAT ORDER This is because you use the same variablenames in you main program as in the sub routine.
This also messes up your other subroutine, where you Call for a tool position, here you expect that a Subroutine (Local variables), updates the Global variables of you main program.
They dont !
Here you must tell the Sub-routine that the variables are linked "ByRef" allowing a sub-routine to update global variables.
Perhaps you can find a bit of help here:
https://youtu.be/duULYFBjDnk?t=530Here I walk through a script for Tool Probing, and here I use, Call and Call "ByRef"
-Bo-
Call StartTool
While NewTool <> Tool
Call CheckPins
While IsMoving()
Wend
Wend
Call StopTool
Call SetUserDRO (1200, NewTool)
SetCurrentTool(NewTool)
Sub StartTool
If NevTool< Tool Then
ActivateSignal(Output2)
Exit Sub
End If
While IsMoving()
Wend
If NevTool>Tool Then
ActivateSignal(Output4)
Exit Sub
End If
ActivateSignal(Output3)
While IsMoving()
Wend
End Sub