//===== Hercules Script ======================================
//= Imports a list of useful functions
//===== By: ==================================================
//= Streusel
//===== Current Version: =====================================
//= 1.0
//===== Description: =========================================
//= Provides a set of functions available to the server
//===== Additional Comments: =================================
//= 1.0 Created file & populated it with generally
//= useful functions
//============================================================
//Returns the bigger number
function script max {
.@max = getarg(0);
if(.@max != getarg(getargcount()-1))
{
for( .@i = 1; .@i < getargcount(); .@i++ )
if(.@max < getarg(.@i))
.@max = getarg(.@i);
}
return .@max;
}
//Returns the smallest number
function script min {
.@min = getarg(0);
if(.@min != getarg(getargcount()-1))
{
for( .@i = 1; .@i < getargcount(); .@i++ )
if(.@min > getarg(.@i))
.@min = getarg(.@i);
}
return .@min;
}
//Returns the biggest number within an array
function script maxArray {
.@max = getelementofarray(getarg(0), 0);
for( .@i = 1; getarraysize(getarg(0)) != 1 && i < getarraysize(getarg(0)); .@i++ )
{
if(.@max < getelementofarray(getarg(0), .@i))
.@max = getelementofarray(getarg(0), .@i);
}
return .@max;
}
//Returns the smallest number within an array
function script minArray {
.@min = getelementofarray(getarg(0), 0);
for( .@i = 1; getarraysize(getarg(0)) != 1 && i < getarraysize(getarg(0)); .@i++ )
{
if(.@min > getelementofarray(getarg(0), .@i))
.@min = getelementofarray(getarg(0), .@i);
}
return .@min;
}
//Returns the absolute value
function script abs {
if(getarg(0) < 0)
return -getarg(0);
return getarg(0);
}