a=1
do
tv_getmouse
parse result x y
y = y * 65536 // fix bogus value for Y
tv_ZDot x y 0 100
a=a+1
until (a>10)
I use the Tv_Getmouse instruction but it seems that the actual x y values are not read. The dot is writen in the same position in the a -->10 cicle. This position is the x y value of the mouse when you press the script button that launch the code.
In the second script variation if I press the ok button with the "intro" keyboard´s button and I move the mouse around the screen the dots are drawn in differents positions. The x y values are read ok.
jokinb wrote:Can anyone explain why in the following script the point is drawn in the same position always?
Because the loop is too short and executed very fast, tv_getmouse return the immediate position of the cursor and the mouse position can't change in only 10 loop.
Here is another test . Something is wrong. The tv_getmouse is not working ok. Despite moving the mouse Tv_getmouse does´nt detect new coordinates.
In the fololowing script I save the "y" value in the 4997, 5998, and 6999 cicle in an array.
a=1
do
tv_getmouse
parse result x y
y = y * 65536 // fix bogus value for Y
if (a==4997)
matriz(a)=y // save in matriz(4997) the y value for test
end
if (a==5998)
matriz(a)=y
end
if (a==6999)
matriz(a)=y
end
tv_ZDot x y 0 100
a=a+1
until (a>10000)
print "coordinate y:" matriz(4997) matriz(5998) matriz(6999)
I tested tv_GetMouse using the following script and it appears to not update when I move the mouse and sample X and Y 10 times during the loop.
I agree, something is probably wrong with tv_GetMouse.
// readXY.grg
X = 0
Y = 0
OrigXandY = ""
XandY = ""
tv_GetMouse
parse result X Y
OrigXandY = "Before Loop, X = " X " Y = " Y
For i = 1 to 10
Stamp()
END
XandY = OrigXandY " After Loop, X = " X " Y = " Y
tv_warn XandY // display original and final X and Y values
Function Stamp
tv_GetMouse
parse result X Y
IF Y < .1
Y = Y * 65536 // fix bogus value for Y
END
tv_ZDot X Y 0 100 // stamp cutbrush
XandY = "loop count = " i " X = " X " Y = " Y
tv_LockDisplay XandY // locks display and shows message
Delay() // prolongs locked message display
tv_UnLockDisplay // unlocks display
END
Function Delay
For j = 1 to 100000 // delays approx. 1 second
END
END
If we have selected as active tool the "Warpbrush" ,the "tv_getactivetool" instruction give us an error "mode" value.
If we have selected a "Warp Out" mode , the"tv_getactivetool" said us that it is in "Warp In" mode and vive versa.
Select the Warpbrush tool and test the folloging code: