viewing paste functions | Athena

Posted on the | Last edited on
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
//===== 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);
}
 
Viewed 1692 times, submitted by Streusel.