viewing paste Unknown #10914 | Plain text

Posted on the
  1. Hello,
  2.  
  3. I am using annie's mission board script, but i keep getting a "run_script: infinity loop!" error. I've added a sleep2 option and changing the goto count, I've also tried adding a freeloop label but regardless this mssage keeps occuring.
  4. (It occurs right before the window of "Accept a mission, drop a mission and submit a mission". 
  5.  
  6. I don't know how freeloop works and if this would even resolve the problem. Maybe I've put it at the wrong place?
  7.  
  8. Please help. :(
  9.  
  10.  
  11. [code]//    ~~~~~ Please use this latest int__ function that support negative numbers ~~~~~
  12. function    script    int__    {
  13.     sleep2 100;
  14.     freeloop(1);
  15.     set .@num, getarg(0);
  16.     if ( .@num == 0 || .@num > 2147483647 || .@num < -2147483647 ) return getarg(0);
  17.     set .@l, (.@num > 0)? getstrlen(.@num +"") : getstrlen(.@num +"") -1;
  18.     while ( .@i < .@l ) {
  19.         set .@temp, .@num % pow(10,.@i+1) / pow(10,.@i);
  20.         set .@num$, ( ( (.@i+1) % 3 == 0 && .@i+1 != .@l )?",":"" ) + ( (.@num > 0)?.@temp:~(.@temp)+1 ) + .@num$;
  21.         set .@i, .@i +1;
  22.     }
  23.     return ((.@num > 0)?"":"-")+ .@num$;
  24. }
  25.  
  26. //===== eAthena Script ============================================
  27. //= Mission Board
  28. //===== By: =======================================================
  29. //= ~AnnieRuru~
  30. //===== Current Version: ==========================================
  31. //= 2.4
  32. //===== Compatible With: ==========================================
  33. //= eAthena 14764 Trunk TXT/SQL
  34. //===== Description: ==============================================
  35. //= allow admin to setup their own quests dynamically
  36. //===== Topic =====================================================
  37. //= http://www.eathena.ws/board/index.php?showtopic=242306
  38. //===== Additional Comments: ======================================
  39. //= mainly optimize the script
  40. //=================================================================
  41.  
  42. -    script    mission board#127::ms_b_    -1,{
  43.     mes "["+ strnpcinfo(1) +"]";
  44.     if ( atoi( strnpcinfo(2) ) <= 0 || atoi( strnpcinfo(2) ) > 127 ) {
  45.         mes "This board is currently down";
  46.         mes "Please report to GM";
  47.         mes "Reason: Invalid NPC ID";
  48.         close;
  49.     }
  50.     if ( .duplicate_id ) {
  51.         set .@size, getarraysize(.duplicate_id);
  52.         for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 ) {
  53.             if ( .duplicate_id[.@i] == atoi( strnpcinfo(2) ) ) {
  54.                 mes "This board is currently down";
  55.                 mes "Please report to GM";
  56.                 mes "Reason: duplicate NPC ID#"+ strnpcinfo(2);
  57.                 close;
  58.             }
  59.         }
  60.     }
  61.     if ( .loading == 1 ) {
  62.         mes "The board is currently loading mission data, please try again!";
  63.         close;
  64.     }
  65.     if ( @ms_b_loading == 1 ) {
  66.         mes "The board is currently loading player data";
  67.         mes "Please wait";
  68.         close;
  69.     }
  70.     mes "The Mission Board will instruct you to hunt certain monsters or items. Completing missions will result into rewards such as EXP and Midgard Coins";
  71.     next;
  72.     mes "["+ strnpcinfo(1) +"]";
  73.     mes "Every player may pick up to ^FF00004^000000 missions from the Mission Board.";
  74.     mes "Missions that end with '^FF0000Slayer^000000' are kill count missions and those that end with '^FF0000Collector^000000' are item gathering missions.";
  75.     next;
  76.     mes "["+ strnpcinfo(1) +"]";
  77.     mes "^FF0000Please remember that, when accepting a mission, you need to be within the assigned level range when you ACCEPT and SUBMIT it!^000000";
  78.     sleep2 100;
  79.     set @slot, 0;
  80.     next;
  81.     for ( set .@i, 1; .@i <= 4; set .@i, .@i +1 ) {
  82.         if ( getd("@ms_b_m_"+ .@i) ) {
  83.             if ( getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@i +"[0]") +"$[0]") == "" ) {
  84.                 dispbottom "Mission Board: Your Mission#"+ .@i +" has been deleted because it is no longer available.";
  85.                 deletearray getd("@ms_b_m_"+ .@i);
  86.                 setd "ms_b_m_"+ .@i +"$", "";
  87.                 deltimer "ms_b_::OnQuest"+ .@i +"TimeUp";
  88.             }
  89.             else if ( getd("@ms_b_m_"+ .@i +"[1]") && getd("@ms_b_m_"+ .@i +"[1]") <= gettimetick(2) ) {
  90.                 dispbottom "Mission #1: "+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@i +"[0]") +"$[0]") +" has expired!";
  91.                 deletearray getd("@ms_b_m_"+ .@i);
  92.                 setd "ms_b_m_"+ .@i +"$", "";
  93.                 deltimer "ms_b_::OnQuest"+ .@i +"TimeUp";
  94.             }
  95.         }
  96.     }
  97.     set .@size, getarraysize( getd("@ms_b_n_"+ strnpcinfo(2)) );
  98.     for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 ) {
  99.         if ( getd("@ms_b_n_"+ strnpcinfo(2) +"[0]") != atoi( gettimestr("%Y%m%d", 9) ) && getd(".ms_b_m_"+ getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 1 ||
  100.             getd(".ms_b_m_"+ getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 0 ) {
  101.                 deletearray getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]"), 1;
  102.                 set .@i, .@i -1 ;
  103.         }
  104.     }
  105.     if ( getd("@ms_b_n_"+ strnpcinfo(2) +"[1]") ) {
  106.         setd "ms_b_n_"+ strnpcinfo(2) +"$",    gettimestr("%Y%m%d", 9);
  107.         set .@size, getarraysize( getd("@ms_b_n_"+ strnpcinfo(2) ) );
  108.         for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  109.             setd "ms_b_n_"+ strnpcinfo(2) +"$", getd("ms_b_n_"+ strnpcinfo(2) +"$") +"#"+ getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]");
  110.         setd "ms_b_n_"+ strnpcinfo(2) +"$", getd("ms_b_n_"+ strnpcinfo(2) +"$") +"#";
  111.     }
  112.     else
  113.         setd "ms_b_n_"+ strnpcinfo(2) +"$", "";
  114.     switch ( select ( "- Submit completed mission", "- Drop a mission", "- Accept a mission", ( getgmlevel() < 99 )?"":"^FF0000Administrator Settings^000000" ) ) {
  115.         case 1:
  116.             mes "["+ strnpcinfo(1) +"]";
  117.             mes "Please select the mission you wish to submit:";
  118.             set @slot, select(
  119.                 "#1 "+( ( @ms_b_m_1[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_1[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  120.                 "#2 "+( ( @ms_b_m_2[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_2[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  121.                 "#3 "+( ( @ms_b_m_3[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_3[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  122.                 "#4 "+( ( @ms_b_m_4[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_4[0] +"$[0]"):"^FF0000Empty" )+"^000000");
  123.             if ( getd("@ms_b_m_"+ @slot +"[0]") == 0 ) {
  124.                 mes "It appears that you have selected a empty slot!";
  125.                 close;
  126.             }
  127.             callsub L_showprogress;
  128.             mes "Are you sure you want to submit the selected mission?";
  129.             next;
  130.             if ( select ( "Yes", "No" ) == 2 ) close;
  131.             mes "["+ strnpcinfo(1) +"]";
  132.             if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[11]") != atoi( strnpcinfo(2) ) ) {
  133.                 mes "Please submit this mission to:";
  134.                 mes "^0000FF"+ .ms_b_name$[ getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[11]") ] +"^000000";
  135.                 close;
  136.             }
  137.             set .@size, getarraysize( getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  138.             for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  139.                 if ( getd("@ms_b_m_"+ @slot +"["+( .@i/2 +2 )+"]") < getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1)+"]") ) {
  140.                     mes "You do not meet the requirements to submit this mission. Please submit the mission once you've killed the required amount of monsters!";
  141.                     close;
  142.                 }
  143.             }
  144.             set .@size, getarraysize( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  145.             for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  146.                 if ( countitem( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") )  < getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1)+"]") ) {
  147.                     mes "You do not meet the requirements to submit this mission. Please submit this mission once you've gathered the required item(s)!";
  148.                     close;
  149.                 }
  150.             }
  151.             if ( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") ) ) {
  152.                 getinventorylist;
  153.                 deletearray @inventorylist_id, @inventorylist_count;
  154.                 deletearray @inventorylist_amount, @inventorylist_count;
  155.                 deletearray @inventorylist_equip, @inventorylist_count;
  156.                 deletearray @inventorylist_refine, @inventorylist_count;
  157.                 deletearray @inventorylist_identify, @inventorylist_count;
  158.                 deletearray @inventorylist_attribute, @inventorylist_count;
  159.                 deletearray @inventorylist_card1, @inventorylist_count;
  160.                 deletearray @inventorylist_card2, @inventorylist_count;
  161.                 deletearray @inventorylist_card3, @inventorylist_count;
  162.                 deletearray @inventorylist_card4, @inventorylist_count;
  163.                 set .@size, getarraysize( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  164.                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  165.                     set .@itemweight, .@itemweight + getiteminfo( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]"), 6 ) * getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]");
  166.                 }
  167.                 if ( @inventorylist_count > 95 || weight + .@itemweight > maxweight ) {
  168.                     mes "It appears that you are overweight, please clean up some inventory space.";
  169.                     set @inventorylist_count, 0;
  170.                     close;
  171.                 }
  172.                 set @inventorylist_count, 0;
  173.             }
  174.             mes "Congratulations, the mission has been completed!";
  175.             mes " ";
  176.             set .@size, getarraysize( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  177.             for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  178.                 delitem getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]"), getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1)+"]");
  179.             mes "[Rewards]";
  180.             if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]") ) {
  181.                 mes "Base Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]") ) +"^000000";
  182.                 dispbottom "Mission Reward - Base EXP : "+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]") );
  183.                 set baseexp, baseexp + getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]");
  184.             }
  185.             if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]") ) {
  186.                 mes "Job Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]") ) +"^000000";
  187.                 dispbottom "Mission Reward - Job EXP : "+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]") );
  188.                 set jobexp, jobexp + getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]");
  189.             }
  190.             if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]") ) {
  191.                 mes "Zeny : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]") ) +"^000000";
  192.                 dispbottom "Mission Reward - "+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]") ) +" Zeny";
  193.                 set zeny, zeny + getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]");
  194.             }
  195.             if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]") ) {
  196.                 mes "Cash Point : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]") ) +"^000000";
  197.                 dispbottom "Mission Reward - "+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]") ) +" Cash Points";
  198.                 set #CASHPOINTS, #CASHPOINTS + getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]");
  199.             }
  200.             set .@size, getarraysize( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  201.             for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  202.                 mes "Item : ^0000FF"+ getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]") +" "+ getitemname( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") ) +"^000000";
  203.                 getitem getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]"), getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]");
  204.             }
  205.             if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[6]") ) {
  206.                 set .@size, getarraysize( getd("@ms_b_n_"+ strnpcinfo(2) ) );
  207.                 setd "@ms_b_n_"+ strnpcinfo(2) +"[0]", gettimestr("%Y%m%d", 9);
  208.                 setd "@ms_b_n_"+ strnpcinfo(2) +"["+ .@size +"]", getd("@ms_b_m_"+ @slot +"[0]");
  209.                 setd "ms_b_n_"+ strnpcinfo(2) +"$",    gettimestr("%Y%m%d", 9);
  210.                 for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  211.                     setd "ms_b_n_"+ strnpcinfo(2) +"$", getd("ms_b_n_"+ strnpcinfo(2) +"$") +"#"+ getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]");
  212.                 setd "ms_b_n_"+ strnpcinfo(2) +"$", getd("ms_b_n_"+ strnpcinfo(2) +"$") +"#";
  213.             }
  214.             deletearray getd("@ms_b_m_"+ @slot);
  215.             setd "ms_b_m_"+ @slot +"$", "";
  216.             deltimer "ms_b_::OnQuest"+ @slot +"TimeUp";
  217.             set @slot, 0;
  218.             close;
  219.         case 2:
  220.             mes "["+ strnpcinfo(1) +"]";
  221.             mes "Please select the slot with the mission that you wish to drop:";
  222.             set @slot, select(
  223.                 "#1 "+( ( @ms_b_m_1[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_1[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  224.                 "#2 "+( ( @ms_b_m_2[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_2[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  225.                 "#3 "+( ( @ms_b_m_3[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_3[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  226.                 "#4 "+( ( @ms_b_m_4[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_4[0] +"$[0]"):"^FF0000Empty" )+"^000000");
  227.             if ( getd("@ms_b_m_"+ @slot +"[0]") == 0 ) {
  228.                 mes "It appears that you have selected a empty slot!";
  229.                 close;
  230.             }
  231.             callsub L_showprogress;
  232.             mes "Are you sure that you want to give up this mission?";
  233.             mes "^777777NOTE: Any progress you've made for this mission will be lost!^000000";
  234.             next;
  235.             if ( select ( "Yes", "No" ) == 2 ) close;
  236.             mes "["+ strnpcinfo(1) +"]";
  237.             mes "^0000FF"+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"$[0]") +"^000000";
  238.             mes " ";
  239.             mes "Mission has given up successfully";
  240.             deletearray getd("@ms_b_m_"+ @slot);
  241.             setd "ms_b_m_"+ @slot +"$", "";
  242.             deltimer "ms_b_::OnQuest"+ @slot +"TimeUp";
  243.             set @slot, 0;
  244.             close;
  245.         case 3:
  246.             mes "["+ strnpcinfo(1) +"]";
  247.             mes "Please select a (empty) slot:";
  248.             if ( getd(".ms_b_n_"+ strnpcinfo(2) ) == 0 ) {
  249.                 mes "There is no mission available";
  250.                 close;
  251.             }
  252.             set .@slot, select(
  253.                 "#1 "+( ( @ms_b_m_1[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_1[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  254.                 "#2 "+( ( @ms_b_m_2[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_2[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  255.                 "#3 "+( ( @ms_b_m_3[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_3[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  256.                 "#4 "+( ( @ms_b_m_4[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_4[0] +"$[0]"):"^FF0000Empty" )+"^000000");
  257.             if ( getd("@ms_b_m_"+ .@slot +"[0]") ) {
  258.                 mes "The slot that you've selected is already taken by another mission. Please select another (empty) slot!";
  259.                 close;
  260.             }
  261.             mes "Select a mission to accept below:";
  262.             mes "^00CC00Green missions^000000 are within your level range and can be accepted.";
  263.             mes "^FF0000Red missions^000000 can not be accepted. The reason(s) can be: you're not within the level range or the daily cool-down delay hasn't passed yet.";
  264.             if ( basejob == Job_Novice || basejob == Job_SuperNovice ) set .@basejob, pow(2,0);
  265.             else if ( basejob == Job_Swordman ) set .@basejob, pow(2,1);
  266.             else if ( basejob == Job_Mage ) set .@basejob, pow(2,2);
  267.             else if ( basejob == Job_Archer ) set .@basejob, pow(2,3);
  268.             else if ( basejob == Job_Acolyte ) set .@basejob, pow(2,4);
  269.             else if ( basejob == Job_Merchant ) set .@basejob, pow(2,5);
  270.             else if ( basejob == Job_Thief ) set .@basejob, pow(2,6);
  271.             else if ( basejob == Job_Knight ) set .@basejob, pow(2,7);
  272.             else if ( basejob == Job_Priest ) set .@basejob, pow(2,8);
  273.             else if ( basejob == Job_Wizard ) set .@basejob, pow(2,9);
  274.             else if ( basejob == Job_Blacksmith ) set .@basejob, pow(2,10);
  275.             else if ( basejob == Job_Hunter ) set .@basejob, pow(2,11);
  276.             else if ( basejob == Job_Assassin ) set .@basejob, pow(2,12);
  277.             else if ( basejob == Job_Crusader ) set .@basejob, pow(2,13);
  278.             else if ( basejob == Job_Monk ) set .@basejob, pow(2,14);
  279.             else if ( basejob == Job_Sage ) set .@basejob, pow(2,15);
  280.             else if ( basejob == Job_Rogue ) set .@basejob, pow(2,16);
  281.             else if ( basejob == Job_Alchemist ) set .@basejob, pow(2,17);
  282.             else if ( basejob == Job_Bard || basejob == Job_Dancer ) set .@basejob, pow(2,18);
  283.             else if ( basejob == Job_Taekwon ) set .@basejob, pow(2,19);
  284.             else if ( basejob == Job_Star_Gladiator ) set .@basejob, pow(2,20);
  285.             else if ( basejob == Job_Soul_Linker ) set .@basejob, pow(2,21);
  286.             else if ( basejob == Job_Gunslinger ) set .@basejob, pow(2,22);
  287.             else if ( basejob == Job_Ninja ) set .@basejob, pow(2,23);
  288.             next;
  289.             while (1) {
  290.                 set .@menu$, "";
  291.                 set .@i, 0;
  292.                 set .@size1, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2)) );
  293.                 set .@size2, getarraysize( getd("@ms_b_n_"+ strnpcinfo(2)) );
  294.                 while ( .@i < .@size1 ) {
  295.                     set .@j, 1;
  296.                     while ( .@j < .@size2 && getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@j +"]") != getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") )
  297.                         set .@j, .@j +1 ;
  298.                     set .@color$, "^00AA00";
  299.                     if ( .@j != .@size2 && .@size2 ||
  300.                         @ms_b_m_1[0] == getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") ||
  301.                         @ms_b_m_2[0] == getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") ||
  302.                         @ms_b_m_3[0] == getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") ||
  303.                         @ms_b_m_4[0] == getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") ||
  304.                         getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[3]") && ( baselevel < getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[3]") || baselevel > getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[4]") ) ||
  305.                         getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[2]") && getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[2]") & .@basejob == 0 )
  306.                         set .@color$, "^FF0000";
  307.                     set .@menu$, .@menu$ + .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"$") +":";
  308.                     set .@i, .@i +1 ;
  309.                 }
  310.                 set .@menu, select(.@menu$) -1;
  311.                 set .@m_id, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]");
  312.                 mes "["+ strnpcinfo(1) +"]";
  313.                 mes "^0000FF"+ getd("$ms_b_m_"+ .@m_id +"$[0]") +"^000000";
  314.                 mes "Description: ^0000FF"+ getd("$ms_b_m_"+ .@m_id +"$[1]") +"^000000";
  315.                 if ( getd(".ms_b_m_"+ .@m_id +"[6]") ) {
  316.                     for ( set .@i, 1; .@i < .@size2; set .@i, .@i +1 ) {
  317.                         if ( getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") == .@m_id ) break;
  318.                     }
  319.                     mes "Status : "+( ( .@i == .@size2 || getd("@ms_b_n_"+ strnpcinfo(2)) == 0 )?"^FF0000Incomplete":"^00CC00Completed" )+"^000000";
  320.                 }
  321.                 mes " ";
  322.                 set .@size, getarraysize( getd(".ms_b_t_"+ .@m_id) );
  323.                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  324.                     mes "Require Mobs : ^0000FF"+ getd(".ms_b_t_"+ .@m_id +"["+ (.@i +1) +"]") +" "+ getmonsterinfo( getd(".ms_b_t_"+ .@m_id +"["+ .@i +"]") , 0) +"^000000";
  325.                 set .@size, getarraysize( getd(".ms_b_ir_"+ .@m_id) );
  326.                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  327.                     mes "Require Items : ^0000FF"+ getd(".ms_b_ir_"+ .@m_id +"["+ (.@i +1) +"]") +" "+ getitemname( getd(".ms_b_ir_"+ .@m_id +"["+ .@i +"]") ) +"^000000";
  328.                 mes " ";
  329.                 if ( getd(".ms_b_m_"+ .@m_id +"[6]") || getd(".ms_b_m_"+ .@m_id +"[3]") || getd(".ms_b_m_"+ .@m_id +"[5]") || getd(".ms_b_m_"+ .@m_id +"[2]") ) {
  330.                     mes "[^FF0000Limitations^000000]";
  331.                     if ( getd(".ms_b_m_"+ .@m_id +"[6]") )
  332.                         mes "Can do : "+( ( getd(".ms_b_m_"+ .@m_id +"[6]") == 1 )?"^00CC00Everyday":"^FF0000Only Once" )+"^000000";
  333.                     if ( getd(".ms_b_m_"+ .@m_id +"[3]") )
  334.                         mes "Base Level :"+( ( getd(".ms_b_m_"+ .@m_id +"[3]") )?"  ^0000FF"+ getd(".ms_b_m_"+ .@m_id +"[3]") +( ( getd(".ms_b_m_"+ .@m_id +"[3]") != getd(".ms_b_m_"+ .@m_id +"[4]") )?"~"+ getd(".ms_b_m_"+ .@m_id +"[4]"):"" )+"^000000":"" );
  335.                     if ( getd(".ms_b_m_"+ .@m_id +"[5]") )
  336.                         mes "Time Limit : ^FF0000"+( ( getd(".ms_b_m_"+ .@m_id +"[5]") /60 )?getd(".ms_b_m_"+ .@m_id +"[5]") /60 +" hour"+( ( getd(".ms_b_m_"+ .@m_id +"[5]") %60 )?" ":"" ):"" )+( ( getd(".ms_b_m_"+ .@m_id +"[5]") %60 )?getd(".ms_b_m_"+ .@m_id +"[5]") %60 +" min":"" )+"^000000";
  337.                     if ( getd(".ms_b_m_"+ .@m_id +"[2]") ) {
  338.                         deletearray .@joblimit;
  339.                         for ( set .@i, 0; .@i < 24; set .@i, .@i +1 ) {
  340.                             if ( getd(".ms_b_m_"+ .@m_id +"[2]") & pow( 2, .@i ) ) {
  341.                                 set .@joblimit[ getarraysize(.@joblimit) ], .@i +1;
  342.                             }
  343.                         }
  344.                         set .@joblimit$, .jobname$[ .@joblimit[0] -1 ];
  345.                         set .@size, getarraysize(.@joblimit);
  346.                         for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  347.                             set .@joblimit$, .@joblimit$ +", "+ .jobname$[ .@joblimit[.@i] -1 ];
  348.                         mes "Job Limit : ^00CC00"+ .@joblimit$ +"^000000";
  349.                     }
  350.                     mes " ";
  351.                 }
  352.                 mes "[^009900Rewards^000000]";
  353.                 if ( getd(".ms_b_m_"+ .@m_id +"[7]") )
  354.                     mes "Base Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ .@m_id +"[7]") ) +"^000000";
  355.                 if ( getd(".ms_b_m_"+ .@m_id +"[8]") )
  356.                     mes "Job Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ .@m_id +"[8]") ) +"^000000";
  357.                 if ( getd(".ms_b_m_"+ .@m_id +"[9]") )
  358.                     mes "Zeny : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ .@m_id +"[9]") ) +"^000000";
  359.                 if ( getd(".ms_b_m_"+ .@m_id +"[10]") )
  360.                     mes "Cash Point : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ .@m_id +"[10]") ) +"^000000";
  361.                 set .@size, getarraysize( getd(".ms_b_ia_"+ .@m_id ) );
  362.                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  363.                     mes "Item : ^0000FF"+ getd(".ms_b_ia_"+ .@m_id +"["+ (.@i +1) +"]") +" "+ getitemname( getd(".ms_b_ia_"+ .@m_id +"["+ .@i +"]") ) +"^000000";
  364.                 next;
  365.                 if ( select ( "- Accept this mission", "- Pick another mission" ) == 1 ) {
  366.                     for ( set .@i, 1; .@i < .@size2; set .@i, .@i +1 ) {
  367.                         if ( getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") == .@m_id ) {
  368.                             mes "["+ strnpcinfo(1) +"]";
  369.                             mes "It appears that you have already completed this mission. This mission can either only be completed once, or the daily cool-down delay hasn't passed yet!";
  370.                             set .@break, 1;
  371.                             next;
  372.                             break;
  373.                         }
  374.                     }
  375.                     if ( .@break == 0 && ( @ms_b_m_1[0] == .@m_id || @ms_b_m_2[0] == .@m_id || @ms_b_m_3[0] == .@m_id || @ms_b_m_4[0] == .@m_id ) ) {
  376.                         mes "["+ strnpcinfo(1) +"]";
  377.                         mes "You already taken this mission";
  378.                         set .@break, 1;
  379.                         next;
  380.                     }
  381.                     if ( .@break == 0 && getd(".ms_b_m_"+ .@m_id +"[3]") && ( baselevel < getd(".ms_b_m_"+ .@m_id +"[3]") || baselevel > getd(".ms_b_m_"+ .@m_id +"[4]") ) ) {
  382.                         mes "["+ strnpcinfo(1) +"]";
  383.                         mes "You're not within the level range to accept this mission!";
  384.                         set .@break, 1;
  385.                         next;
  386.                     }
  387.                     if ( .@break == 0 && getd(".ms_b_m_"+ .@m_id +"[2]") ) {
  388.                         if ( getd(".ms_b_m_"+ .@m_id +"[2]") & .@basejob == 0 ) {
  389.                             mes "["+ strnpcinfo(1) +"]";
  390.                             mes "Your current job class is not allowed to do this mission";
  391.                             set .@break, 1;
  392.                             next;
  393.                         }
  394.                     }
  395.                     if ( .@break == 0 ) break;
  396.                 }
  397.                 set .@break, 0;
  398.             }
  399.             mes "["+ strnpcinfo(1) +"]";
  400.             mes "You have accepted the following mission:";
  401.             mes "^0000FF"+ getd("$ms_b_m_"+ .@m_id +"$[0]") +"^000000";
  402.             if ( getd(".ms_b_m_"+ .@m_id +"[5]") ) {
  403.                 mes "Time Left : ^FF0000"+( ( getd(".ms_b_m_"+ .@m_id +"[5]") /60 )?getd(".ms_b_m_"+ .@m_id +"[5]") /60 +" hour"+( ( getd(".ms_b_m_"+ .@m_id +"[5]") %60 )?" ":"" ):"" )+( ( getd(".ms_b_m_"+ .@m_id +"[5]") %60 )?getd(".ms_b_m_"+ .@m_id +"[5]") %60 +" min":"" )+"^000000";
  404.                 addtimer getd(".ms_b_m_"+ .@m_id +"[5]") * 60 * 1000, "ms_b_::OnQuest"+ .@slot +"TimeUp";
  405.                 setd "@ms_b_m_"+ .@slot +"[1]", gettimetick(2) + getd(".ms_b_m_"+ .@m_id +"[5]") * 60;
  406.             }
  407.             setd "@ms_b_m_"+ .@slot +"[0]", .@m_id;
  408.             setd "ms_b_m_"+ .@slot +"$", getd("@ms_b_m_"+ .@slot +"[0]") +"#"+ getd("@ms_b_m_"+ .@slot +"[1]");
  409.             close;
  410.         case 4:
  411.             if ( getgmlevel() < 99 ) end;
  412.             while (1) {
  413.                 mes "["+ strnpcinfo(1) +"]";
  414.                 mes "Please select an option below:";
  415.                 next;
  416.                 switch ( select ( "Setup a mission", "Edit a mission", "Remove a mission", "Swap mission order" ) ) {
  417.                     case 1:
  418.                         if ( $ms_b_id >= 99999 ) {
  419.                             mes "["+ strnpcinfo(1) +"]";
  420.                             mes "This is the end, you can't create anymore missions";
  421.                             close;
  422.                         }
  423.                         else if ( getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) ) == 40 ) {
  424.                             mes "["+ strnpcinfo(1) +"]";
  425.                             mes "Each NPC are only allowed to setup 40 missions";
  426.                             next;
  427.                             break;
  428.                         }
  429.                         deletearray @tmp_ms_b_m_$;
  430.                         deletearray @tmp_ms_b_m_;
  431.                         deletearray @tmp_ms_b_t_;
  432.                         deletearray @tmp_ms_b_ir_;
  433.                         deletearray @tmp_ms_b_ia_;
  434.                         if ( callsub( L_setupmission, 0 ) == 0 ) {
  435.                             deletearray @tmp_ms_b_m_$;
  436.                             deletearray @tmp_ms_b_m_;
  437.                             deletearray @tmp_ms_b_t_;
  438.                             deletearray @tmp_ms_b_ir_;
  439.                             deletearray @tmp_ms_b_ia_;
  440.                             break;
  441.                         }
  442.                         set $ms_b_id, $ms_b_id +1 ;
  443.                         setd ".ms_b_n_"+ strnpcinfo(2) +"["+ getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) ) +"]", $ms_b_id;
  444.                         setd "$ms_b_n_"+ strnpcinfo(2) +"$", getd(".ms_b_n_"+ strnpcinfo(2) +"[0]");
  445.                         set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) );
  446.                         for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  447.                             setd "$ms_b_n_"+ strnpcinfo(2) +"$", getd("$ms_b_n_"+ strnpcinfo(2) +"$") +"#"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]");
  448.                         set @tmp_ms_b_m_[11], strnpcinfo(2);
  449.                         copyarray getd(".ms_b_m_"+ $ms_b_id +"$"), @tmp_ms_b_m_$, 128;
  450.                         copyarray getd(".ms_b_m_"+ $ms_b_id), @tmp_ms_b_m_, 128;
  451.                         copyarray getd(".ms_b_t_"+ $ms_b_id ), @tmp_ms_b_t_, 128;
  452.                         copyarray getd(".ms_b_ir_"+ $ms_b_id ), @tmp_ms_b_ir_, 128;
  453.                         copyarray getd(".ms_b_ia_"+ $ms_b_id ), @tmp_ms_b_ia_, 128;
  454.                         setarray getd("$ms_b_m_"+ $ms_b_id +"$"),
  455.                             @tmp_ms_b_m_$[0],
  456.                             @tmp_ms_b_m_$[1],
  457.                             ( ( @tmp_ms_b_m_[2] )?@tmp_ms_b_m_[2]:"" )+"#"+( ( @tmp_ms_b_m_[3] )?@tmp_ms_b_m_[3]:"" )+"#"+( ( @tmp_ms_b_m_[4] )?@tmp_ms_b_m_[4]:"" )+"#"+( ( @tmp_ms_b_m_[5] )?@tmp_ms_b_m_[5]:"" )+"#"+( ( @tmp_ms_b_m_[6] )?@tmp_ms_b_m_[6]:"" )+"#"+( ( @tmp_ms_b_m_[7] )?@tmp_ms_b_m_[7]:"" )+"#"+( ( @tmp_ms_b_m_[8] )?@tmp_ms_b_m_[8]:"" )+"#"+( ( @tmp_ms_b_m_[9] )?@tmp_ms_b_m_[9]:"" )+"#"+( ( @tmp_ms_b_m_[10] )?@tmp_ms_b_m_[10]:"" )+"#"+( ( @tmp_ms_b_m_[11] )?@tmp_ms_b_m_[11]:"" )+"#"+( ( @tmp_ms_b_m_[12] )?@tmp_ms_b_m_[12]:"" )+"#"+( ( @tmp_ms_b_m_[13] )?@tmp_ms_b_m_[13]:"" ),
  458.                             ( ( @tmp_ms_b_t_[0] )?@tmp_ms_b_t_[0]:"" )+"#"+( ( @tmp_ms_b_t_[1] )?@tmp_ms_b_t_[1]:"" )+"#"+( ( @tmp_ms_b_t_[2] )?@tmp_ms_b_t_[2]:"" )+"#"+( ( @tmp_ms_b_t_[3] )?@tmp_ms_b_t_[3]:"" )+"#"+( ( @tmp_ms_b_t_[4] )?@tmp_ms_b_t_[4]:"" )+"#"+( ( @tmp_ms_b_t_[5] )?@tmp_ms_b_t_[5]:"" )+"#"+( ( @tmp_ms_b_t_[6] )?@tmp_ms_b_t_[6]:"" )+"#"+( ( @tmp_ms_b_t_[7] )?@tmp_ms_b_t_[7]:"" )+"#"+( ( @tmp_ms_b_t_[8] )?@tmp_ms_b_t_[8]:"" )+"#"+( ( @tmp_ms_b_t_[9] )?@tmp_ms_b_t_[9]:"" )+"#"+( ( @tmp_ms_b_t_[10] )?@tmp_ms_b_t_[10]:"" )+"#"+( ( @tmp_ms_b_t_[11] )?@tmp_ms_b_t_[11]:"" )+"#"+( ( @tmp_ms_b_t_[12] )?@tmp_ms_b_t_[12]:"" )+"#"+( ( @tmp_ms_b_t_[13] )?@tmp_ms_b_t_[13]:"" )+"#"+( ( @tmp_ms_b_t_[14] )?@tmp_ms_b_t_[14]:"" )+"#"+( ( @tmp_ms_b_t_[15] )?@tmp_ms_b_t_[15]:"" )+"#"+( ( @tmp_ms_b_ir_[0] )?@tmp_ms_b_ir_[0]:"" )+"#"+( ( @tmp_ms_b_ir_[1] )?@tmp_ms_b_ir_[1]:"" )+"#"+( ( @tmp_ms_b_ir_[2] )?@tmp_ms_b_ir_[2]:"" )+"#"+( ( @tmp_ms_b_ir_[3] )?@tmp_ms_b_ir_[3]:"" )+"#"+( ( @tmp_ms_b_ir_[4] )?@tmp_ms_b_ir_[4]:"" )+"#"+( ( @tmp_ms_b_ir_[5] )?@tmp_ms_b_ir_[5]:"" )+"#"+( ( @tmp_ms_b_ir_[6] )?@tmp_ms_b_ir_[6]:"" )+"#"+( ( @tmp_ms_b_ir_[7] )?@tmp_ms_b_ir_[7]:"" )+"#"+( ( @tmp_ms_b_ir_[8] )?@tmp_ms_b_ir_[8]:"" )+"#"+( ( @tmp_ms_b_ir_[9] )?@tmp_ms_b_ir_[9]:"" )+"#"+( ( @tmp_ms_b_ia_[0] )?@tmp_ms_b_ia_[0]:"" )+"#"+( ( @tmp_ms_b_ia_[1] )?@tmp_ms_b_ia_[1]:"" )+"#"+( ( @tmp_ms_b_ia_[2] )?@tmp_ms_b_ia_[2]:"" )+"#"+( ( @tmp_ms_b_ia_[3] )?@tmp_ms_b_ia_[3]:"" )+"#"+( ( @tmp_ms_b_ia_[4] )?@tmp_ms_b_ia_[4]:"" )+"#"+( ( @tmp_ms_b_ia_[5] )?@tmp_ms_b_ia_[5]:"" )+"#"+( ( @tmp_ms_b_ia_[6] )?@tmp_ms_b_ia_[6]:"" )+"#"+( ( @tmp_ms_b_ia_[7] )?@tmp_ms_b_ia_[7]:"" )+"#"+( ( @tmp_ms_b_ia_[8] )?@tmp_ms_b_ia_[8]:"" )+"#"+( ( @tmp_ms_b_ia_[9] )?@tmp_ms_b_ia_[9]:"" );
  459.                         deletearray @tmp_ms_b_m_$;
  460.                         deletearray @tmp_ms_b_m_;
  461.                         deletearray @tmp_ms_b_t_;
  462.                         deletearray @tmp_ms_b_ir_;
  463.                         deletearray @tmp_ms_b_ia_;
  464.                         mes " ";
  465.                         mes "Mission has setup successfully";
  466.                         next;
  467.                         break;
  468.                     case 2:
  469.                         mes "["+ strnpcinfo(1) +"]";
  470.                         if ( getd(".ms_b_n_"+ strnpcinfo(2) ) == 0 ) {
  471.                             mes "There is no mission available to edit.";
  472.                             next;
  473.                             break;
  474.                         }
  475.                         mes "Select a mission below to edit:";
  476.                         next;
  477.                         if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 0 ) set .@color$, "^0000FF";
  478.                         else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 1 ) set .@color$, "^00CC00";
  479.                         else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 2 ) set .@color$, "^FF0000";
  480.                         set .@menu$, "^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"$");
  481.                         set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2)) );
  482.                         for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 ) {
  483.                             if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 0 ) set .@color$, "^0000FF";
  484.                             else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 1 ) set .@color$, "^00CC00";
  485.                             else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 2 ) set .@color$, "^FF0000";
  486.                             set .@menu$, .@menu$ +":^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"$");
  487.                         }
  488.                         set .@menu$, .@menu$ +":^000000 - back";
  489.                         set .@menu, select(.@menu$) -1;
  490.                         if ( .@menu == .@size ) break;
  491.                         set @m_id, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]");
  492.                         deletearray @tmp_ms_b_m_$;
  493.                         deletearray @tmp_ms_b_m_;
  494.                         deletearray @tmp_ms_b_t_;
  495.                         deletearray @tmp_ms_b_ir_;
  496.                         deletearray @tmp_ms_b_ia_;
  497.                         copyarray @tmp_ms_b_m_$, getd("$ms_b_m_"+ @m_id +"$"), 128;
  498.                         copyarray @tmp_ms_b_m_, getd(".ms_b_m_"+ @m_id ), 128;
  499.                         copyarray @tmp_ms_b_t_, getd(".ms_b_t_"+ @m_id ), 128;
  500.                         copyarray @tmp_ms_b_ir_, getd(".ms_b_ir_"+ @m_id ), 128;
  501.                         copyarray @tmp_ms_b_ia_, getd(".ms_b_ia_"+ @m_id ), 128;
  502.                         if ( callsub( L_setupmission, 1 ) == 0 ) {
  503.                             deletearray @tmp_ms_b_m_$;
  504.                             deletearray @tmp_ms_b_m_;
  505.                             deletearray @tmp_ms_b_t_;
  506.                             deletearray @tmp_ms_b_ir_;
  507.                             deletearray @tmp_ms_b_ia_;
  508.                             set @m_id, 0;
  509.                             break;
  510.                         }
  511.                         copyarray getd(".ms_b_m_"+ @m_id +"$"), @tmp_ms_b_m_$, 128;
  512.                         copyarray getd(".ms_b_m_"+ @m_id), @tmp_ms_b_m_, 128;
  513.                         copyarray getd(".ms_b_t_"+ @m_id ), @tmp_ms_b_t_, 128;
  514.                         copyarray getd(".ms_b_ir_"+ @m_id ), @tmp_ms_b_ir_, 128;
  515.                         copyarray getd(".ms_b_ia_"+ @m_id ), @tmp_ms_b_ia_, 128;
  516.                         setarray getd("$ms_b_m_"+ @m_id +"$"),
  517.                             @tmp_ms_b_m_$[0],
  518.                             @tmp_ms_b_m_$[1],
  519.                             ( ( @tmp_ms_b_m_[2] )?@tmp_ms_b_m_[2]:"" )+"#"+( ( @tmp_ms_b_m_[3] )?@tmp_ms_b_m_[3]:"" )+"#"+( ( @tmp_ms_b_m_[4] )?@tmp_ms_b_m_[4]:"" )+"#"+( ( @tmp_ms_b_m_[5] )?@tmp_ms_b_m_[5]:"" )+"#"+( ( @tmp_ms_b_m_[6] )?@tmp_ms_b_m_[6]:"" )+"#"+( ( @tmp_ms_b_m_[7] )?@tmp_ms_b_m_[7]:"" )+"#"+( ( @tmp_ms_b_m_[8] )?@tmp_ms_b_m_[8]:"" )+"#"+( ( @tmp_ms_b_m_[9] )?@tmp_ms_b_m_[9]:"" )+"#"+( ( @tmp_ms_b_m_[10] )?@tmp_ms_b_m_[10]:"" )+"#"+( ( @tmp_ms_b_m_[11] )?@tmp_ms_b_m_[11]:"" )+"#"+( ( @tmp_ms_b_m_[12] )?@tmp_ms_b_m_[12]:"" )+"#"+( ( @tmp_ms_b_m_[13] )?@tmp_ms_b_m_[13]:"" ),
  520.                             ( ( @tmp_ms_b_t_[0] )?@tmp_ms_b_t_[0]:"" )+"#"+( ( @tmp_ms_b_t_[1] )?@tmp_ms_b_t_[1]:"" )+"#"+( ( @tmp_ms_b_t_[2] )?@tmp_ms_b_t_[2]:"" )+"#"+( ( @tmp_ms_b_t_[3] )?@tmp_ms_b_t_[3]:"" )+"#"+( ( @tmp_ms_b_t_[4] )?@tmp_ms_b_t_[4]:"" )+"#"+( ( @tmp_ms_b_t_[5] )?@tmp_ms_b_t_[5]:"" )+"#"+( ( @tmp_ms_b_t_[6] )?@tmp_ms_b_t_[6]:"" )+"#"+( ( @tmp_ms_b_t_[7] )?@tmp_ms_b_t_[7]:"" )+"#"+( ( @tmp_ms_b_t_[8] )?@tmp_ms_b_t_[8]:"" )+"#"+( ( @tmp_ms_b_t_[9] )?@tmp_ms_b_t_[9]:"" )+"#"+( ( @tmp_ms_b_t_[10] )?@tmp_ms_b_t_[10]:"" )+"#"+( ( @tmp_ms_b_t_[11] )?@tmp_ms_b_t_[11]:"" )+"#"+( ( @tmp_ms_b_t_[12] )?@tmp_ms_b_t_[12]:"" )+"#"+( ( @tmp_ms_b_t_[13] )?@tmp_ms_b_t_[13]:"" )+"#"+( ( @tmp_ms_b_t_[14] )?@tmp_ms_b_t_[14]:"" )+"#"+( ( @tmp_ms_b_t_[15] )?@tmp_ms_b_t_[15]:"" )+"#"+( ( @tmp_ms_b_ir_[0] )?@tmp_ms_b_ir_[0]:"" )+"#"+( ( @tmp_ms_b_ir_[1] )?@tmp_ms_b_ir_[1]:"" )+"#"+( ( @tmp_ms_b_ir_[2] )?@tmp_ms_b_ir_[2]:"" )+"#"+( ( @tmp_ms_b_ir_[3] )?@tmp_ms_b_ir_[3]:"" )+"#"+( ( @tmp_ms_b_ir_[4] )?@tmp_ms_b_ir_[4]:"" )+"#"+( ( @tmp_ms_b_ir_[5] )?@tmp_ms_b_ir_[5]:"" )+"#"+( ( @tmp_ms_b_ir_[6] )?@tmp_ms_b_ir_[6]:"" )+"#"+( ( @tmp_ms_b_ir_[7] )?@tmp_ms_b_ir_[7]:"" )+"#"+( ( @tmp_ms_b_ir_[8] )?@tmp_ms_b_ir_[8]:"" )+"#"+( ( @tmp_ms_b_ir_[9] )?@tmp_ms_b_ir_[9]:"" )+"#"+( ( @tmp_ms_b_ia_[0] )?@tmp_ms_b_ia_[0]:"" )+"#"+( ( @tmp_ms_b_ia_[1] )?@tmp_ms_b_ia_[1]:"" )+"#"+( ( @tmp_ms_b_ia_[2] )?@tmp_ms_b_ia_[2]:"" )+"#"+( ( @tmp_ms_b_ia_[3] )?@tmp_ms_b_ia_[3]:"" )+"#"+( ( @tmp_ms_b_ia_[4] )?@tmp_ms_b_ia_[4]:"" )+"#"+( ( @tmp_ms_b_ia_[5] )?@tmp_ms_b_ia_[5]:"" )+"#"+( ( @tmp_ms_b_ia_[6] )?@tmp_ms_b_ia_[6]:"" )+"#"+( ( @tmp_ms_b_ia_[7] )?@tmp_ms_b_ia_[7]:"" )+"#"+( ( @tmp_ms_b_ia_[8] )?@tmp_ms_b_ia_[8]:"" )+"#"+( ( @tmp_ms_b_ia_[9] )?@tmp_ms_b_ia_[9]:"" );
  521.                         deletearray @tmp_ms_b_m_$;
  522.                         deletearray @tmp_ms_b_m_;
  523.                         deletearray @tmp_ms_b_t_;
  524.                         deletearray @tmp_ms_b_ir_;
  525.                         deletearray @tmp_ms_b_ia_;
  526.                         set @m_id, 0;
  527.                         mes " ";
  528.                         mes "Mission has edited successfully";
  529.                         next;
  530.                         break;
  531.                     case 3:
  532.                         mes "["+ strnpcinfo(1) +"]";
  533.                         if ( getd(".ms_b_n_"+ strnpcinfo(2) ) == 0 ) {
  534.                             mes "There is no mission available to remove.";
  535.                             next;
  536.                             break;
  537.                         }
  538.                         mes "Select a mission below to delete:";
  539.                         next;
  540.                         if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 0 ) set .@color$, "^0000FF";
  541.                         else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 1 ) set .@color$, "^00CC00";
  542.                         else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 2 ) set .@color$, "^FF0000";
  543.                         set .@menu$, "^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"$");
  544.                         set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2)) );
  545.                         for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 ) {
  546.                             if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 0 ) set .@color$, "^0000FF";
  547.                             else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 1 ) set .@color$, "^00CC00";
  548.                             else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 2 ) set .@color$, "^FF0000";
  549.                             set .@menu$, .@menu$ +":^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"$");
  550.                         }
  551.                         set .@menu$, .@menu$ +":^000000 - back";
  552.                         set .@menu, select(.@menu$) -1;
  553.                         if ( .@menu == .@size ) break;
  554.                         mes "["+ strnpcinfo(1) +"]";
  555.                         mes "Are you sure that you want to delete the selected mission?";
  556.                         mes " ";
  557.                         set .@m_id, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]");
  558.                         if ( getd(".ms_b_m_"+ .@m_id +"[6]") == 0 ) set .@color$, "^0000FF";
  559.                         else if ( getd(".ms_b_m_"+ .@m_id +"[6]") == 1 ) set .@color$, "^00CC00";
  560.                         else if ( getd(".ms_b_m_"+ .@m_id +"[6]") == 2 ) set .@color$, "^FF0000";
  561.                         mes "^996600"+ .@m_id +". "+ .@color$ + getd("$ms_b_m_"+ .@m_id +"$") +"^000000";
  562.                         mes "Description: ^0000FF"+ getd("$ms_b_m_"+ .@m_id +"$[1]") +"^000000";
  563.                         next;
  564.                         if ( select ( "No", "Yes" ) == 1 ) break;
  565.                         mes "["+ strnpcinfo(1) +"]";
  566.                         mes "Mission has deleted successfully";
  567.                         mes " ";
  568.                         mes "^996600"+ .@m_id +". "+ .@color$ + getd("$ms_b_m_"+ .@m_id +"$") +"^000000";
  569.                         deletearray getd(".ms_b_m_"+ .@m_id +"$");
  570.                         deletearray getd(".ms_b_m_"+ .@m_id );
  571.                         deletearray getd(".ms_b_t_"+ .@m_id );
  572.                         deletearray getd(".ms_b_ir_"+ .@m_id );
  573.                         deletearray getd(".ms_b_ia_"+ .@m_id );
  574.                         deletearray getd("$ms_b_m_"+ .@m_id +"$");
  575.                         deletearray getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]"), 1;
  576.                         setd "$ms_b_n_"+ strnpcinfo(2) +"$", ( ( getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") )?getd(".ms_b_n_"+ strnpcinfo(2) +"[0]"):"" );
  577.                         set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) );
  578.                         for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  579.                             setd "$ms_b_n_"+ strnpcinfo(2) +"$", getd("$ms_b_n_"+ strnpcinfo(2) +"$") +"#"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"#";
  580.                         next;
  581.                         break;
  582.                     case 4:
  583.                         mes "["+ strnpcinfo(1) +"]";
  584.                         if ( getd(".ms_b_n_"+ strnpcinfo(2) ) == 0 ) {
  585.                             mes "There is no mission available to swap";
  586.                             next;
  587.                             break;
  588.                         }
  589.                         mes "Select a mission below to swap:";
  590.                         next;
  591.                         if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 0 ) set .@color$, "^0000FF";
  592.                         else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 1 ) set .@color$, "^00CC00";
  593.                         else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 2 ) set .@color$, "^FF0000";
  594.                         set .@menu$, "^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"$");
  595.                         set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2)) );
  596.                         for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 ) {
  597.                             if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 0 ) set .@color$, "^0000FF";
  598.                             else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 1 ) set .@color$, "^00CC00";
  599.                             else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 2 ) set .@color$, "^FF0000";
  600.                             set .@menu$, .@menu$ +":^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"$");
  601.                         }
  602.                         set .@menu$, .@menu$ +":^000000 - back";
  603.                         set .@menu, select(.@menu$) -1;
  604.                         if ( .@menu == .@size ) break;
  605.                         mes "["+ strnpcinfo(1) +"]";
  606.                         mes "mission selected :";
  607.                         set .@m_id1, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]");
  608.                         if ( getd(".ms_b_m_"+ .@m_id1 +"[6]") == 0 ) set .@color1$, "^0000FF";
  609.                         else if ( getd(".ms_b_m_"+ .@m_id1 +"[6]") == 1 ) set .@color1$, "^00CC00";
  610.                         else if ( getd(".ms_b_m_"+ .@m_id1 +"[6]") == 2 ) set .@color1$, "^FF0000";
  611.                         mes "^996600"+ .@m_id1 +". "+ .@color1$ + getd("$ms_b_m_"+ .@m_id1 +"$") +"^000000";
  612.                         mes " ";
  613.                         mes "Please select another mission to be swapped:";
  614.                         next;
  615.                         set .@menu2, select(.@menu$) -1;
  616.                         if ( .@menu2 == .@size ) break;
  617.                         mes "["+ strnpcinfo(1) +"]";
  618.                         mes "Missions has swapped successfully";
  619.                         set .@m_id2, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu2 +"]");
  620.                         if ( getd(".ms_b_m_"+ .@m_id2 +"[6]") == 0 ) set .@color2$, "^0000FF";
  621.                         else if ( getd(".ms_b_m_"+ .@m_id2 +"[6]") == 1 ) set .@color2$, "^00CC00";
  622.                         else if ( getd(".ms_b_m_"+ .@m_id2 +"[6]") == 2 ) set .@color2$, "^FF0000";
  623.                         mes "^996600"+ .@m_id1 +". "+ .@color1$ + getd("$ms_b_m_"+ .@m_id1 +"$") +"^000000";
  624.                         mes "^996600"+ .@m_id2 +". "+ .@color2$ + getd("$ms_b_m_"+ .@m_id2 +"$") +"^000000";
  625.                         setd ".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]", .@m_id2;
  626.                         setd ".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu2 +"]", .@m_id1;
  627.                         setd "$ms_b_n_"+ strnpcinfo(2) +"$", getd(".ms_b_n_"+ strnpcinfo(2) +"[0]");
  628.                         set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) );
  629.                         for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  630.                             setd "$ms_b_n_"+ strnpcinfo(2) +"$", getd("$ms_b_n_"+ strnpcinfo(2) +"$") +"#"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]");
  631.                         next;
  632.                         break;
  633.                 }
  634.             }
  635.     }
  636.     close;
  637. OnQuest1TimeUp:
  638.     dispbottom "Mission #1: "+ getd("$ms_b_m_"+ @ms_b_m_1[0] +"$[0]") +" has Time Up";
  639.     deletearray @ms_b_m_1;
  640.     set ms_b_m_1$, "";
  641.     end;
  642. OnQuest2TimeUp:
  643.     dispbottom "Mission #2: "+ getd("$ms_b_m_"+ @ms_b_m_2[0] +"$[0]") +" has Time Up";
  644.     deletearray @ms_b_m_2;
  645.     set ms_b_m_2$, "";
  646.     end;
  647. OnQuest3TimeUp:
  648.     dispbottom "Mission #3: "+ getd("$ms_b_m_"+ @ms_b_m_3[0] +"$[0]") +" has Time Up";
  649.     deletearray @ms_b_m_3;
  650.     set ms_b_m_3$, "";
  651.     end;
  652. OnQuest4TimeUp:
  653.     dispbottom "Mission #4: "+ getd("$ms_b_m_"+ @ms_b_m_4[0] +"$[0]") +" has Time Up";
  654.     deletearray @ms_b_m_4;
  655.     set ms_b_m_4$, "";
  656.     end;
  657. L_showprogress:
  658.     mes "^0000FF"+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"$[0]") +"^000000";
  659.     mes "Description: ^0000FF"+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"$[1]") +"^000000";
  660.     mes " ";
  661.     mes "[^804000Mission Progress^000000]";
  662.     if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[5]") ) {
  663.         set .@left, getd("@ms_b_m_"+ @slot +"[1]") - gettimetick(2);
  664.         set .@hour, .@left / 3600;
  665.         set .@min, .@left % 3600 / 60;
  666.         set .@sec, .@left % 60;
  667.         mes "Time Left:  ^FF0000"+( ( .@hour )?.@hour +" hour ":"" )+( ( .@hour || .@min )?.@min +" min ":"" )+ .@sec +" sec^000000";
  668.     }
  669.     set .@size, getarraysize( getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  670.     for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  671.         mes "Mobs : ^0000FF"+ getmonsterinfo( getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") , 0) +"^000000 ["+( ( getd("@ms_b_m_"+ @slot +"["+( .@i/2 +2 )+"]") > getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]") )?getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]"):getd("@ms_b_m_"+ @slot +"["+( .@i/2 +2 )+"]") ) +"/"+ getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]") +"]";
  672.     set .@size, getarraysize( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  673.     for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  674.         mes "Items : ^0000FF"+ getitemname( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") ) +"^000000 ["+ countitem( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") ) +"/"+ getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]") +"]";
  675.     mes " ";
  676.     mes "[^009900Rewards^000000]";
  677.     if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]") )
  678.         mes "Base Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]") ) +"^000000";
  679.     if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]") )
  680.         mes "Job Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]") ) +"^000000";
  681.     if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]") )
  682.         mes "Zeny : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]") ) +"^000000";
  683.     if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]") )
  684.         mes "Cash Point : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]") ) +"^000000";
  685.     set .@size, getarraysize( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  686.     for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  687.         mes "Item : ^0000FF"+ getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]") +" "+ getitemname( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") ) +"^000000";
  688.     mes " ";
  689.     return;
  690. L_setupmission:
  691.     while (1) {
  692.         mes "["+ strnpcinfo(1) +"]";
  693.         mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  694.         mes "Description: "+( ( @tmp_ms_b_m_$[1] != "" )?"^0000FF"+ @tmp_ms_b_m_$[1]:"^FF0000Incomplete" )+"^000000";
  695.         mes " ";
  696.         if ( @tmp_ms_b_t_ == 0 && @tmp_ms_b_ir_ == 0 )
  697.             mes "Require mobs : ^FF0000Incomplete^000000";
  698.         set .@size, getarraysize(@tmp_ms_b_t_);
  699.         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  700.             mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  701.         if ( @tmp_ms_b_t_ == 0 && @tmp_ms_b_ir_ == 0 )
  702.             mes "Require items : ^FF0000Incomplete^000000";
  703.         set .@size, getarraysize(@tmp_ms_b_ir_);
  704.         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  705.             mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  706.         mes " ";
  707.         if ( @tmp_ms_b_m_[6] || @tmp_ms_b_m_[3] || @tmp_ms_b_m_[5] || @tmp_ms_b_m_[2] ) {
  708.             mes "[^FF0000Limitations^000000]";
  709.             if ( @tmp_ms_b_m_[6] )
  710.                 mes "Can do : "+( ( @tmp_ms_b_m_[6] == 1 )?"^00CC00Everyday":"^FF0000Only Once" )+"^000000";
  711.             if ( @tmp_ms_b_m_[3] )
  712.                 mes "Base Level :"+( ( @tmp_ms_b_m_[3] )?"  ^0000FF"+ @tmp_ms_b_m_[3] +( ( @tmp_ms_b_m_[3] != @tmp_ms_b_m_[4] )?"~"+ @tmp_ms_b_m_[4]:"" )+"^000000":"" );
  713.             if ( @tmp_ms_b_m_[5] )
  714.                 mes "Time Limit : ^FF0000"+( ( @tmp_ms_b_m_[5] /60 )?@tmp_ms_b_m_[5] /60 +" hour"+( ( @tmp_ms_b_m_[5] %60 )?" ":"" ):"" )+( ( @tmp_ms_b_m_[5] %60 )?@tmp_ms_b_m_[5] %60 +" min":"" )+"^000000";
  715.             if ( @tmp_ms_b_m_[2] ) {
  716.                 deletearray .@joblimit;
  717.                 for ( set .@i, 0; .@i < 24; set .@i, .@i +1 ) {
  718.                     if ( @tmp_ms_b_m_[2] & pow( 2, .@i ) ) {
  719.                         set .@joblimit[ getarraysize(.@joblimit) ], .@i +1;
  720.                     }
  721.                 }
  722.                 set .@joblimit$, .jobname$[ .@joblimit[0] -1 ];
  723.                 set .@size, getarraysize(.@joblimit);
  724.                 for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  725.                     set .@joblimit$, .@joblimit$ +", "+ .jobname$[ .@joblimit[.@i] -1 ];
  726.                 mes "Job Limit : ^00CC00"+ .@joblimit$ +"^000000";
  727.             }
  728.             mes " ";
  729.         }
  730.         mes "[^009900Rewards^000000]";
  731.         if ( @tmp_ms_b_m_[7] || @tmp_ms_b_m_[8] || @tmp_ms_b_m_[9] || @tmp_ms_b_m_[10] || @tmp_ms_b_ia_ )
  732.             set .@color_reward$, "";
  733.         else {
  734.             mes "^FF0000Incomplete^000000";
  735.             set .@color_reward$, "  - ^FF0000Incomplete^000000";
  736.         }
  737.         if ( @tmp_ms_b_m_[7] )
  738.             mes "Base Exp : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[7] ) +"^000000";
  739.         if ( @tmp_ms_b_m_[8] )
  740.             mes "Job Exp : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[8] ) +"^000000";
  741.         if ( @tmp_ms_b_m_[9] )
  742.             mes "Zeny : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[9] ) +"^000000";
  743.         if ( @tmp_ms_b_m_[10] )
  744.             mes "Cash Point : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[10] ) +"^000000";
  745.         set .@size, getarraysize(@tmp_ms_b_ia_);
  746.         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  747.             mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  748.         next;
  749.         if ( @tmp_ms_b_m_$[0] != "" && @tmp_ms_b_m_$[1] != "" && ( @tmp_ms_b_t_ || @tmp_ms_b_ir_ ) &&
  750.             ( @tmp_ms_b_m_[7] || @tmp_ms_b_m_[8] || @tmp_ms_b_m_[9] || @tmp_ms_b_m_[10] || @tmp_ms_b_ia_ ) )
  751.             set .@color_all$, "^00CC00";
  752.         else
  753.             set .@color_all$, "^FF0000";
  754.         set .@setupmenu, select (
  755.             "Important Settings"+( ( @tmp_ms_b_m_$[0] != "" && @tmp_ms_b_m_$[1] != "" && ( @tmp_ms_b_t_ || @tmp_ms_b_ir_ ) )?"":"  - ^FF0000Incomplete^000000" ),
  756.             "Mission Limitations",
  757.             "Rewards"+ .@color_reward$,
  758.             .@color_all$ +"Complete "+( ( getarg(0) )?"Edit":"Setup" )+"^000000",
  759.             "- back" );
  760.         switch ( .@setupmenu ) {
  761.             case 1:
  762.                 while (1) {
  763.                     mes "["+ strnpcinfo(1) +"]";
  764.                     mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  765.                     mes "Description: "+( ( @tmp_ms_b_m_$[1] != "" )?"^0000FF"+ @tmp_ms_b_m_$[1]:"^FF0000Incomplete" )+"^000000";
  766.                     mes " ";
  767.                     if ( @tmp_ms_b_t_ == 0 && @tmp_ms_b_ir_ == 0 )
  768.                         mes "Require mobs : ^FF0000Incomplete^000000";
  769.                     set .@size, getarraysize(@tmp_ms_b_t_);
  770.                     for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  771.                         mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  772.                     if ( @tmp_ms_b_t_ == 0 && @tmp_ms_b_ir_ == 0 )
  773.                         mes "Require items : ^FF0000Incomplete^000000";
  774.                     set .@size, getarraysize(@tmp_ms_b_ir_);
  775.                     for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  776.                         mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  777.                     next;
  778.                     set .@importantmenu, select (
  779.                         "Mission Name"+( ( @tmp_ms_b_m_$[0] != "" )?"":"  - ^FF0000Incomplete^000000" ),
  780.                         "Description"+( ( @tmp_ms_b_m_$[1] != "" )?"":"  - ^FF0000Incomplete^000000" ),
  781.                         "Require Mobs",
  782.                         "Require Items",
  783.                         "- back" );
  784.                     switch ( .@importantmenu ) {
  785.                         case 1:
  786.                             mes "["+ strnpcinfo(1) +"]";
  787.                             mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  788.                             mes " ";
  789.                             mes "Input the mission name";
  790.                             next;
  791.                             input .@tmp$;
  792.                             mes "["+ strnpcinfo(1) +"]";
  793.                             if ( getstrlen(.@tmp$) > 60 ) {
  794.                                 mes "Mission name must not more than 60 characters";
  795.                                 next;
  796.                                 break;
  797.                             }
  798.                             else if ( compare ( .@tmp$, ":" ) || compare ( .@tmp$, "^" ) ) {
  799.                                 mes "Mission name must not allow to use these symbols";
  800.                                 mes "-> : <- colon";
  801.                                 mes "-> ^ <- caret";
  802.                                 next;
  803.                                 break;
  804.                             }
  805.                             mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  806.                             mes "Description: "+( ( @tmp_ms_b_m_$[1] != "" )?"^0000FF"+ @tmp_ms_b_m_$[1]:"^FF0000Incomplete" )+"^000000";
  807.                             mes " ";
  808.                             mes "Are you sure to change the name to";
  809.                             mes "^0000FF"+ .@tmp$ +"^000000";
  810.                             next;
  811.                             if ( select ( "Yes", "No" ) == 2 ) break;
  812.                             set @tmp_ms_b_m_$[0], .@tmp$;
  813.                             break;
  814.                         case 2:
  815.                             mes "["+ strnpcinfo(1) +"]";
  816.                             mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  817.                             mes "Description: "+( ( @tmp_ms_b_m_$[1] != "" )?"^0000FF"+ @tmp_ms_b_m_$[1]:"^FF0000Incomplete" )+"^000000";
  818.                             mes " ";
  819.                             mes "Input the descriptions";
  820.                             next;
  821.                             set .@tmp1$, "";
  822.                             set .@tmp2$, "";
  823.                             set .@tmp3$, "";
  824.                             set .@tmp, 0;
  825.                             do {
  826.                                 set .@tmp, .@tmp +1 ;
  827.                                 input getd(".@tmp"+ .@tmp +"$");
  828.                             } while ( getstrlen( getd(".@tmp"+ .@tmp +"$") ) > 50 && .@tmp < 3 );
  829.                             mes "["+ strnpcinfo(1) +"]";
  830.                             mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  831.                             mes "Description: "+( ( @tmp_ms_b_m_$[1] != "" )?"^0000FF"+ @tmp_ms_b_m_$[1]:"^FF0000Incomplete" )+"^000000";
  832.                             mes " ";
  833.                             mes "Are you sure to change description to";
  834.                             mes "^0000FF"+ .@tmp1$ + .@tmp2$ + .@tmp3$ +"^000000";
  835.                             next;
  836.                             if ( select ( "Yes", "No" ) == 2 ) break;
  837.                             set @tmp_ms_b_m_$[1], .@tmp1$ + .@tmp2$ + .@tmp3$;
  838.                             break;
  839.                         case 3:
  840.                             if ( getarg(0) ) {
  841.                                 mes "["+ strnpcinfo(1) +"]";
  842.                                 mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  843.                                 mes " ";
  844.                                 mes "Require Mobs are not allow to edit";
  845.                                 next;
  846.                                 break;
  847.                             }
  848.                             while (1) {
  849.                                 mes "["+ strnpcinfo(1) +"]";
  850.                                 mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  851.                                 mes " ";
  852.                                 if ( @tmp_ms_b_t_ == 0 )
  853.                                     mes "Require mobs :";
  854.                                 set .@size, getarraysize(@tmp_ms_b_t_);
  855.                                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  856.                                     mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  857.                                 next;
  858.                                 set .@mobmenu, select ( "Add a monster requirement", "Remove a monster requirement", "- back" );
  859.                                 switch ( .@mobmenu ) {
  860.                                     case 1:
  861.                                         mes "["+ strnpcinfo(1) +"]";
  862.                                         mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  863.                                         mes " ";
  864.                                         if ( @tmp_ms_b_t_ == 0 )
  865.                                             mes "Require mobs :";
  866.                                         set .@size, getarraysize(@tmp_ms_b_t_);
  867.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  868.                                             mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  869.                                         mes " ";
  870.                                         if ( .@size == 16 ) {
  871.                                             mes "Require mobs are only allow up to 8 different kinds";
  872.                                             next;
  873.                                             break;
  874.                                         }
  875.                                         mes "Input monster ID";
  876.                                         next;
  877.                                         input .@tmp, 0, 9999;
  878.                                         mes "["+ strnpcinfo(1) +"]";
  879.                                         if ( .@tmp == 0 ) {
  880.                                             mes "Invalid monster ID";
  881.                                             next;
  882.                                             break;
  883.                                         }
  884.                                         else if ( getmonsterinfo(.@tmp, 1) == -1 ) {
  885.                                             mes "Invalid monster ID";
  886.                                             next;
  887.                                             break;
  888.                                         }
  889.                                         if ( @tmp_ms_b_t_ == 0 )
  890.                                             mes "Require mobs :";
  891.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  892.                                             mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  893.                                         mes " ";
  894.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  895.                                             if ( .@tmp == @tmp_ms_b_t_[.@i] ) break;
  896.                                         }
  897.                                         if ( .@i != .@size ) {
  898.                                             mes "Monster ^0000FF"+ getmonsterinfo(.@tmp, 0) +"^000000 is Repeated";
  899.                                             next;
  900.                                             break;
  901.                                         }
  902.                                         mes "Require mobs : ^0000FF"+ getmonsterinfo(.@tmp, 0) +"^000000";
  903.                                         mes "Input an amount need to be hunt";
  904.                                         next;
  905.                                         input .@tmp2, 0, 999;
  906.                                         if ( .@tmp2 == 0 ) {
  907.                                             mes "["+ strnpcinfo(1) +"]";
  908.                                             mes "Invalid amount";
  909.                                             next;
  910.                                         }
  911.                                         else
  912.                                             setarray @tmp_ms_b_t_[ .@size ], .@tmp, .@tmp2;
  913.                                         break;
  914.                                     case 2:
  915.                                         mes "["+ strnpcinfo(1) +"]";
  916.                                         mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  917.                                         mes " ";
  918.                                         if ( @tmp_ms_b_t_ == 0 ) {
  919.                                             mes "There are no monster to remove";
  920.                                             next;
  921.                                             break;
  922.                                         }
  923.                                         set .@size, getarraysize(@tmp_ms_b_t_);
  924.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  925.                                             mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  926.                                         mes " ";
  927.                                         mes "Select a mob to delete";
  928.                                         next;
  929.                                         set .@menu$, "^0000FF"+ @tmp_ms_b_t_[1] +" "+ getmonsterinfo(@tmp_ms_b_t_, 0);
  930.                                         for ( set .@i, 2; .@i < .@size; set .@i, .@i +2 )
  931.                                             set .@menu$, .@menu$ +":"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0);
  932.                                         set .@menu$, .@menu$ +"^000000:- back";
  933.                                         set .@menu, select(.@menu$) -1;
  934.                                         if ( .@menu == .@size /2 ) break;
  935.                                         deletearray @tmp_ms_b_t_[ .@menu *2 ], 2;
  936.                                     case 3:
  937.                                 }
  938.                                 if ( .@mobmenu == 3 ) break;
  939.                             }
  940.                             break;
  941.                         case 4:
  942.                             while (1) {
  943.                                 mes "["+ strnpcinfo(1) +"]";
  944.                                 mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  945.                                 mes " ";
  946.                                 if ( @tmp_ms_b_ir_ == 0 )
  947.                                     mes "Require items :";
  948.                                 set .@size, getarraysize(@tmp_ms_b_ir_);
  949.                                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  950.                                     mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  951.                                 next;
  952.                                 set .@item_require_menu, select ( "add item requirement", "remove a require item", "- back" );
  953.                                 switch ( .@item_require_menu ) {
  954.                                     case 1:
  955.                                         mes "["+ strnpcinfo(1) +"]";
  956.                                         mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  957.                                         mes " ";
  958.                                         if ( @tmp_ms_b_ir_ == 0 )
  959.                                             mes "Require items : ";
  960.                                         set .@size, getarraysize(@tmp_ms_b_ir_);
  961.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  962.                                             mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  963.                                         mes " ";
  964.                                         if ( .@size == 10 ) {
  965.                                             mes "Require items are only allow up to 5 different kinds";
  966.                                             next;
  967.                                             break;
  968.                                         }
  969.                                         mes "Input item ID";
  970.                                         next;
  971.                                         input .@tmp, 0, 32767;
  972.                                         mes "["+ strnpcinfo(1) +"]";
  973.                                         if ( getitemname(.@tmp) == "null" ) {
  974.                                             mes "Invalid item ID";
  975.                                             next;
  976.                                             break;
  977.                                         }
  978.                                         mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  979.                                         mes " ";
  980.                                         if ( @tmp_ms_b_ir_ == 0 )
  981.                                             mes "Require items : ";
  982.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  983.                                             mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  984.                                         mes " ";
  985.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  986.                                             if ( .@tmp == @tmp_ms_b_ir_[.@i] ) break;
  987.                                         }
  988.                                         if ( .@i != .@size ) {
  989.                                             mes "Item ^0000FF"+ getitemname(.@tmp) +"^000000 is repeated";
  990.                                             next;
  991.                                             break;
  992.                                         }
  993.                                         mes "Require items : ^0000FF"+ getitemname(.@tmp) +"^000000";
  994.                                         mes "input the amount required for this item";
  995.                                         next;
  996.                                         input .@tmp2, 0, 30000;
  997.                                         if ( .@tmp2 == 0 ) {
  998.                                             mes "["+ strnpcinfo(1) +"]";
  999.                                             mes "Invalid amount";
  1000.                                             next;
  1001.                                         }
  1002.                                         else
  1003.                                             setarray @tmp_ms_b_ir_[ .@size ], .@tmp, .@tmp2;
  1004.                                         break;
  1005.                                     case 2:
  1006.                                         mes "["+ strnpcinfo(1) +"]";
  1007.                                         mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1008.                                         mes " ";
  1009.                                         if ( @tmp_ms_b_ir_ == 0 ) {
  1010.                                             mes "There are no item to be remove";
  1011.                                             next;
  1012.                                             break;
  1013.                                         }
  1014.                                         set .@size, getarraysize(@tmp_ms_b_ir_);
  1015.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1016.                                             mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  1017.                                         mes " ";
  1018.                                         mes "Select an item to delete";
  1019.                                         next;
  1020.                                         set .@menu$, "^0000FF"+ @tmp_ms_b_ir_[1] +" "+ getitemname(@tmp_ms_b_ir_);
  1021.                                         for ( set .@i, 2; .@i < .@size; set .@i, .@i +2 )
  1022.                                             set .@menu$, .@menu$ +":"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]);
  1023.                                         set .@menu$, .@menu$ +"^000000:- back";
  1024.                                         set .@menu, select(.@menu$) -1;
  1025.                                         if ( .@menu == .@size /2 ) break;
  1026.                                         deletearray @tmp_ms_b_ir_[ .@menu *2 ], 2;
  1027.                                     case 3:
  1028.                                 }
  1029.                                 if ( .@item_require_menu == 3 ) break;
  1030.                             }
  1031.                         case 5:
  1032.                     }
  1033.                     if ( .@importantmenu == 5 ) break;
  1034.                 }
  1035.                 break;
  1036.             case 2:
  1037.                 while (1) {
  1038.                     mes "["+ strnpcinfo(1) +"]";
  1039.                     mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1040.                     mes " ";
  1041.                     mes "[^FF0000Limitations^000000]";
  1042.                     mes "Can do : "+( ( @tmp_ms_b_m_[6] == 0 )?"^0000FFRepeatedly": ( @tmp_ms_b_m_[6] == 1 )?"^00CC00Everyday":"^FF0000Only Once" )+"^000000";
  1043.                     mes "Base Level :"+( ( @tmp_ms_b_m_[3] )?"  ^0000FF"+ @tmp_ms_b_m_[3] +( ( @tmp_ms_b_m_[3] != @tmp_ms_b_m_[4] )?"~"+ @tmp_ms_b_m_[4]:"" )+"^000000":"" );
  1044.                     mes "Time Limit : "+( ( @tmp_ms_b_m_[5] )?"^FF0000"+( ( @tmp_ms_b_m_[5] /60 )?@tmp_ms_b_m_[5] /60 +" hour"+( ( @tmp_ms_b_m_[5] %60 )?" ":"" ):"" )+( ( @tmp_ms_b_m_[5] %60 )?@tmp_ms_b_m_[5] %60 +" min":"" )+"^000000":"" );
  1045.                     if ( @tmp_ms_b_m_[2] == 0 )
  1046.                         mes "Job Limit : ^FF0000<none>^000000";
  1047.                     else {
  1048.                         deletearray .@joblimit;
  1049.                         for ( set .@i, 0; .@i < 24; set .@i, .@i +1 ) {
  1050.                             if ( @tmp_ms_b_m_[2] & pow( 2, .@i ) ) {
  1051.                                 set .@joblimit[ getarraysize(.@joblimit) ], .@i +1;
  1052.                             }
  1053.                         }
  1054.                         set .@joblimit$, .jobname$[ .@joblimit[0] -1 ];
  1055.                         set .@size, getarraysize(.@joblimit);
  1056.                         for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  1057.                             set .@joblimit$, .@joblimit$ +", "+ .jobname$[ .@joblimit[.@i] -1 ];
  1058.                         mes "Job Limit : ^00CC00"+ .@joblimit$ +"^000000";
  1059.                     }
  1060.                     next;
  1061.                     set .@limitmenu, select ( "Mission Status (Can do)", "Base Level", "Time Limit", "Job limitation", "- back" );
  1062.                     switch ( .@limitmenu ) {
  1063.                         case 1:
  1064.                             mes "["+ strnpcinfo(1) +"]";
  1065.                             mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1066.                             mes " ";
  1067.                             mes "Can do : "+( ( @tmp_ms_b_m_[6] == 0 )?"^0000FFRepeatedly": ( @tmp_ms_b_m_[6] == 1 )?"^00CC00Everyday":"^FF0000Only Once" )+"^000000";
  1068.                             mes "Please select a status";
  1069.                             next;
  1070.                             switch ( select ( "^0000FFRepeatedly^000000", "^00CC00Everyday^000000", "^FF0000Only Once^000000" ) ) {
  1071.                                 case 1: set @tmp_ms_b_m_[6], 0; break;
  1072.                                 case 2: set @tmp_ms_b_m_[6], 1; break;
  1073.                                 case 3: set @tmp_ms_b_m_[6], 2;
  1074.                             }
  1075.                             break;
  1076.                         case 2:
  1077.                             mes "["+ strnpcinfo(1) +"]";
  1078.                             mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1079.                             mes " ";
  1080.                             mes "Base Level :";
  1081.                             mes " ";
  1082.                             mes "Input starting range";
  1083.                             next;
  1084.                             input .@tmp, 0, 1000;
  1085.                             if ( .@tmp == 0 ) {
  1086.                                 mes "["+ strnpcinfo(1) +"]";
  1087.                                 mes "invalid value";
  1088.                                 set @tmp_ms_b_m_[3], 0;
  1089.                                 set @tmp_ms_b_m_[4], 0;
  1090.                                 next;
  1091.                                 break;
  1092.                             }
  1093.                             mes "["+ strnpcinfo(1) +"]";
  1094.                             mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1095.                             mes " ";
  1096.                             mes "Base Level : ^0000FF"+ .@tmp +"~^000000";
  1097.                             mes " ";
  1098.                             mes "Input ending range";
  1099.                             next;
  1100.                             input .@tmp2, 0, 1000;
  1101.                             if ( .@tmp2 == 0 ) {
  1102.                                 mes "["+ strnpcinfo(1) +"]";
  1103.                                 mes "invalid value";
  1104.                                 set @tmp_ms_b_m_[3], 0;
  1105.                                 set @tmp_ms_b_m_[4], 0;
  1106.                                 next;
  1107.                                 break;
  1108.                             }
  1109.                             else if ( .@tmp > .@tmp2 ) {
  1110.                                 mes "["+ strnpcinfo(1) +"]";
  1111.                                 mes "Ending range cannot higher than starting range";
  1112.                                 next;
  1113.                                 break;
  1114.                             }
  1115.                             else
  1116.                                 setarray @tmp_ms_b_m_[3], .@tmp, .@tmp2;
  1117.                             break;
  1118.                         case 3:
  1119.                             mes "["+ strnpcinfo(1) +"]";
  1120.                             mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1121.                             mes " ";
  1122.                             mes "Time Limit : "+( ( @tmp_ms_b_m_[5] )?"^FF0000"+( ( @tmp_ms_b_m_[5] /60 )?@tmp_ms_b_m_[5] /60 +" hour"+( ( @tmp_ms_b_m_[5] %60 )?" ":"" ):"" )+( ( @tmp_ms_b_m_[5] %60 )?@tmp_ms_b_m_[5] %60 +" min":"" )+"^000000":"" );
  1123.                             mes "      1 = 1 minute";
  1124.                             mes "    60 = 1 hour";
  1125.                             mes "1440 = 1 day";
  1126.                             next;
  1127.                             input @tmp_ms_b_m_[5], 0, 1440;
  1128.                             break;
  1129.                         case 4:
  1130.                             while (1) {
  1131.                                 mes "["+ strnpcinfo(1) +"]";
  1132.                                 mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1133.                                 mes " ";
  1134.                                 if ( @tmp_ms_b_m_[2] == 0 )
  1135.                                     mes "Job Limit : ^FF0000<none>^000000";
  1136.                                 else {
  1137.                                     deletearray .@joblimit;
  1138.                                     for ( set .@i, 0; .@i < 24; set .@i, .@i +1 ) {
  1139.                                         if ( @tmp_ms_b_m_[2] & pow( 2, .@i ) ) {
  1140.                                             set .@joblimit[ getarraysize(.@joblimit) ], .@i +1;
  1141.                                         }
  1142.                                     }
  1143.                                     set .@joblimit$, .jobname$[ .@joblimit[0] -1 ];
  1144.                                     set .@size, getarraysize(.@joblimit);
  1145.                                     for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  1146.                                         set .@joblimit$, .@joblimit$ +", "+ .jobname$[ .@joblimit[.@i] -1 ];
  1147.                                     mes "Job Limit : ^00CC00"+ .@joblimit$ +"^000000";
  1148.                                 }
  1149.                                 next;
  1150.                                 set .@menu$, ( ( @tmp_ms_b_m_[2] & pow( 2, 0 ) )?"^00CC00":"^FF0000" )+ .jobname$;
  1151.                                 for ( set .@i, 1; .@i < 24; set .@i,.@i +1 )
  1152.                                     set .@menu$, .@menu$ +":"+( ( @tmp_ms_b_m_[2] & pow( 2, .@i ) )?"^00CC00":"^FF0000" )+ .jobname$[.@i];
  1153.                                 set .@menu$, .@menu$ +":^000000- back";
  1154.                                 set .@menu, select(.@menu$) -1;
  1155.                                 if ( .@menu == 24 ) break;
  1156.                                 set @tmp_ms_b_m_[2], @tmp_ms_b_m_[2] ^ pow( 2, .@menu );
  1157.                             }
  1158.                             break;
  1159.                         case 5:
  1160.                     }
  1161.                     if ( .@limitmenu == 5 ) break;
  1162.                 }
  1163.                 break;
  1164.             case 3:
  1165.                 while (1) {
  1166.                     mes "["+ strnpcinfo(1) +"]";
  1167.                     mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1168.                     mes " ";
  1169.                     mes "[^009900Rewards^000000]";
  1170.                     mes "Base Exp : "+( ( @tmp_ms_b_m_[7] )?"^0000FF"+ callfunc("int__", @tmp_ms_b_m_[7] ):"^FF00000" ) +"^000000";
  1171.                     mes "Job Exp : "+( ( @tmp_ms_b_m_[8] )?"^0000FF"+ callfunc("int__", @tmp_ms_b_m_[8] ):"^FF00000" ) +"^000000";
  1172.                     mes "Zeny : "+( ( @tmp_ms_b_m_[9] )?"^0000FF"+ callfunc("int__", @tmp_ms_b_m_[9] ):"^FF00000" ) +"^000000 ";
  1173.                     mes "Cash Point : "+( ( @tmp_ms_b_m_[10] )?"^0000FF"+ callfunc("int__", @tmp_ms_b_m_[10] ):"^FF00000" ) +"^000000";
  1174.                     if ( @tmp_ms_b_ia_ == 0 )
  1175.                         mes "Item : ";
  1176.                     set .@size, getarraysize(@tmp_ms_b_ia_);
  1177.                     for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1178.                         mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1179.                     next;
  1180.                     set .@rewardmenu, select ( "Base Exp", "Job Exp", "Zeny", "Cash Points", "Item Rewards", "- back" );
  1181.                     switch ( .@rewardmenu ) {
  1182.                         case 1:
  1183.                             input @tmp_ms_b_m_[7], 0, 2000000000;
  1184.                             break;
  1185.                         case 2:
  1186.                             input @tmp_ms_b_m_[8], 0, 2000000000;
  1187.                             break;
  1188.                         case 3:
  1189.                             input @tmp_ms_b_m_[9], 0, 2000000000;
  1190.                             break;
  1191.                         case 4:
  1192.                             input @tmp_ms_b_m_[10], 0, 2000000000;
  1193.                             break;
  1194.                         case 5:
  1195.                             while (1) {
  1196.                                 mes "["+ strnpcinfo(1) +"]";
  1197.                                 mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1198.                                 mes " ";
  1199.                                 if ( @tmp_ms_b_ia_ == 0 )
  1200.                                     mes "Item :";
  1201.                                 set .@size, getarraysize(@tmp_ms_b_ia_);
  1202.                                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1203.                                     mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1204.                                 next;
  1205.                                 set .@item_reward_menu, select ( "Add an item reward", "Remove an item reward", "- back" );
  1206.                                 switch ( .@item_reward_menu ) {
  1207.                                     case 1:
  1208.                                         mes "["+ strnpcinfo(1) +"]";
  1209.                                         mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1210.                                         mes " ";
  1211.                                         if ( @tmp_ms_b_ia_ == 0 )
  1212.                                             mes "Item : ";
  1213.                                         set .@size, getarraysize(@tmp_ms_b_ia_);
  1214.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1215.                                             mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1216.                                         mes " ";
  1217.                                         if ( .@size == 10 ) {
  1218.                                             mes "Items Rewards are only allow up to 5 different kinds";
  1219.                                             next;
  1220.                                             break;
  1221.                                         }
  1222.                                         mes "Input item id";
  1223.                                         next;
  1224.                                         input .@tmp, 0, 32767;
  1225.                                         mes "["+ strnpcinfo(1) +"]";
  1226.                                         if ( getitemname(.@tmp) == "null" ) {
  1227.                                             mes "Invalid item id";
  1228.                                             next;
  1229.                                             break;
  1230.                                         }
  1231.                                         mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1232.                                         mes " ";
  1233.                                         if ( @tmp_ms_b_ia_ == 0 )
  1234.                                             mes "Item : ";
  1235.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1236.                                             mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1237.                                         mes " ";
  1238.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  1239.                                             if ( .@tmp == @tmp_ms_b_ia_[.@i] ) break;
  1240.                                         }
  1241.                                         if ( .@i != .@size ) {
  1242.                                             mes "Item ^0000FF"+ getitemname(.@tmp) +"^000000 is repeated";
  1243.                                             next;
  1244.                                             break;
  1245.                                         }
  1246.                                         mes "Item : ^0000FF"+ getitemname(.@tmp) +"^000000";
  1247.                                         mes "Input the amount rewards for this item";
  1248.                                         next;
  1249.                                         input .@tmp2, 0, 30000;
  1250.                                         if ( .@tmp2 == 0 ) {
  1251.                                             mes "["+ strnpcinfo(1) +"]";
  1252.                                             mes "Invalid amount";
  1253.                                             next;
  1254.                                         }
  1255.                                         else
  1256.                                             setarray @tmp_ms_b_ia_[ .@size ], .@tmp, .@tmp2;
  1257.                                         break;
  1258.                                     case 2:
  1259.                                         mes "["+ strnpcinfo(1) +"]";
  1260.                                         mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1261.                                         mes " ";
  1262.                                         if ( @tmp_ms_b_ia_ == 0 ) {
  1263.                                             mes "There is no item rewards to remove";
  1264.                                             next;
  1265.                                             break;
  1266.                                         }
  1267.                                         set .@size, getarraysize(@tmp_ms_b_ia_);
  1268.                                         for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1269.                                             mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1270.                                         mes " ";
  1271.                                         mes "Select an item rewards to delete";
  1272.                                         next;
  1273.                                         set .@menu$, "^0000FF"+ @tmp_ms_b_ia_[1] +" "+ getitemname(@tmp_ms_b_ia_);
  1274.                                         for ( set .@i, 2; .@i < .@size; set .@i, .@i +2 )
  1275.                                             set .@menu$, .@menu$ +":"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]);
  1276.                                         set .@menu$, .@menu$ +"^000000:- back";
  1277.                                         set .@menu, select(.@menu$) -1;
  1278.                                         if ( .@menu == .@size /2 ) break;
  1279.                                         deletearray @tmp_ms_b_ia_[ .@menu *2 ], 2;
  1280.                                     case 3:
  1281.                                 }
  1282.                                 if ( .@item_reward_menu == 3 ) break;
  1283.                             }
  1284.                         case 6:
  1285.                     }
  1286.                     if ( .@rewardmenu == 6 ) break;
  1287.                 }
  1288.                 break;
  1289.             case 4:
  1290.                 mes "["+ strnpcinfo(1) +"]";
  1291.                 if ( @tmp_ms_b_m_$[0] != "" && @tmp_ms_b_m_$[1] != "" && ( @tmp_ms_b_t_ || @tmp_ms_b_ir_ ) &&
  1292.                     ( @tmp_ms_b_m_[7] || @tmp_ms_b_m_[8] || @tmp_ms_b_m_[9] || @tmp_ms_b_m_[10] || @tmp_ms_b_ia_ ) ) {
  1293.                     mes "mission ID: ^996600"+( ( getarg(0) == 0 )?$ms_b_id +1:@m_id )+"^000000";
  1294.                     mes "Name : ^0000FF"+ @tmp_ms_b_m_$[0] +"^000000";
  1295.                 }
  1296.                 else {
  1297.                     mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1298.                     mes " ";
  1299.                     mes "Some field are still Incomplete !";
  1300.                     next;
  1301.                     break;
  1302.                 }
  1303.                 mes "Description: ^0000FF"+ @tmp_ms_b_m_$[1] +"^000000";
  1304.                 mes " ";
  1305.                 set .@size, getarraysize(@tmp_ms_b_t_);
  1306.                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1307.                     mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  1308.                 set .@size, getarraysize(@tmp_ms_b_ir_);
  1309.                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1310.                     mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  1311.                     mes " ";
  1312.                 if ( @tmp_ms_b_m_[6] || @tmp_ms_b_m_[3] || @tmp_ms_b_m_[5] || @tmp_ms_b_m_[2] ) {
  1313.                     mes "[^FF0000Limitations^000000]";
  1314.                     if ( @tmp_ms_b_m_[6] )
  1315.                         mes "Can do : "+( ( @tmp_ms_b_m_[6] == 1 )?"^00CC00Everyday":"^FF0000Only Once" )+"^000000";
  1316.                     if ( @tmp_ms_b_m_[3] )
  1317.                         mes "Base Level :"+( ( @tmp_ms_b_m_[3] )?"  ^0000FF"+ @tmp_ms_b_m_[3] +( ( @tmp_ms_b_m_[3] != @tmp_ms_b_m_[4] )?"~"+ @tmp_ms_b_m_[4]:"" )+"^000000":"" );
  1318.                     if ( @tmp_ms_b_m_[5] )
  1319.                         mes "Time Limit : ^FF0000"+( ( @tmp_ms_b_m_[5] /60 )?@tmp_ms_b_m_[5] /60 +" hour"+( ( @tmp_ms_b_m_[5] %60 )?" ":"" ):"" )+( ( @tmp_ms_b_m_[5] %60 )?@tmp_ms_b_m_[5] %60 +" min":"" )+"^000000";
  1320.                     if ( @tmp_ms_b_m_[2] ) {
  1321.                         deletearray .@joblimit;
  1322.                         for ( set .@i, 0; .@i < 24; set .@i, .@i +1 ) {
  1323.                             if ( @tmp_ms_b_m_[2] & pow( 2, .@i ) ) {
  1324.                                 set .@joblimit[ getarraysize(.@joblimit) ], .@i +1;
  1325.                             }
  1326.                         }
  1327.                         set .@joblimit$, .jobname$[ .@joblimit[0] -1 ];
  1328.                         set .@size, getarraysize(.@joblimit);
  1329.                         for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  1330.                             set .@joblimit$, .@joblimit$ +", "+ .jobname$[ .@joblimit[.@i] -1 ];
  1331.                         mes "Job Limit : ^00CC00"+ .@joblimit$ +"^000000";
  1332.                     }
  1333.                     mes " ";
  1334.                 }
  1335.                 mes "[^009900Rewards^000000]";
  1336.                 if ( @tmp_ms_b_m_[7] )
  1337.                     mes "Base Exp : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[7] ) +"^000000";
  1338.                 if ( @tmp_ms_b_m_[8] )
  1339.                     mes "Job Exp : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[8] ) +"^000000";
  1340.                 if ( @tmp_ms_b_m_[9] )
  1341.                     mes "Zeny : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[9] ) +"^000000";
  1342.                 if ( @tmp_ms_b_m_[10] )
  1343.                     mes "Cash Point : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[10] ) +"^000000";
  1344.                 set .@size, getarraysize(@tmp_ms_b_ia_);
  1345.                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1346.                     mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1347.                 return 1;
  1348.             case 5:
  1349.                 return 0;
  1350.         }
  1351.     }
  1352.     end;
  1353. OnInit:
  1354.     set .loading, 1;
  1355.     set .total_npc, .total_npc +1 ;
  1356.     if ( atoi( strnpcinfo(2) ) <= 0 || atoi( strnpcinfo(2) ) > 127 ) {
  1357.         debugmes "Mission Board: invalid npc id #"+ strnpcinfo(2);
  1358.         goto L_load_finish;
  1359.     }
  1360.     else if ( .ms_b_name$[ atoi( strnpcinfo(2) ) ] != "" ) {
  1361.         debugmes "Mission Board: duplicate npc id #"+ strnpcinfo(2);
  1362.         set .duplicate_id[ getarraysize(.duplicate_id) ], atoi( strnpcinfo(2) );
  1363.         goto L_load_finish;
  1364.     }
  1365.     set .ms_b_name$[ atoi( strnpcinfo(2) ) ], strnpcinfo(1);
  1366.     explode .@ms_b_n_$, getd("$ms_b_n_"+ strnpcinfo(2) +"$"), "#";
  1367.     set .@ex_size, getarraysize(.@ms_b_n_$);
  1368.     set .@i, 0;
  1369.     while ( .@i < .@ex_size ) {
  1370.         setd ".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]", atoi( .@ms_b_n_$[.@i] );
  1371.         set .@i, .@i +1 ;
  1372.     }
  1373.     set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) );
  1374.     while ( .@id < .@size ) {
  1375.         set .@m_id, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@id +"]");
  1376.         explode .@ms_b_m_$[2], getd("$ms_b_m_"+ .@m_id +"$[2]"), "#";
  1377.         set .@ex_size, getarraysize(.@ms_b_m_$);
  1378.         set .@i, 0;
  1379.         while ( .@i < .@ex_size ) {
  1380.             setd ".ms_b_m_"+ .@m_id +"["+ .@i +"]", atoi( .@ms_b_m_$[.@i] );
  1381.             set .@i, .@i +1 ;
  1382.         }
  1383.         explode .@ms_b_t_$, getd("$ms_b_m_"+ .@m_id +"$[3]"), "#";
  1384.         set .@ex_size, getarraysize(.@ms_b_t_$);
  1385.         set .@i, 0;
  1386.         while ( .@i < .@ex_size ) {
  1387.             setd ".ms_b_t_"+ .@m_id +"["+ .@i +"]", atoi( .@ms_b_t_$[.@i] );
  1388.             set .@i, .@i +1 ;
  1389.         }        
  1390.         copyarray getd(".ms_b_ir_"+ .@m_id), getd(".ms_b_t_"+ .@m_id +"[16]"), 10;
  1391.         copyarray getd(".ms_b_ia_"+ .@m_id), getd(".ms_b_t_"+ .@m_id +"[26]"), 10;
  1392.         deletearray getd(".ms_b_t_"+ .@m_id +"[16]"), 20;
  1393.         set .@id, .@id +1 ;
  1394.         sleep 1;
  1395.     }
  1396. L_load_finish:
  1397.     set .finish, .finish +1;
  1398.     if ( .finish == .total_npc ) {
  1399.         set .finish, 0;
  1400.         set .total_npc, 0;
  1401.         set .loading, 0;
  1402.         setarray .jobname$,    "(Super) Novice","Swordman","Mage","Archer","Acolyte","Merchant","Thief","Knight","Priest","Wizard","Blacksmith","Hunter","Assassin","Crusader","Monk","Sage","Rogue","Alchemist","Bard/Dancer","Taekwon","Star Gladiator","Soul Linker","Gunslinger","Ninja";
  1403.     }
  1404.     end;
  1405. }
  1406.  
  1407. -    script    mission    -1,{
  1408. OnWhisperGlobal:
  1409.     if ( getvariableofnpc( .loading, "ms_b_") == 1 ) {
  1410.         dispbottom "Mission Board: Loading Mission Data ......";
  1411.         end;
  1412.     }
  1413.     if ( @ms_b_loading == 1 ) {
  1414.         dispbottom "Mission Board: Loading Player Data ......";
  1415.         end;
  1416.     }
  1417.     for ( set .@i, 1; .@i <= 4; set .@i, .@i +1 ) {
  1418.         if ( getd("@ms_b_m_"+ .@i) ) {
  1419.             if ( getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@i +"[0]") +"$[0]") == "" ) {
  1420.                 dispbottom "Mission Board: Your Mission#"+ .@i +" has deleted because it is no longer available";
  1421.                 deletearray getd("@ms_b_m_"+ .@i);
  1422.                 setd "ms_b_m_"+ .@i +"$", "";
  1423.                 deltimer "ms_b_::OnQuest"+ .@i +"TimeUp";
  1424.             }
  1425.             else if ( getd("@ms_b_m_"+ .@i +"[1]") && getd("@ms_b_m_"+ .@i +"[1]") <= gettimetick(2) ) {
  1426.                 dispbottom "Mission #1: "+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@i +"[0]") +"$[0]") +" has Time Up";
  1427.                 deletearray getd("@ms_b_m_"+ .@i);
  1428.                 setd "ms_b_m_"+ .@i +"$", "";
  1429.                 deltimer "ms_b_::OnQuest"+ .@i +"TimeUp";
  1430.             }
  1431.         }
  1432.     }
  1433.     dispbottom "[Mission Progress]";
  1434.     if ( @ms_b_m_1 == 0 && @ms_b_m_2 == 0 && @ms_b_m_3 == 0 && @ms_b_m_4 == 0 ) {
  1435.         dispbottom "You haven't accepted any mission(s) yet!";
  1436.         end;
  1437.     }
  1438.     for ( set .@j, 1; .@j <= 4; set .@j, .@j +1 ) {
  1439.         if ( getd("@ms_b_m_"+ .@j +"[0]") ) {
  1440.             dispbottom "-----------------------";
  1441.             dispbottom "Mission #"+ .@j +":  "+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@j +"[0]") +"$[0]");
  1442.             if ( getvariableofnpc( getd(".ms_b_m_"+ getd("@ms_b_m_"+ .@j +"[0]") +"[5]"), "ms_b_" ) ) {
  1443.                 set .@left, getd("@ms_b_m_"+ .@j +"[1]") - gettimetick(2);
  1444.                 set .@hour, .@left / 3600;
  1445.                 set .@min, .@left % 3600 / 60;
  1446.                 set .@sec, .@left % 60;
  1447.                 dispbottom "Time Left:  "+( ( .@hour )?.@hour +" hour ":"" )+( ( .@hour || .@min )?.@min +" min ":"" )+ .@sec +" sec";
  1448.             }
  1449.             if ( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) ) {
  1450.  
  1451.                 set .@size, getarraysize( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) );
  1452.                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1453.                     dispbottom "Monsters killed: "+ getmonsterinfo( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ) , 0) +" ["+( ( getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") > getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ (.@i +1) +"]"), "ms_b_" ) )?getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ (.@i +1) +"]"), "ms_b_" ):getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") ) +"/"+ getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ (.@i +1) +"]"), "ms_b_" ) +"]";
  1454.             }
  1455.             if ( getvariableofnpc( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) ) {
  1456.                 set .@size, getarraysize( getvariableofnpc( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) );
  1457.                 for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1458.                     dispbottom "Items Collected: "+ getitemname( getvariableofnpc( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ) ) +" ["+ countitem( getvariableofnpc( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ) ) +"/"+ getvariableofnpc( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ (.@i +1) +"]"), "ms_b_" ) +"]";
  1459.             }
  1460.         }
  1461.     }
  1462.     dispbottom "   -----------------------";
  1463.     end;
  1464. OnNPCKillEvent:
  1465.     set .@killedrid, killedrid;
  1466.     if ( getvariableofnpc( .loading, "ms_b_") == 1 ) end;
  1467.     if ( getcharid(1) == 0 ) {
  1468.         if ( @ms_b_loading == 1 ) end;
  1469.         for ( set .@j, 1; .@j <= 4; set .@j, .@j +1 ) {
  1470.             if ( getd("@ms_b_m_"+ .@j +"[0]") ) {
  1471.                 if ( getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@j +"[0]") +"$[0]") == "" ) {
  1472.                     dispbottom "Mission Board: Your Mission#"+ .@j +" has deleted because it is no longer available";
  1473.                     deletearray getd("@ms_b_m_"+ .@j);
  1474.                     setd "ms_b_m_"+ .@j +"$", "";
  1475.                     deltimer "ms_b_::OnQuest"+ .@j +"TimeUp";
  1476.                 }
  1477.                 else {
  1478.                     set .@size, getarraysize( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) );
  1479.                     for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  1480.                         if ( .@killedrid == getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ) && getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") < getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+( .@i +1 )+"]"), "ms_b_" ) ) {
  1481.                             setd "@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]", getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") +1;
  1482.                             dispbottom "Mission #"+ .@j +". You have killed "+ getmonsterinfo( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ), 0 ) +" ["+ getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") +"/"+ getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+( .@i +1 )+"]"), "ms_b_" ) +"]";
  1483.                             setd "ms_b_m_"+ .@j +"$", getd("@ms_b_m_"+ .@j +"[0]") +"#"+( ( getd("@ms_b_m_"+ .@j +"[1]") )?getd("@ms_b_m_"+ .@j +"[1]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[2]") )?getd("@ms_b_m_"+ .@j +"[2]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[3]") )?getd("@ms_b_m_"+ .@j +"[3]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[4]") )?getd("@ms_b_m_"+ .@j +"[4]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[5]") )?getd("@ms_b_m_"+ .@j +"[5]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[6]") )?getd("@ms_b_m_"+ .@j +"[6]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[7]") )?getd("@ms_b_m_"+ .@j +"[7]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[8]") )?getd("@ms_b_m_"+ .@j +"[8]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[9]") )?getd("@ms_b_m_"+ .@j +"[9]"):"" );
  1484.                         }
  1485.                     }
  1486.                 }
  1487.             }
  1488.         }
  1489.         end;
  1490.     }
  1491.     getmapxy .@map1$, .@x1, .@y1, 0;
  1492.     getpartymember getcharid(1), 1;
  1493.     getpartymember getcharid(1), 2;
  1494.     set .@k, 0;
  1495.     while ( .@k < $@partymembercount ) {
  1496.         if ( isloggedin( $@partymemberaid[.@k], $@partymembercid[.@k] ) ) {
  1497.             attachrid $@partymemberaid[.@k];
  1498.             getmapxy .@map2$, .@x2, .@y2, 0;
  1499.             if ( @ms_b_loading == 0 && .@map1$ == .@map2$ && distance(.@x1,.@y1,.@x2,.@y2) <= 30 ) {
  1500.                 set .@j, 1;
  1501.                 while ( .@j <= 4 ) {
  1502.                     if ( getd("@ms_b_m_"+ .@j +"[0]") ) {
  1503.                         if ( getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@j +"[0]") +"$[0]") == "" ) {
  1504.                             dispbottom "Mission Board: Your Mission#"+ .@j +" has deleted because it is no longer available";
  1505.                             deletearray getd("@ms_b_m_"+ .@j);
  1506.                             setd "ms_b_m_"+ .@j +"$", "";
  1507.                             deltimer "ms_b_::OnQuest"+ .@j +"TimeUp";
  1508.                         }
  1509.                         else {
  1510.                             set .@i, 0;
  1511.                             set .@size, getarraysize( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) );
  1512.                             while ( .@i < .@size ) {
  1513.                                 if ( .@killedrid == getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ) && getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") < getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+( .@i +1 )+"]"), "ms_b_" ) ) {
  1514.                                     setd "@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]", getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") +1;
  1515.                                     dispbottom "Mission #"+ .@j +". You have killed "+ getmonsterinfo( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ), 0 ) +" ["+ getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") +"/"+ getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+( .@i +1 )+"]"), "ms_b_" ) +"]";
  1516.                                     setd "ms_b_m_"+ .@j +"$", getd("@ms_b_m_"+ .@j +"[0]") +"#"+( ( getd("@ms_b_m_"+ .@j +"[1]") )?getd("@ms_b_m_"+ .@j +"[1]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[2]") )?getd("@ms_b_m_"+ .@j +"[2]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[3]") )?getd("@ms_b_m_"+ .@j +"[3]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[4]") )?getd("@ms_b_m_"+ .@j +"[4]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[5]") )?getd("@ms_b_m_"+ .@j +"[5]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[6]") )?getd("@ms_b_m_"+ .@j +"[6]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[7]") )?getd("@ms_b_m_"+ .@j +"[7]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[8]") )?getd("@ms_b_m_"+ .@j +"[8]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[9]") )?getd("@ms_b_m_"+ .@j +"[9]"):"" );
  1517.                                 }
  1518.                                 set .@i, .@i +2 ;
  1519.                             }
  1520.                         }
  1521.                     }
  1522.                     set .@j, .@j +1 ;
  1523.                 }
  1524.             }
  1525.         }
  1526.         set .@k, .@k +1 ;
  1527.     }
  1528.     end;
  1529. OnPCLoginEvent:
  1530.     set @ms_b_loading, 1;
  1531.     set .@j, 1;
  1532.     while ( .@j <= 4 ) {
  1533.         if ( getd("ms_b_m_"+ .@j +"$") != "" ) {
  1534.             explode getd(".@ms_b_m_"+ .@j +"$"), getd("ms_b_m_"+ .@j +"$"), "#";
  1535.             set .@ex_size, getarraysize( getd(".@ms_b_m_"+ .@j +"$") );
  1536.             set .@i, 0;
  1537.             while ( .@i < .@ex_size ) {
  1538.                 setd "@ms_b_m_"+ .@j +"["+ .@i +"]", atoi( getd(".@ms_b_m_"+ .@j +"$["+ .@i +"]") );
  1539.                 set .@i, .@i +1 ;
  1540.             }
  1541.         }
  1542.         set .@j, .@j +1 ;
  1543.     }
  1544.     sleep2 1;
  1545.     set .@l, 0;
  1546.     while ( .@npc_id < 128 ) {
  1547.         if ( getvariableofnpc( .ms_b_name$[.@npc_id], "ms_b_" ) != "" ) {
  1548.             explode getd(".@ms_b_n_"+ .@npc_id +"$"), getd("ms_b_n_"+ .@npc_id +"$"), "#";
  1549.             set .@ex_size, getarraysize( getd(".@ms_b_n_"+ .@npc_id +"$") );
  1550.             set .@i, 0;
  1551.             while ( .@i < .@ex_size ) {
  1552.                 setd "@ms_b_n_"+ .@npc_id +"["+ .@i +"]", atoi( getd(".@ms_b_n_"+ .@npc_id +"$["+ .@i +"]") );
  1553.                 set .@i, .@i +1 ;
  1554.             }
  1555.             sleep2 1;
  1556.         }
  1557.         set .@npc_id, .@npc_id +1 ;
  1558.     }
  1559.     sleep2 1;
  1560.     set @ms_b_loading, 0;
  1561.     if ( getvariableofnpc( .loading, "ms_b_" ) == 0 ) {
  1562.         set .@j, 1;
  1563.         while ( .@j <= 4 ) {
  1564.             if ( getd("@ms_b_m_"+ .@j +"[0]") ) {
  1565.                 if ( getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@j +"[0]") +"$[0]") == "" ) {
  1566.                     dispbottom "Mission Board: Your Mission#"+ .@j +" has deleted because it is no longer available";
  1567.                     deletearray getd("@ms_b_m_"+ .@j);
  1568.                     setd "ms_b_m_"+ .@j +"$", "";
  1569.                 }
  1570.                 else if ( getd("@ms_b_m_"+ .@j +"[1]") ) {
  1571.                     if ( getd("@ms_b_m_"+ .@j +"[1]") > gettimetick(2) )
  1572.                         addtimer ( getd("@ms_b_m_"+ .@j +"[1]") - gettimetick(2) ) *1000, "ms_b_::OnQuest"+ .@j +"TimeUp";
  1573.                     else
  1574.                         doevent "ms_b_::OnQuest"+ .@j +"TimeUp";
  1575.                 }
  1576.             }
  1577.             set .@j, .@j +1 ;
  1578.         }
  1579.     }
  1580.     end;
  1581. }
  1582.  
  1583. //    create more missions by using npc duplicates
  1584. //    display name can be anything, but the hidden name #1 #2 #35 must be a number within 1 ~ 126
  1585. //    Note: npc display name plus the hidden name must not more than 23 characters
  1586. prontera,158,188,5    duplicate(ms_b_)    Mission Board#3    837[/code]
Viewed 452 times, submitted by unknown.