pastebin - collaborative debugging tool
rathena.kpaste.net RSS


Character Manager
Posted by Anonymous on Sat 3rd Dec 2011 00:53
raw | new post

  1. //===== Bakamono's Script ====================================
  2. //= Character Manager
  3. //===== By: ==================================================
  4. //= Bake Mono
  5. //===== Current Version: =====================================
  6. //= 1.0
  7. //===== Description: =========================================
  8. //= Changes the positions of characters on the character
  9. //= selection screen. Can either move a character to an empty
  10. //= spot, or swap two characters at once for a Fee. The fee
  11. //= is defaulted to 250,000 zeny with coupons (7037) able to
  12. //= be used to avoid the fee.
  13. //===== Additional Comments: =================================
  14. //= 1.0
  15. //============================================================
  16.  
  17. prontera,161,193,4      script  Character Manager       899,{
  18.        
  19.         set .npcName$, "[^0000FFCharacter Manager^000000]";
  20.         set .charAmt, 9;
  21.         set .fee, 250000;
  22.  
  23.  
  24.         mes .npcName$;
  25.         mes "Welcome, how many I be of assistance to you today?";
  26.         next;
  27.         switch(prompt("Nevermind...","Switch character slots"))
  28.         {
  29.                 case 1:
  30.                         mes .npcName$;
  31.                         mes "Understood. If you ever need assistance managing your characters, I'll be here.";
  32.                         close;
  33.                 case 2:
  34.                         mes .npcName$;
  35.                         mes "I can help you change the way your characters are organized on the character selection screen. To do this, you must select 2 different characters, or a character and an empty spot, and they will be automatically moved.";
  36.                         next;
  37.                         mes .npcName$;
  38.                         mes "You may also move a single character into an empty slot, if you have any. My services don't come free though. It costs "+.fee+" Zeny each time you you use it.";
  39.                         next;
  40.                         mes .npcName$;
  41.                         mes "Do you want to use my service and re-arrange your characters?";
  42.                         next;
  43.                         switch(select("No thanks...","Sure!     "))
  44.                         {
  45.                                 case 1:
  46.                                         mes .npcName$;
  47.                                         mes "Understood. If you ever decide to change your mind, I'll be here.";
  48.                                         close;
  49.                                 case 2:
  50.                                         mes .npcName$;
  51.                                         mes "Go ahead and select the ^0000FFfirst^000000 character that you want to swap positions or an empty slot...";
  52.                                         next;
  53.                                         query_sql("SELECT char_num,name FROM `char` WHERE account_id="+getcharid(3)+" ORDER BY char_num ASC", @char_num, @name$);
  54.                                         callsub First;
  55.                         }
  56.         }
  57.        
  58.         GetList:
  59.                 set .result$, "Nevermind..."; // Start result variable for menu
  60.                
  61.                 for( set .@i, 0; .@i < .charAmt; set .@i, .@i +1 )
  62.                 {
  63.                         if(@char_num[.@i-.@offset]!=.@i)
  64.                         {
  65.                                 set .@offset, .@offset+1;
  66.                                 set .result$, .result$ + ":^990000--Empty--^000000";
  67.                                 setarray @charArray[.@i],.@i;
  68.                                 setarray @charArray$[.@i],"--Empty--";
  69.                         }
  70.                         else
  71.                         {
  72.                                 set .@charCnt, .@i + 1;
  73.                                 set .result$, .result$ + ":^000099["+.@charCnt+"] --- "+@name$[.@i-.@offset]+"^000000";
  74.                                 setarray @charArray[.@i],@char_num[.@i-.@offset];
  75.                                 setarray @charArray$[.@i],@name$[.@i-.@offset];
  76.                         }
  77.                        
  78.                 }
  79.                 return;
  80.         First:
  81.                 callsub GetList;
  82.                 switch(select(.result$))
  83.                 {
  84.                         case 1:
  85.                                 mes .npcName$;
  86.                                 mes "Understood. If you ever decide to change your mind, I'll be here.";
  87.                                 close;
  88.                         case 2: set @pickOneNum, @charArray[0]; set @pickOneName$, @charArray$[0]; callsub Second;
  89.                         case 3: set @pickOneNum, @charArray[1]; set @pickOneName$, @charArray$[1]; callsub Second;
  90.                         case 4: set @pickOneNum, @charArray[2]; set @pickOneName$, @charArray$[2]; callsub Second;
  91.                         case 5: set @pickOneNum, @charArray[3]; set @pickOneName$, @charArray$[3]; callsub Second;
  92.                         case 6: set @pickOneNum, @charArray[4]; set @pickOneName$, @charArray$[4]; callsub Second;
  93.                         case 7: set @pickOneNum, @charArray[5]; set @pickOneName$, @charArray$[5]; callsub Second;
  94.                         case 8: set @pickOneNum, @charArray[6]; set @pickOneName$, @charArray$[6]; callsub Second;
  95.                         case 9: set @pickOneNum, @charArray[7]; set @pickOneName$, @charArray$[7]; callsub Second;
  96.                         case 10: set @pickOneNum, @charArray[8]; set @pickOneName$, @charArray$[8]; callsub Second;
  97.                         case 11: set @pickOneNum, @charArray[9]; set @pickOneName$, @charArray$[9]; callsub Second;
  98.                         case 12: set @pickOneNum, @charArray[10]; set @pickOneName$, @charArray$[10]; callsub Second;
  99.                         case 13: set @pickOneNum, @charArray[11]; set @pickOneName$, @charArray$[11]; callsub Second;
  100.                         case 14: set @pickOneNum, @charArray[12]; set @pickOneName$, @charArray$[12]; callsub Second;
  101.                         case 15: set @pickOneNum, @charArray[13]; set @pickOneName$, @charArray$[13]; callsub Second;
  102.                         case 16: set @pickOneNum, @charArray[14]; set @pickOneName$, @charArray$[14]; callsub Second;
  103.                         case 17: set @pickOneNum, @charArray[15]; set @pickOneName$, @charArray$[15]; callsub Second;
  104.                         case 18: set @pickOneNum, @charArray[16]; set @pickOneName$, @charArray$[16]; callsub Second;
  105.                         case 19: set @pickOneNum, @charArray[17]; set @pickOneName$, @charArray$[17]; callsub Second;
  106.                         case 20: set @pickOneNum, @charArray[18]; set @pickOneName$, @charArray$[18]; callsub Second;
  107.                         case 21: set @pickOneNum, @charArray[19]; set @pickOneName$, @charArray$[19]; callsub Second;
  108.                         case 22: set @pickOneNum, @charArray[20]; set @pickOneName$, @charArray$[20]; callsub Second;
  109.                 }
  110.        
  111.         Second:
  112.                 mes .npcName$;
  113.                 mes "Now select the ^FF0000second^000000 character you want to change. Either the first, second, or both selections must be a character. You can not choose 2 empty slots...";
  114.                 next;
  115.                
  116.                 callsub GetList;
  117.                 switch(select(.result$))
  118.                 {
  119.                         case 1: mes .npcName$; mes "Understood. If you ever decide to change your mind, I'll be here."; close;
  120.                         case 2: set @pickTwoNum, @charArray[0]; set @pickTwoName$, @charArray$[0]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  121.                         case 3: set @pickTwoNum, @charArray[1]; set @pickTwoName$, @charArray$[1]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  122.                         case 4: set @pickTwoNum, @charArray[2]; set @pickTwoName$, @charArray$[2]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  123.                         case 5: set @pickTwoNum, @charArray[3]; set @pickTwoName$, @charArray$[3]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  124.                         case 6: set @pickTwoNum, @charArray[4]; set @pickTwoName$, @charArray$[4]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  125.                         case 7: set @pickTwoNum, @charArray[5]; set @pickTwoName$, @charArray$[5]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  126.                         case 8: set @pickTwoNum, @charArray[6]; set @pickTwoName$, @charArray$[6]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  127.                         case 9: set @pickTwoNum, @charArray[7]; set @pickTwoName$, @charArray$[7]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  128.                         case 10: set @pickTwoNum, @charArray[8]; set @pickTwoName$, @charArray$[8]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  129.                         case 11: set @pickTwoNum, @charArray[9]; set @pickTwoName$, @charArray$[9]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  130.                         case 12: set @pickTwoNum, @charArray[10]; set @pickTwoName$, @charArray$[10]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  131.                         case 13: set @pickTwoNum, @charArray[11]; set @pickTwoName$, @charArray$[11]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  132.                         case 14: set @pickTwoNum, @charArray[12]; set @pickTwoName$, @charArray$[12]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  133.                         case 15: set @pickTwoNum, @charArray[13]; set @pickTwoName$, @charArray$[13]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  134.                         case 16: set @pickTwoNum, @charArray[14]; set @pickTwoName$, @charArray$[14]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  135.                         case 17: set @pickTwoNum, @charArray[15]; set @pickTwoName$, @charArray$[15]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  136.                         case 18: set @pickTwoNum, @charArray[16]; set @pickTwoName$, @charArray$[16]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  137.                         case 19: set @pickTwoNum, @charArray[17]; set @pickTwoName$, @charArray$[17]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  138.                         case 20: set @pickTwoNum, @charArray[18]; set @pickTwoName$, @charArray$[18]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  139.                         case 21: set @pickTwoNum, @charArray[19]; set @pickTwoName$, @charArray$[19]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  140.                         case 22: set @pickTwoNum, @charArray[20]; set @pickTwoName$, @charArray$[20]; callsub Check, @pickOneNum, @pickOneName$, @pickTwoNum, @pickTwoName$;
  141.                 }
  142.                
  143.        
  144.        
  145.         Check:
  146.                
  147.                 set .@pickOne, getarg(0)+1;
  148.                 set .@pickTwo, getarg(2)+1;
  149.                
  150.                 mes .npcName$;
  151.                 mes "Are you sure you want ^0000FF" + @pickOneName$+"^000000 and ^FF0000" + @pickTwoName$ + "^000000 to switch positions?";
  152.                 next;
  153.                 switch(select("No","Yes"))
  154.                 {
  155.                         case 1:
  156.                                 mes .npcName$;
  157.                                 mes "Understood. If you ever decide to change your mind, I'll be here waiting.";
  158.                                 close;
  159.                         case 2:
  160.                                
  161.                                 mes .npcName$;
  162.                                 if(getarg(0) == getarg(2) || getarg(1) == getarg(3)) { mes "Nothing has changed positions. Have a nice day."; close; }
  163.                                 else if(getarg(1) == "--Empty--" && getarg(2) < .charAmt)
  164.                                 {
  165.                                         callsub Fee_Check;
  166.                                         query_sql "UPDATE `char` SET `char_num` = '"+getarg(0)+"' WHERE `account_id` = "+getcharid(3)+" AND char_num="+getarg(2);
  167.                                         mes getarg(3) + " has moved from position " + .@pickTwo + " to position " + .@pickOne + ". Thank you for using the character manager, have a nice day.";
  168.                                         close;
  169.                                 }
  170.                                 else if(getarg(0) < .charAmt && getarg(3) == "--Empty--")
  171.                                 {
  172.                                         callsub Fee_Check;
  173.                                         query_sql "UPDATE `char` SET `char_num` = '"+getarg(2)+"' WHERE `account_id` = "+getcharid(3)+" AND char_num="+getarg(0);
  174.                                         mes getarg(1) + " has moved from position " + .@pickOne + " to position " + .@pickTwo + ". Thank you for using the character manager, have a nice day.";
  175.                                         close;
  176.                                 }
  177.                                 else if(getarg(0) < .charAmt && getarg(2) < .charAmt)
  178.                                 {
  179.                                         callsub Fee_Check;
  180.                                         query_sql "UPDATE `char` SET `char_num` = '99' WHERE `account_id` = "+getcharid(3)+" AND char_num="+getarg(0);
  181.                                         query_sql "UPDATE `char` SET `char_num` = '"+getarg(0)+"' WHERE `account_id` = "+getcharid(3)+" AND char_num="+getarg(2);
  182.                                         query_sql "UPDATE `char` SET `char_num` = '"+getarg(2)+"' WHERE `account_id` = "+getcharid(3)+" AND char_num=99";
  183.                                         mes getarg(1) + " and " + getarg(3) + " have swapped positions. Thank you for using the character manager, have a nice day.";
  184.                                         close;
  185.                                 }      
  186.                 }
  187.                
  188.         Fee_Check:
  189.                 if(countitem(7037) > 0) // Coupon
  190.                 {
  191.                         mes "It seems you have a coupon. Would you like to use this coupon instead of paying the fee?";
  192.                         next;
  193.                         switch(select("Yes","No"))
  194.                         {
  195.                                 case 1: delitem 7037,1; return;
  196.                                 case 2: break;
  197.                         }
  198.                 }
  199.                 if(Zeny >= .fee) { set Zeny, Zeny-.fee; return; }
  200.                 else
  201.                 {
  202.                         mes .npcName$;
  203.                         mes "You do not have enough Zeny to use this service. Please come back when you have enough to pay for it.";
  204.                         close;
  205.                 }
  206. }

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at