loading
 
Keeping Track of a Maximum Value
Al from United States  [3 posts]
11 year
I am looping a video and trying to determine the maximum displacement of an oscillating part.  The problem I'm having is that the displacement calculation just ends being the same as teh MIN_Y value.  See VBScript below.  I have attached the program, but not the video clip.

if GetVariable("SCRIPT_COUNT") = 0 then
SetVariable "Displacement", 0
end if
minY = GetVariable("MIN_Y")
if minY > Displacement then
SetVariable "Displacement", minY
end if
program.robo
Steven Gentner from United States  [1446 posts] 11 year
Allen,

Its probably more like:

if GetVariable("SCRIPT_COUNT") = 0 then
SetVariable "Displacement", 10000
end if
minY = GetVariable("MIN_Y")
if minY < GetVariable("Displacement") then
SetVariable "Displacement", minY
end if

basically you where missing the GetVariable on the Displacement since that value would always be zero and second, if you want the minimum Y you need to initialize that to a high number first.

STeven.

Al from United States  [3 posts] 11 year
STeven,

Thanks...didn't realize that I needed to use GetVariable for created variables.

if minY < GetVariable("Displacement") then

Al

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index