Jump to content
  • 0
Sign in to follow this  
MikZ

Infinity loop (error)

Question

Good day!

May I request to clean my script. I kept getting infinity loop error despite placing freeloop(true/false)
Please help me. thanks!

Here's the script.

//===== 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 = 2;	// 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 (callfunc ("H_VIPBuff")) {

	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;

		//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, 3;
		specialeffect( EF_IMPOSITIO, AREA, playerattached());
		sc_start SC_IMPOSITIO, 60000, 3;
		specialeffect(EF_GLORIA, AREA, playerattached());
		sc_start SC_GLORIA, 30000, 3;


	if( getbrokenid(1) ) repairall;
		getinventorylist;
		while( .@i < @inventorylist_count ){

	getinventorylist;
	freeloop(true);

	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++;
	}
	freeloop(false);

	if ( .@icount )
		message strcharinfo(0), "Identified "+ .@icount +" Items.";
	}
}
else {
	if (.@Buffs) {
		specialeffect(EF_INCAGILITY, AREA, playerattached());
		sc_start SC_INC_AGI,240000,5;
		specialeffect(EF_BLESSING, AREA, playerattached());
		sc_start SC_BLESSING,240000,5;
}
	if (.@Delay) @HD = gettimetick(2)+.@Delay;
	end;

}
}

image.png.afb32c8ad4bcc6ae154a15660b487ac2.png

Edited by MikZ

Share this post


Link to post
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Based on the error the source is coming from npc @ prontera 163 185 but you are showing a fake npc here. Are you calling that posted script from multiple npc's? 

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, Patskie said:

Based on the error the source is coming from npc @ prontera 163 185 but you are showing a fake npc here. Are you calling that posted script from multiple npc's? 

 

Hi @Patskie, yes I am duplicating it.

 

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

 

Share this post


Link to post
Share on other sites
  • 0

Your calling getinventorylist multiple times (while && for) and i'm not sure why

 

Here try 

//===== 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);
		return .@day > 0 || .@vip_second > 0 ? true : false;
}

-	script	Healer	FAKE_NPC,{

	.@price = 0;	// Zeny required for heal
	.@Buffs = 1;	// Also buff players? (1: yes / 0: no)
	.@Delay = 2;	// 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 (callfunc ("H_VIPBuff")) {

		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;

		//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, 3;
		specialeffect( EF_IMPOSITIO, AREA, playerattached());
		sc_start SC_IMPOSITIO, 60000, 3;
		specialeffect(EF_GLORIA, AREA, playerattached());
		sc_start SC_GLORIA, 30000, 3;


		if( getbrokenid(1) ) repairall;
		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 {
		if (.@Buffs) {
			specialeffect(EF_INCAGILITY, AREA, playerattached());
			sc_start SC_INC_AGI,240000,5;
			specialeffect(EF_BLESSING, AREA, playerattached());
			sc_start SC_BLESSING,240000,5;
		}
		if (.@Delay) @HD = gettimetick(2)+.@Delay;
		end;
	}
}

 

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.