Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 05/22/21 in Posts

  1. 1 point
    meko

    Revising rA script to Herc

    MF_LOADEVENT should be in uppercase. Also it might be faster to use a hash table than looping through the array (imagine having an array with 2k maps and doing a string comparison for each one of them every time someone enters the map) - script map_name -1,{ OnInit: .maps = htnew(); // create a new hash table // htput(.maps, "<map name>", "<map nick>"); htput(.maps, "prontera", "Prontera City, The Imperial Capital"); htput(.maps, "morocc", "Morroc Town, The Frontier"); htput(.maps, "geffen", "Geffen, The City of Magic"); htput(.maps, "payon", "Payon Town, The Upland Village"); htput(.maps, "alberta", "Alberta, The Port City"); htput(.maps, "izlude", "Izlude Town, The Satellite City of Prontera"); htput(.maps, "aldebaran", "Al De Baran, The Gate to the New World"); htput(.maps, "xmas", "Lutie, The City of Eternal Christmas"); htput(.maps, "comodo", "Comodo, The City of Fun and Celebrations"); htput(.maps, "yuno", "Juno, The Capital of the Commonwealth and Ancient Lore"); htput(.maps, "amatsu", "Amatsu, The New Land Discovered"); htput(.maps, "gonryun", "Gonryun, The Hermit Land"); htput(.maps, "umbala", "Umbala, The Lost Land"); htput(.maps, "niflheim", "Niffleheim, The Cold Land of Death"); htput(.maps, "louyang", "Louyang, The Fortress of Dragon"); htput(.maps, "new_1-1", "Training Ground"); htput(.maps, "sec_pri", "Valhalla Prison"); htput(.maps, "jawaii", "Jawaii, The Island of Love"); htput(.maps, "ayothaya", "Ayothaya, The Land of Majectic Culture"); htput(.maps, "einbroch", "Einbroch, The Steel City"); htput(.maps, "lighthalzen", "Lighthalzen, The City of Scientific Myths"); htput(.maps, "einbech", "Einbech, The Mining Town"); htput(.maps, "hugel", "Hugel, Between the Icy Moutain and Chilly Blue Sea"); htput(.maps, "rachel", "Rachel, The Capital City of Arunafeltz"); htput(.maps, "veins", "Veins, The Canyon Village"); htput(.maps, "mid_camp", "Rune Midgard Allied Forces Post"); .@it = htiterator(.maps); // create an iterator to loop through the table for (.@map$ = htifirstkey(.@it); hticheck(.@it); .@map$ = htinextkey(.@it)) { // we are only interested in the key so no need to htget() here setmapflag(.@map$, MF_LOADEVENT); } htidelete(.@it); // we're done with the iterator: deallocate it end; OnPCLoadMapEvent: // check whether it's in the hash table: if (.@nick$ = htget(.maps, strcharinfo(PC_MAP), "")) { announce(.@nick$, bc_self); } end; }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.