--Lingo syntax abs (numericExpression) // JavaScript syntax Math.abs (numericExpression)
The abs() function has several uses. It can simplify the tracking of mouse and sprite movement by converting coordinate differences (which can be either positive or negative numbers) into distances (which are always positive numbers). The abs() function is also useful for handling mathematical functions, such as sqrt() and log().
In JavaScript syntax, use the Math objects abs() function.
numericExpression Required. An integer or floating-point number from which an absolute value is calculated. If numericExpression is an integer, the absolute value is also an integer. If numericExpression is a floating-point number, the absolute value is also a floating-point number.
This statement determines whether the absolute value of the difference between the current mouse position and the value of the variable startV is greater than 30 (since you wouldnt want to use a negative number for distance). If it is, the foreground color of sprite 6 is changed.
-- Lingo syntax
if (the mouseV - startV).abs > 30 then sprite(6).forecolor = 95
// JavaScript syntax
if ((_mouse.mouseV - Math.abs(_mouse.startV)) > 30) {
sprite(6).foreColor = 95;
}