Jump to content
  • 1

Enchant Remove with Choices not working correctly


kodkodkub

Question


  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  81
  • Reputation:   17
  • Joined:  07/18/16
  • Last Seen:  

for(.@i=0;.@i<(MAX_ITEM_RDM_OPT-1);.@i++){
        .@r_id[.@i] = getequiprandomoption(.s_all_loc[.@s_all_selected],.@i,ROA_ID);
        .@r_v[.@i] = getequiprandomoption(.s_all_loc[.@s_all_selected],.@i,ROA_VALUE);
        .@r_p[.@i] = getequiprandomoption(.s_all_loc[.@s_all_selected],.@i,ROA_PARAM);
    }
    
    .@card0 = getequipcardid(.s_all_loc[.@s_all_selected],0);
    .@card1 = getequipcardid(.s_all_loc[.@s_all_selected],1);
    .@card2 = getequipcardid(.s_all_loc[.@s_all_selected],2);
    .@card3 = getequipcardid(.s_all_loc[.@s_all_selected],3);
    if(.@remove_orbs){
        next;
        mes "this will remove all the cards and orbs inside the item!";
        if (.s_zeny_remove > 0) {
            mes "this will cost you " + .s_zeny_remove + " Zeny.";
        }
        mes "are you sure?";
            switch(select("NO:Yes")){
                case 1: end;
                case 2:
                    mes "for the last time!";
                    mes "are you sure?";
                    switch(select("NO:Yes")){
                    case 1: end;
                    case 2: 
                        if (Zeny < .s_zeny_remove) {
                            mes "Sorry, but you don't have enough zeny.";
                            close;
                        }
                        if(.select_remove_orb){
                            if(.@card0 == 0).@card0$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card0$ = getitemname(.@card0);
                            if(.@card1 == 0).@card1$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card1$ = getitemname(.@card1);
                            if(.@card2 == 0).@card2$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card2$ = getitemname(.@card2);
                            if(.@card3 == 0).@card3$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card3$ = getitemname(.@card3);
                            switch(select(.@card0$,.@card1$,.@card2$,.@card3$)){
                                case 1: .@card0 = 0; break;
                                case 2: .@card1 = 0; break;
                                case 3: .@card2 = 0; break;
                                case 4: .@card3 = 0; break;
                            }
                            specialeffect2 EF_REPAIRWEAPON;
                            set .@item, getequipid(.s_all_loc[.@s_all_selected]);
                            delitem .@item,1;
                            getitem3 .@item, 1, 1, .@s_item_refine, 0, .@card0, .@card1, .@card2, .@card3,.@r_id,.@r_v,.@r_p;
                            set Zeny, Zeny-.s_zeny_remove;
                            end;
                        }
                        specialeffect2 EF_REPAIRWEAPON;
                        set .@item, getequipid(.s_all_loc[.@s_all_selected]);
                        delitem .@item,1;
                        getitem3 .@item, 1, 1, .@s_item_refine, 0, 0, 0, 0, 0,.@r_id,.@r_v,.@r_p;
                        set Zeny, Zeny-.s_zeny_remove;
                        end;
                    }
            }
    }

Original script by sader
the part above = enchant removing part
image.png.c09fc116b5c84a2b2f1f0ab176b5acb6.png

as you can see from the picture
I picked 2nd slot which is [Spell 7] to be remove
but somehow it remove 3rd slot instead
can someone help me fixing the script?

thank you very much


 

this is the full script

sader_s_enchant_V2.6_with_random_option_support.txt

 

Edited by kodkodkub
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 2

  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Change 

if(.@card0 == 0).@card0$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card0$ = getitemname(.@card0);
if(.@card1 == 0).@card1$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card1$ = getitemname(.@card1);
if(.@card2 == 0).@card2$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card2$ = getitemname(.@card2);
if(.@card3 == 0).@card3$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card3$ = getitemname(.@card3);

To 

if(.@card0 == 0).@card0$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]"; else .@card0$ = getitemname(.@card0);
if(.@card1 == 0).@card1$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]"; else .@card1$ = getitemname(.@card1);
if(.@card2 == 0).@card2$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]"; else .@card2$ = getitemname(.@card2);
if(.@card3 == 0).@card3$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]"; else .@card3$ = getitemname(.@card3);

It happens because when you remove the first enchant item the selection menu becomes "- [ No Equip ]:", "Enchant1", "Enchant2", "Enchant3". The script engine reads ":" as delimiter in case of select command. Since it's there all the indexes of the select options are moved [ No Equp (1), empty string (2),  card2 (3), card3 (4), card4 (5) ].

  • Upvote 2
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  15
  • Topics Per Day:  0.01
  • Content Count:  81
  • Reputation:   17
  • Joined:  07/18/16
  • Last Seen:  

48 minutes ago, Patskie said:

Change 


if(.@card0 == 0).@card0$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card0$ = getitemname(.@card0);
if(.@card1 == 0).@card1$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card1$ = getitemname(.@card1);
if(.@card2 == 0).@card2$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card2$ = getitemname(.@card2);
if(.@card3 == 0).@card3$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]:"; else .@card3$ = getitemname(.@card3);

To 


if(.@card0 == 0).@card0$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]"; else .@card0$ = getitemname(.@card0);
if(.@card1 == 0).@card1$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]"; else .@card1$ = getitemname(.@card1);
if(.@card2 == 0).@card2$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]"; else .@card2$ = getitemname(.@card2);
if(.@card3 == 0).@card3$ = " - [ ^D6C4E8" + "No Equip" + "^000000 ]"; else .@card3$ = getitemname(.@card3);

It happens because when you remove the first enchant item the selection menu becomes "- [ No Equip ]:", "Enchant1", "Enchant2", "Enchant3". The script engine reads ":" as delimiter in case of select command. Since it's there all the indexes of the select options are moved [ No Equp (1), empty string (2),  card2 (3), card3 (4), card4 (5) ].

now it work perfectly
thank you very much Patskie

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...