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;
}
}

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;
}
}

Last edited by a moderator: