viewing paste Unknown #20848 | Athena | Private

Posted on the
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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
/*=========================================================
@go command
Original concept by jTynne
Revised by Mumbles
===========================================================
Description:
Alternative @go command. Allows for unlimited aliasing, as 
well as level and group restrictions for each destination.
 
Additional options to add a delay, prevent use when dead,
and charge per use are available; default cost is defined 
with '.cost', but this parameter can be set manually with 
'go()'. These extra features are disabled by default.
 
Be mindful that the delay uses a temporary player variable,
'@go_delay'; if the player logs out, this variable will be
cleared. If you would like for a more secure delay, replace
all instances of '@go_delay' with 'go_delay'.
===========================================================
Compatibility:
Optimised for Hercules emulators.
===========================================================
Changelog:
v1.0 - First version. [jTynne]
v2.0 - Added additional parameters for locations. [jTynne]
v3.0 - Optimised for Hercules emulators. [Mumbles]
    v3.0.1 - Introduced limitless aliasing. [Mumbles]
    v3.0.2 - Added go() function. [Mumbles]
v3.1 - Added option to charge per use. [Mumbles]
    v3.1.1 - Added option to limit use when dead. [Mumbles]
    v3.1.2 - Added option to limit use to towns. [Mumbles]
    v3.1.3 - Added changelog. [Mumbles]
=========================================================*/
 
-   script  at_go   -1,{
 
    /*-----------------------------------------------------
    Configuration
    -----------------------------------------------------*/
    OnInit:
        set .delay, 0;      // Delay per use, in seconds (default: 0)
        set .cost, 10000;   // Default cost to use command if '.charge' is enabled
        set .charge, 0;     // Charge to use command? 0 = no, 1 = yes (default: 0)
        set .deadlock, 0;   // Prevent usage when dead? 0 = no, 1 = yes (default: 0)
        set .town, 0;       // Require 'mf_town'? 0 = no, 1 = yes (default: 0)
        
        bindatcmd "go", strnpcinfo(3) +"::OnAtcommand", 0, 2;
        end;
        
        
    /*-----------------------------------------------------
    Function: go()
    -------------------------------------------------------
    Description: Warps player and checks prerequisites.
    -------------------------------------------------------
    Usage:
    go(<"map_name">, <x>, <y>, <level>, <group>, <cost>)
    -----------------------------------------------------*/
    function go {
        if (.deadlock && !Hp) {
            message strcharinfo(0), "You may not use @go when you are dead.";
        } else if (.town && !getmapflag(strcharinfo(3), mf_town)) {
            message strcharinfo(0), "You may only use @go in towns.";
        } else if (.delay && @go_delay > gettimetick(2)) {
            message strcharinfo(0), "You must wait "+ (@go_delay - gettimetick(2))  +" seconds before warping again.";
        } else if (BaseLevel < getarg(3)) {
            message strcharinfo(0), "You must be at least level "+ getarg(3) +" to warp to this map.";
        } else if (strcharinfo(0) < getarg(4) || getmapflag(getarg(0), mf_nowarp)) {
            message strcharinfo(0), "You are not authorised to warp to this map.";
        } else if (.charge && Zeny < getarg(5)) {
            message strcharinfo(0), "You must have at least "+ getarg(5) +" zeny to warp to this map.";
        } else {
            if (.delay) {
                @go_delay = gettimetick(2) + .delay;
            }
        
            if (.charge) {
                Zeny -= getarg(5);
            }
        
            warp getarg(0), getarg(1), getarg(2);
            end;
        }
        
        message strcharinfo(0), "@go failed.";
        end;
    }
    
    
    /*-----------------------------------------------------
    Function: alias()
    -------------------------------------------------------
    Description: Determines if input matches alias.
    -------------------------------------------------------
    Usage: alias(<"number">, <"name1">{, <"name2">, <...>})
    -----------------------------------------------------*/
    function alias {
        for (.@i = 0; .@i < getargcount(); .@i++) {
            if (@input$ == getarg(.@i)) {
                @input$ = "";
                return true;
            }
        }
        
        return false;
    }
    /*-----------------------------------------------------
    Script
    -----------------------------------------------------*/
    OnAtcommand:
        @input$ = .@atcmd_parameters$[0];
        
        if (alias("0", "pro", "pront", "prontera")) {
            go("prontera",156, 184, 0, 0, .cost);
        } else if (alias("1", "moc", "mor", "morocc", "morroc")) {
            go("morocc", 160, 100, 0, 0, .cost);
        } else if (alias("2", "gef", "geffen")) {
            go("geffen", 120, 70, 0, 0, .cost);
        } else if (alias("3", "pay", "payo", "payon")) {
            go("payon", 174, 98, 0, 0, .cost);
        } else if (alias("4", "alb", "alberta")) {
            go("alberta", 192, 147, 0, 0, .cost);
        } else if (alias("5", "izl", "izlude")) {
            go("izlude", 127, 109, 0, 0, .cost);
        } else if (alias("6", "ald", "alde", "aldebaran")) {
            go("aldebaran", 140, 114, 0, 0, .cost);
        } else if (alias("7", "xmas", "lutie")) {
            go("xmas", 148, 117, 0, 0, .cost);
        } else if (alias("8", "com", "comodo")) {
            go("comodo",189, 151, 0, 0, .cost);
        } else if (alias("9", "juno", "yuno")) {
            go("yuno", 157, 182, 0, 0, .cost);
        } else if (alias("10", "ama", "amat", "amatsu")) {
            go("amatsu", 115, 153, 0, 0, .cost);
        } else if (alias("11", "gon", "gonr", "gonryun")) {
            go("gonryun", 159, 116, 0, 0, .cost);
        } else if (alias("12", "umb", "umbala", "umbrella")) {
            go("umbala", 90, 154, 0, 0, .cost);
        } else if (alias("13", "nif", "niflheim")) {
            go("niflheim", 195, 175, 0, 0, .cost);
        } else if (alias("14", "lou", "louyang")) {
            go("louyang", 218, 99, 0, 0, .cost);
        } else if (alias("15", "nov", "ng", "novice")) {
            go("new_1-1", 53, 111, 0, 10, .cost);
        } else if (alias("16", "jail", "prison")) {
            go("sec_pri", 23, 61, 0, 10, .cost);
        } else if (alias("17", "jaw", "jawaii")) {
            go("jawaii", 221, 221, 0, 0, .cost);
        } else if (alias("18", "ayo", "ayotaya", "ayothaya")) {
            go("ayothaya", 151, 165, 0, 0, .cost);
        } else if (alias("19", "ein", "einbroch")) {
            go("einbroch", 64, 200, 0, 0, .cost);
        } else if (alias("20", "lhz", "light", "lighthalzen")) {
            go("lighthalzen", 158, 92, 0, 0, .cost);
        } else if (alias("21", "einbe", "einbech")) {
            go("einbech", 176, 125, 0, 0, .cost);
        } else if (alias("22", "hug", "hugel")) {
            go("hugel", 96, 145, 0, 0, .cost);
        } else if (alias("23", "rach", "rachel")) {
            go("rachel", 130, 110, 0, 0, .cost);
        } else if (alias("24", "ve", "veins")) {
            go("veins", 216, 123, 0, 0, .cost);
        } else if (alias("25", "mosc", "mosk", "moscovia")) {
            go("moscovia", 223, 184, 0, 0, .cost);
        } else if (alias("26", "camp", "mid", "midgard")) {
            go("mid_camp", 180, 240, 0, 0, .cost);
        } else if (alias("27", "man", "manuk")) {
            go("manuk", 282, 138, 0, 0, .cost);
        } else if (alias("28", "spl", "splend", "splendide")) {
            go("splendide", 197, 176, 0, 0, .cost);
        } else if (alias("29", "br", "bra", "brasil", "brasilis")) {
            go("brasilis", 182, 239, 0, 0, .cost);
        } else if (alias("30", "el", "eldic", "dic", "dicastes")) {
            go("dicastes01", 198, 187, 0, 0, .cost);
        } else if (alias("31", "mora")) {
            go("mora", 44, 151, 0, 0, .cost);
        } else if (alias("32", "dew", "dewata")) {
            go("dewata", 200, 180, 0, 0, .cost);
        } else if (alias("33", "mal", "malang", "malangdo")) {
            go("malangdo", 140, 114, 0, 0, .cost);
        } else if (alias("34", "port", "malay", "malaya")) {
            go("malaya", 242, 211, 0, 0, .cost);
        } else if (alias("35", "ecl", "ecla", "eclag", "eclage")) {
            go("eclage", 110, 39, 0, 0, .cost);
        } else {
            message strcharinfo(0), "Invalid location number, or name.";
            message strcharinfo(0), "Params: <city name|number>";
            message strcharinfo(0), "Warps you to a city."; 
            message strcharinfo(0), "0: Prontera         1: Morroc         2: Geffen     3: Payon       4: Alberta";
            message strcharinfo(0), "5: Izlude           6: Al De Baran    7: Lutie      8: Comodo      9: Yuno";
            message strcharinfo(0), "10: Amatsu         11: Gonryun       12: Umbala    13: Niflheim   14: Louyang";
            message strcharinfo(0), "15: Novice Grounds 16: Prison        17: Jawaii    18: Ayothaya   19: Einbroch";
            message strcharinfo(0), "20: Lighthalzen    21: Einbech       22: Hugel     23: Rachel     24: Veins";
            message strcharinfo(0), "25: Moscovia       26: Midgard Camp  27: Manuk     28: Splendide  29: Brasilis";
            message strcharinfo(0), "30: El Dicastes    31: Mora          32: Dewata    33: Malangdo   34: Malaya";
            message strcharinfo(0), "35: Eclage";
            message strcharinfo(0), "@go failed.";
        }
        
        end;
        
}
 
Viewed 182 times, submitted by elgore.