GetWaterScale

Definition

double,double GetWaterScale(string waterName)

Description

This function receives the name of the water waterName and returns its scale as two values in the x and z direction.

Parameters

waterName
Specifies the name of the water object. You can also use the name “this” for this parameter. In this case, “this” refers to the water name that this script is attached to.

Return Value

This function returns the water scale as two values in the x and z direction.

Example 1

scaleX = 0.0
scaleZ = 0.0

function Init()
    scaleX, scaleZ = GetWaterScale("water1")

    message = string.format("\nWater scale is > (%.2f, %.2f)" , scaleX, scaleZ)
    PrintConsole(message)
end

function Update()

end
First, GetWaterScale function returns the scale of water “water1”. Then we display the scale values in x and z direction in the console using the PrintConsole function.

Example 2

--Name of script is GetWaterScale2.lua

scaleX = 0.0
scaleZ = 0.0

function Init()
    scaleX, scaleZ = GetWaterScale("this")

    message = string.format("\nWater scale is > (%.2f, %.2f)" , scaleX, scaleZ)
    PrintConsole(message)
end

function Update()

end
Assume that the above script named GetWaterScale2.lua is attached to a water object named “water1”. In this case, string “this”  in the GetWaterScale function will be equal to “water1”. In our example, the function GetWaterScale returns the scale of current water, which is “water1”. Then we display the scale values in the console using the PrintConsole function.
adminGetWaterScale