Remove Infinity Loop Error

MikZ

New member
Messages
461
Points
0
Good day!

May I know how to get rid of error infinity loop in this script.

or where to add this *freeloop(<toggle>). thanks!

Code:
//===== Hercules Script ======================================
//= Healer
//===== By: ==================================================
//= Euphy
//===== Current Version: =====================================
//= 1.2
//===== Description: =========================================
//= Basic healer script.
//===== Additional Comments: =================================
//= 1.0 Initial script.
//= 1.1 Aligned coordinates with @go.
//= 1.2 Fix variables and character stuck at healing
//============================================================
function	script	H_VIPBuff	{
		query_sql( "SELECT CAST( `vip` AS DATE ),DATEDIFF( IFNULL(`vip`,NOW()),NOW() ), TIMESTAMPDIFF(SECOND, NOW(), `vip`) FROM `login` WHERE `account_id` = "+getcharid(3)+" LIMIT 1", .@vip_date$, .@day, .@vip_second);
		if ( .@day > 0 || .@vip_second > 0) {
		return true;
	end;
}
		return false;
}

-	script	Healer	FAKE_NPC,{

	.@price = 0;	// Zeny required for heal
	.@Buffs = 1;	// Also buff players? (1: yes / 0: no)
	.@Delay = 0;	// Heal delay, in seconds

	if (@HD > gettimetick(2)) end;
	if (.@price) {
		message strcharinfo(PC_NAME),"Healing costs "+.@price+" Zeny.";
		if (Zeny < .@price) end;
		if(select("^0055FFHeal^000000", "^777777Cancel^000000") == 2) close;
		Zeny -= .@price;
	}

	specialeffect(EF_HEAL2, AREA, playerattached()); percentheal 100,100;
	if (.@Buffs) {

	if (callfunc ("H_VIPBuff")) {
		//sc_start SC_CASH_PLUSEXP,.exp_bonus_duration,.bonus_vip_exp_rate;
		//sc_start SC_CASH_RECEIVEITEM,.bonus_duration,.bonus_vip_drop_rate;

		specialeffect(EF_INCAGILITY, AREA, playerattached());
		sc_start SC_INC_AGI,240000,10;
		specialeffect(EF_BLESSING, AREA, playerattached());
		sc_start SC_BLESSING,240000,10;
       		specialeffect(EF_KYRIE, AREA, playerattached());
		sc_start SC_KYRIE, 120000, 0;
		specialeffect( EF_IMPOSITIO, AREA, playerattached());
		sc_start SC_IMPOSITIO, 60000, 0;
		specialeffect(EF_GLORIA, AREA, playerattached());
		sc_start SC_GLORIA, 30000, 0;

	sc_end SC_STONE;
	sc_end SC_FREEZE;
	sc_end SC_STUN;
	sc_end SC_SLEEP;
	sc_end SC_POISON;
	sc_end SC_CURSE;
	sc_end SC_SILENCE;
	sc_end SC_CONFUSION;
	sc_end SC_BLIND;
	sc_end SC_BLOODING;
	sc_end SC_DPOISON;
	sc_end SC_FEAR;
	sc_end SC_COLD;
	sc_end SC_BURNING;
	sc_end SC_DEEP_SLEEP;
	sc_end SC_DEC_AGI;
	sc_end SC_BROKENARMOR;
	sc_end SC_BROKENWEAPON;
	sc_end SC_NOEQUIPWEAPON;
	sc_end SC_NOEQUIPSHIELD;
	sc_end SC_NOEQUIPARMOR;
	sc_end SC_NOEQUIPHELM;
	sc_end SC__STRIPACCESSARY;
	sc_end SC_PROPERTYUNDEAD;
	sc_end SC_ORCISH;
	sc_end SC_BERSERK;
	sc_end SC_SKE;
	sc_end SC_SWOO;
	sc_end SC_SKA;
	sc_end SC_SLOWDOWN;
	sc_end SC_FROSTMISTY;
	sc_end SC_ILLUSION;
	sc_end SC_BITESCAR;

	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++;
//	}
//	end;
	getinventorylist;
	for( .@i = 0; .@i < @inventorylist_count; .@i++ ) {
		if ( @inventorylist_identify[.@i] == 1 )
			continue;
		else if ( getskilllv(MC_IDENTIFY) == 1 && Sp >= 10 )
			heal 0,0; // lol... this is supposed to reduce their SP by 10, whatever
		else if ( countitem(Spectacles) )
			delitem Spectacles,1;
		else if ( getskilllv(RG_COMPULSION) && Zeny >= ( 100 - ( 5 + 4 * getskilllv(RG_COMPULSION) ) )* 2/5 )
			Zeny -= ( 100 - ( 5 + 4 * getskilllv(RG_COMPULSION) ) )* 2/5;
		else if ( getskilllv(MC_DISCOUNT) && Zeny >= ( 100 - ( 5 + 2 * getskilllv(MC_DISCOUNT) ) )* 2/5 )
			Zeny -= ( 100 - ( 5 + 2 * getskilllv(MC_DISCOUNT) ) )* 2/5;
		else if ( Zeny >= 40 )
			Zeny -= 40;
		else
			break;
		delitem2 @inventorylist_id[.@i], 1, 0, @inventorylist_refine[.@i], @inventorylist_attribute[.@i], @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i];
		getitem2 @inventorylist_id[.@i], 1, 1, @inventorylist_refine[.@i], 0, @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i];
		.@icount++;
	}
	if ( .@icount )
		message strcharinfo(0), "Identified "+ .@icount +" Items.";
	}
}
else {
		specialeffect(EF_INCAGILITY, AREA, playerattached());
		sc_start SC_INC_AGI,240000,10;
		specialeffect(EF_BLESSING, AREA, playerattached());
		sc_start SC_BLESSING,240000,10;
}
	if (.@Delay) @HD = gettimetick(2)+.@Delay;
	end;

}
	OnInit:	
		.exp_bonus_duration = 3600000;
		.bonus_duration = 3600000;
		.bonus_vip_exp_rate = 100;
		.bonus_vip_drop_rate = 100;
		setarray .debuffs[0], SC_LEXAETERNA, SC_DEC_AGI, SC_POISON, SC_CURSE, SC_SILENCE, SC_BLIND, SC_VENOMBLEED, SC_DPOISON, SC_BURNING;

}
//===============//
//set .@Price, 100;	// Zeny per identify
//getinventorylist;
//for(set .@i,0; .@i<@inventorylist_count; set .@i,.@i+1) {
//	if (@inventorylist_identify[.@i]) continue;
//	if (Zeny < .@Price) {
//		dispbottom? "It costs "+.@Price+" to identify an item."; break; }
//	set Zeny, Zeny-.@Price;
//	delitem2 @inventorylist_id[.@i],1,0,0,0,0,0,0,0;
//	getitem @inventorylist_id[.@i],1;
//	setarray .@Total[0], .@Total[0]+1, .@Total[1]+.@Price; }
//if (!.@Total[0]) {
//	message strcharinfo(0),"No items identified."; end; }
//specialeffect2 154;
//message strcharinfo(0),"Identified "+.@Total[0]+" items"+((.@Total[1])?" for "+.@Total[1]+" Zeny":"")+".";
//end;
//}

// Duplicates
//============================================================
alberta,25,240,6	duplicate(Healer)	Healer#alb	4_PORING
aldebaran,135,118,6	duplicate(Healer)	Healer#alde	4_PORING
amatsu,200,79,4	duplicate(Healer)	Healer#ama	4_PORING
ayothaya,207,169,6	duplicate(Healer)	Healer#ayo	4_PORING
comodo,184,158,6	duplicate(Healer)	Healer#com	4_PORING
einbech,57,36,6	duplicate(Healer)	Healer#einbe	4_PORING
einbroch,57,202,6	duplicate(Healer)	Healer#einbr	4_PORING
geffen,115,72,6	duplicate(Healer)	Healer#gef	4_PORING
gonryun,156,122,6	duplicate(Healer)	Healer#gon	4_PORING
hugel,89,150,6	duplicate(Healer)	Healer#hug	4_PORING
izlude,125,118,5	duplicate(Healer)	Healer#izl	4_PORING
jawaii,250,139,4	duplicate(Healer)	Healer#jaw	4_PORING
lighthalzen,152,100,6	duplicate(Healer)	Healer#lhz	4_PORING
louyang,226,103,4	duplicate(Healer)	Healer#lou	4_PORING
manuk,272,144,6	duplicate(Healer)	Healer#man	4_PORING
mid_camp,203,289,6	duplicate(Healer)	Healer#mid	4_PORING
moc_ruins,72,164,4	duplicate(Healer)	Healer#moc	4_PORING
morocc,153,97,6	duplicate(Healer)	Healer#mor	4_PORING
moscovia,220,191,4	duplicate(Healer)	Healer#mos	4_PORING
niflheim,212,182,5	duplicate(Healer)	Healer#nif	4_PORING
payon,179,106,4	duplicate(Healer)	Healer#pay	4_PORING
prontera,163,185,4	duplicate(Healer)	Healer#prt	4_PORING
rachel,125,116,6	duplicate(Healer)	Healer#rac	4_PORING
splendide,201,153,4	duplicate(Healer)	Healer#spl	4_PORING
thor_camp,249,74,4	duplicate(Healer)	Healer#thor	4_PORING
umbala,105,148,3	duplicate(Healer)	Healer#umb	4_PORING
veins,217,121,4	duplicate(Healer)	Healer#ve	4_PORING
xmas,143,136,4	duplicate(Healer)	Healer#xmas	4_PORING
yuno,164,45,4	duplicate(Healer)	Healer#yuno	4_PORING

// Duplicates (Renewal)
//============================================================
brasilis,194,221,6	duplicate(Healer)	Healer#bra	4_PORING
dewata,195,187,4	duplicate(Healer)	Healer#dew	4_PORING
dicastes01,201,194,4	duplicate(Healer)	Healer#dic	4_PORING
ecl_in01,45,60,4	duplicate(Healer)	Healer#ecl	4_PORING
malangdo,132,114,6	duplicate(Healer)	Healer#mal	4_PORING
malaya,205,205,6	duplicate(Healer)	Healer#ma	4_PORING
mora,55,152,4	duplicate(Healer)	Healer#mora	4_PORING
 
freeloop(true);
for (...) {
...
}
freeloop(false);


basically you put the freeloop toggle around your for() loop

 
Back
Top