Help to put auto repair on my healer and indentify

getinventorylist;for( set .@i,0; .@i < @inventorylist_count; set .@i, .@i + 1 ) {        if ( @inventorylist_identify[.@i] == 1 ) continue; delitem2 @inventorylist_id[.@i],1,0,0,0,0,0,0,0; getitem @inventorylist_id[.@i],1;}if ( !getbrokenid(1) ) close;atcommand "@repairall"; 
Add this 
 
Code:
getinventorylist;for( set .@i,0; .@i < @inventorylist_count; set .@i, .@i + 1 ) { if ( @inventorylist_identify[.@i] == 1 ) continue; delitem2 @inventorylist_id[.@i],1,0,0,0,0,0,0,0; getitem @inventorylist_id[.@i],1;}if ( !getbrokenid(1) ) close;atcommand "@repairall";
Add this
where would i add that? can you make it a whole script?


SOLVED

Code:
getinventorylist;for( set .@i,0; .@i < @inventorylist_count; set .@i, .@i + 1 ) { if ( @inventorylist_identify[.@i] == 1 ) continue; delitem2 @inventorylist_id[.@i],1,0,0,0,0,0,0,0; getitem @inventorylist_id[.@i],1;}if ( !getbrokenid(1) ) close;atcommand "@repairall";
Add this
i thought i already solved it but i dunno where to add the script
 
Last edited by a moderator:
Code:
-	script	healtest	-1,{	.@price = 0;	// Zeny required for heal	.@Buffs = 1;	// Also buff players? (1: yes / 0: no)	.@Delay = 1;	// Heal delay, in seconds	if( getbrokenid(1) ) repairall;	getinventorylist;	while( .@i < @inventorylist_count ){		if ( !@inventorylist_identify[.@i] ){		delitem2 @inventorylist_id[.@i],1,0,0,0,0,0,0,0;		getitem @inventorylist_id[.@i],1;		}		.@i++;	}	if (@HD > gettimetick(2)) end;	if (.@price) {		message strcharinfo(0),"Healing costs "+.@price+" Zeny.";		if (Zeny < .@price) end;		if(select("^0055FFHeal^000000:^777777Cancel^000000") == 2) close;		Zeny -= .@price;	}	specialeffect2 EF_HEAL2; percentheal 100,100;	if (.@Buffs) {		specialeffect2 EF_INCAGILITY; sc_start SC_INC_AGI,360000,10;		specialeffect2 EF_BLESSING; sc_start SC_BLESSING,360000,10;	}	if (.@Delay) @HD = gettimetick(2)+.@Delay;	close;OnInit:	waitingroom "Healer",0;}
 
if( getbrokenid(1) ) repairall; getinventorylist; while( .@i < @inventorylist_count ){ if ( !@inventorylist_identify[.@i] ){ delitem2 @inventorylist_id[.@i],1,0,0,0,0,0,0,0; getitem @inventorylist_id[.@i],1; } .@i++; }
I'm just nitpicking, but why not use a for loop since it's counter-controlled anyway?

for (.@i = 0; .@i < @inventorylist_count; .@i++) { if (!@inventorylist_identify[.@i]) { delitem2 @inventorylist_id[.@i],1,0,0,0,0,0,0,0; getitem @inventorylist_id[.@i],1; } }

Also, it might be nice to add in a visual effect for that repair (and enclose it in curly braces, because one-liners is just bad coding habit):

Code:
	if (getbrokenid(1)) {		specialeffect2 EF_REPAIRWEAPON;		repairall;	}
 
Last edited by a moderator:
Probably an absurd answer : his while loop is much slightly faster than your for loop in terms of execution time
default_biggrin.png


 
Last edited by a moderator:
Back
Top