Jump to content
  • 0
Sign in to follow this  
fallen0519

How to make below script announce when equipments +10 above

Question

 

prt_in,61,54,3    script    PoD Refiner    4_M_FAIRYKID6,{
OnUsed:
set .Mode,0; // Refine mode [ 0 = Refine +1 Each time  / 1 = Refine to Max Limit ]
set .EquipCheck,1; // Check Equips is refineable or not. [ 0 = Disable / 1 = Enable ]
set .MaxRefine,7; // Max Refine Limit
set .MaxRefine2,20; // Max Refine Limit [ for Mode 2 Max Refine ]
set .TicketID,7179; // Ticket ID
 
if( countitem(.TicketID) < 100 ){
mes "You don't have enough "+getitemname(.TicketID)+" to continue this process.";
mes "You need ^FF0000100 PoD^000000 to refine +1 Each time, and the success rate is ^FF0000100%^000000.";
close;
}
 
switch(select( ( getequiprefinerycnt(1) >= .MaxRefine2 || getequipisequiped(1) == 0 )?"":"Headgear [ ^4EEE94"+getequipname(1)+"^000000 ]",
( getequiprefinerycnt(2) >= .MaxRefine2 || getequipisequiped(2) == 0 )?"":"Armor [ ^4EEE94"+getequipname(2)+"^000000 ]",
( getequiprefinerycnt(3) >= .MaxRefine2 || getequipisequiped(3) == 0 )?"":"Left Hand [ ^4EEE94"+getequipname(3)+"^000000 ]",
( getequiprefinerycnt(4) >= .MaxRefine2 || getequipisequiped(4) == 0 )?"":"Right Hand [ ^4EEE94"+getequipname(4)+"^000000 ]",
( getequiprefinerycnt(5) >= .MaxRefine2 || getequipisequiped(5) == 0 )?"":"Garment [ ^4EEE94"+getequipname(5)+"^000000 ]",
( getequiprefinerycnt(6) >= .MaxRefine2 || getequipisequiped(6) == 0 )?"":"Shoes [ ^4EEE94"+getequipname(6)+"^000000 ]",
"^FF0000End^000000")) {
case 1:
mes "[PoD Refiner]";
    mes "Hmm... is this the one you want to refine?";
    mes "To refine this equipment, I need 100 PoD to refine +1 Each time, and the success rate is ^FF0000100%^000000.";
    mes "Do you really want to refine this?";
    next;
    if(select("Yes", "No") == 2) {
        mes "[PoD Refiner]";
        mes "Okay. If that's what you want...";
        close;
}
if ( .Mode == 0 ) { callsub RefineSystem,1; }
if ( .Mode == 1 ) { callsub MaxRefineSystem,1; }
if ( .Mode == 2 ) { callsub NewRefineSystem,1; }
case 2:
mes "[PoD Refiner]";
    mes "Hmm... is this the one you want to refine?";
    mes "To refine this equipment, I need 100 PoD to refine +1 Each time, and the success rate is ^FF0000100%^000000.";
    mes "Do you really want to refine this?";
    next;
    if(select("Yes", "No") == 2) {
        mes "[PoD Refiner]";
        mes "Okay. If that's what you want...";
        close;
}
if ( .Mode == 0 ) { callsub RefineSystem,2; }
if ( .Mode == 1 ) { callsub MaxRefineSystem,2; }
if ( .Mode == 2 ) { callsub NewRefineSystem,2; }
case 3:
mes "[PoD Refiner]";
    mes "Hmm... is this the one you want to refine?";
    mes "To refine this equipment, I need 100 PoD to refine +1 Each time, and the success rate is ^FF0000100%^000000.";
    mes "Do you really want to refine this?";
    next;
    if(select("Yes", "No") == 2) {
        mes "[PoD Refiner]";
        mes "Okay. If that's what you want...";
        close;
}
if ( .Mode == 0 ) { callsub RefineSystem,3; }
if ( .Mode == 1 ) { callsub MaxRefineSystem,3; }
if ( .Mode == 2 ) { callsub NewRefineSystem,3; }
case 4:
mes "[PoD Refiner]";
    mes "Hmm... is this the one you want to refine?";
    mes "To refine this equipment, I need 100 PoD to refine +1 Each time, and the success rate is ^FF0000100%^000000.";
    mes "Do you really want to refine this?";
    next;
    if(select("Yes", "No") == 2) {
        mes "[PoD Refiner]";
        mes "Okay. If that's what you want...";
        close;
}
if ( .Mode == 0 ) { callsub RefineSystem,4; }
if ( .Mode == 1 ) { callsub MaxRefineSystem,4; }
if ( .Mode == 2 ) { callsub NewRefineSystem,4; }
case 5:
mes "[PoD Refiner]";
    mes "Hmm... is this the one you want to refine?";
    mes "To refine this equipment, I need 100 PoD to refine +1 Each time, and the success rate is ^FF0000100%^000000.";
    mes "Do you really want to refine this?";
    next;
    if(select("Yes", "No") == 2) {
        mes "[PoD Refiner]";
        mes "Okay. If that's what you want...";
        close;
}
if ( .Mode == 0 ) { callsub RefineSystem,5; }
if ( .Mode == 1 ) { callsub MaxRefineSystem,5; }
if ( .Mode == 2 ) { callsub NewRefineSystem,5; }
case 6:
mes "[PoD Refiner]";
    mes "Hmm... is this the one you want to refine?";
    mes "To refine this equipment, I need 100 PoD to refine +1 Each time, and the success rate is ^FF0000100%^000000.";
    mes "Do you really want to refine this?";
    next;
    if(select("Yes", "No") == 2) {
        mes "[PoD Refiner]";
        mes "Okay. If that's what you want...";
        close;
}
if ( .Mode == 0 ) { callsub RefineSystem,6; }
if ( .Mode == 1 ) { callsub MaxRefineSystem,6; }
if ( .Mode == 2 ) { callsub NewRefineSystem,6; }
case 7: close;
}
 
RefineSystem:
if ( .EquipCheck == 1 && getequipisenableref(getarg(0)) == 0 ){
mes "I can't refine this item.because this item is unrefinable.";
close;
}
if(getequiprefinerycnt(getarg(0)) < .MaxRefine) {
mes "I can't refine this item.";
mes "You must refine to at least minimum ^0000FF+7^000000 first when you bring to me.";
close;
}
successrefitem (getarg(0));
if ( getequiprefinerycnt( .@part ) > 10 ) announce strcharinfo( 0 ) + " refine his/her item for +" + getequiprefinerycnt( .@part ) + " now!", 0;
message strcharinfo(0),"This item successfully upgrade.";
delitem .TicketID,100;
mes "[PoD Refiner]";
mes "The sound refreshes my mind everytime I hear it.";
mes "Here, have it. Refine succeeded flawlessly!";
close;
 
MaxRefineSystem:
if ( .EquipCheck == 1 && getequipisenableref(getarg(0)) == 0 ){
mes "I can't refine this item.because this item is unrefinable.";
close;
}
for ( set .@i,getequiprefinerycnt(getarg(0)); getequiprefinerycnt(getarg(0)) < .MaxRefine; set .@i,getequiprefinerycnt(getarg(0)) ){
successrefitem (getarg(0));
if ( getequiprefinerycnt( .@part ) > 10 ) announce strcharinfo( 0 ) + " refine his/her item for +" + getequiprefinerycnt( .@part ) + " now!", 0;
}
message strcharinfo(0),"this item successfully upgrade.";
delitem .TicketID,100;
mes "[PoD Refiner]";
mes "The sound refreshes my mind everytime I hear it.";
mes "Here, have it. Refine succeeded flawlessly!";
close;
 
NewRefineSystem:
if ( .EquipCheck == 1 && getequipisenableref(getarg(0)) == 0 ){
mes "I can't refine this item.because this item is unrefinable.";
close;
}
mes "I just able to refine equipments start from +7 ~ +20.";
next;
while ( countitem(.TicketID) > 0 && getequiprefinerycnt(getarg(0)) < .MaxRefine ){ 
successrefitem (getarg(0));
if ( getequiprefinerycnt( .@part ) > 10 ) announce strcharinfo( 0 ) + " refine his/her item for +" + getequiprefinerycnt( .@part ) + " now!", 0;delitem .TicketID,100;
}
while ( countitem(.TicketID) > 1 && getequiprefinerycnt(getarg(0)) > .MaxRefine && getequiprefinerycnt(getarg(0)) < .MaxRefine2 ){ 
successrefitem (getarg(0));
if ( getequiprefinerycnt( .@part ) > 10 ) announce strcharinfo( 0 ) + " refine his/her item for +" + getequiprefinerycnt( .@part ) + " now!", 0;delitem .TicketID,100;
}
message strcharinfo(0),"this item successfully upgrade.";
close;
 

 

 

 

 

Please help above script to annouce when +10 equipments, thanks!

Edited by fallen0519

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Here you are.

 

prt_in,61,54,3    script    PoD Refiner    4_M_FAIRYKID6,{
OnUsed:
	set .Mode,0; // Refine mode [ 0 = Refine +1 Each time  / 1 = Refine to Max Limit ]
	set .EquipCheck,1; // Check Equips is refineable or not. [ 0 = Disable / 1 = Enable ]
	set .MaxRefine,7; // Max Refine Limit
	set .MaxRefine2,20; // Max Refine Limit [ for Mode 2 Max Refine ]
	set .TicketID,7179; // Ticket ID
	 
	if( countitem(.TicketID) < 100 ){
		mes "You don't have enough "+getitemname(.TicketID)+" to continue this process.";
		mes "You need ^FF0000100 PoD^000000 to refine +1 Each time, and the success rate is ^FF0000100%^000000.";
		close;
	}
	 
	set .@choice, (select( ( getequiprefinerycnt(1) >= .MaxRefine2 || getequipisequiped(1) == 0 )?"":"Headgear [ ^4EEE94"+getequipname(1)+"^000000 ]",
	( getequiprefinerycnt(2) >= .MaxRefine2 || getequipisequiped(2) == 0 )?"":"Armor [ ^4EEE94"+getequipname(2)+"^000000 ]",
	( getequiprefinerycnt(3) >= .MaxRefine2 || getequipisequiped(3) == 0 )?"":"Left Hand [ ^4EEE94"+getequipname(3)+"^000000 ]",
	( getequiprefinerycnt(4) >= .MaxRefine2 || getequipisequiped(4) == 0 )?"":"Right Hand [ ^4EEE94"+getequipname(4)+"^000000 ]",
	( getequiprefinerycnt(5) >= .MaxRefine2 || getequipisequiped(5) == 0 )?"":"Garment [ ^4EEE94"+getequipname(5)+"^000000 ]",
	( getequiprefinerycnt(6) >= .MaxRefine2 || getequipisequiped(6) == 0 )?"":"Shoes [ ^4EEE94"+getequipname(6)+"^000000 ]",
	"^FF0000End^000000"));
	mes "[PoD Refiner]";
		mes "Hmm... is this the one you want to refine?";
		mes "To refine this equipment, I need 100 PoD to refine +1 Each time, and the success rate is ^FF0000100%^000000.";
		mes "Do you really want to refine this?";
		next;
		if(select("Yes", "No") == 2) {
			mes "[PoD Refiner]";
			mes "Okay. If that's what you want...";
			close;
	}
	if ( .Mode == 0 ) { callsub RefineSystem,.@choice; }
	if ( .Mode == 1 ) { callsub MaxRefineSystem,.@choice; }
	if ( .Mode == 2 ) { callsub NewRefineSystem,.@choice; }
	close;
 
RefineSystem:
	if ( .EquipCheck == 1 && getequipisenableref(getarg(0)) == 0 ){
		mes "I can't refine this item.because this item is unrefinable.";
		close;
	}
	if(getequiprefinerycnt(getarg(0)) < .MaxRefine) {
		mes "I can't refine this item.";
		mes "You must refine to at least minimum ^0000FF+7^000000 first when you bring to me.";
		close;
	}
	successrefitem (getarg(0));
	if ( getequiprefinerycnt( .@part ) >= 10 ) 
		announce strcharinfo( 0 ) + " refine his/her item for +" + getequiprefinerycnt( .@part ) + " now!", 0;
	message strcharinfo(0),"This item successfully upgrade.";
	delitem .TicketID,100;
	mes "[PoD Refiner]";
	mes "The sound refreshes my mind everytime I hear it.";
	mes "Here, have it. Refine succeeded flawlessly!";
	close;
 
MaxRefineSystem:
	if ( .EquipCheck == 1 && getequipisenableref(getarg(0)) == 0 ){
		mes "I can't refine this item.because this item is unrefinable.";
		close;
	}
	for ( set .@i,getequiprefinerycnt(getarg(0)); getequiprefinerycnt(getarg(0)) < .MaxRefine; set .@i,getequiprefinerycnt(getarg(0)) ){
		successrefitem (getarg(0));
		if ( getequiprefinerycnt( .@part ) >= 10 ) 
			announce strcharinfo( 0 ) + " refine his/her item for +" + getequiprefinerycnt( .@part ) + " now!", 0;
	}
	message strcharinfo(0),"this item successfully upgrade.";
	delitem .TicketID,100;
	mes "[PoD Refiner]";
	mes "The sound refreshes my mind everytime I hear it.";
	mes "Here, have it. Refine succeeded flawlessly!";
	close;
 
NewRefineSystem:
	if ( .EquipCheck == 1 && getequipisenableref(getarg(0)) == 0 ){
		mes "I can't refine this item.because this item is unrefinable.";
		close;
	}
	mes "I just able to refine equipments start from +7 ~ +20.";
	next;
	while ( countitem(.TicketID) > 0 && getequiprefinerycnt(getarg(0)) < .MaxRefine ){ 
			successrefitem (getarg(0));
			if ( getequiprefinerycnt( .@part ) >= 10 ) 
				announce strcharinfo( 0 ) + " refine his/her item for +" + getequiprefinerycnt( .@part ) + " now!", 0;delitem .TicketID,100;
		}
	while ( countitem(.TicketID) > 1 && getequiprefinerycnt(getarg(0)) > .MaxRefine && getequiprefinerycnt(getarg(0)) < .MaxRefine2 ){ 
		successrefitem (getarg(0));
		if ( getequiprefinerycnt( .@part ) >= 10 ) 
			announce strcharinfo( 0 ) + " refine his/her item for +" + getequiprefinerycnt( .@part ) + " now!", 0;delitem .TicketID,100;
	}
	message strcharinfo(0),"this item successfully upgrade.";
	close;
}

 

I'll also add some advices for you, to get the right habits as soon as possible:

1- When scripting, use indentation. The code is way more readable, clear, and easy to understand if you can determine where something start and end, especially with lots of conditions scripts.

2- In a switch method, always end a case with a "break" option. Otherwise, it'll pass through all the case after the one considered, until the last one

3- As far as possible, if there's copy/pasted code, you can factorize it. Which mean that you can call it once, with a particular variable.

 

Hope it'll help ^^

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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