Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CPU leak - autofarm script
Author Message
kreon Offline
Expired VIP Member
**

Posts: 47
Joined: Oct 2013
Reputation: 2
Version: 1.4.2.142
Post: #1
Sad CPU leak - autofarm script
Hello guys.
I have script:
    LUA Programming
dofile (GetDir() .. "\\scripts\\QuestsMystic\\fight.lua");
moveDistance = 30;
repeat
if(GetZoneType() == 12) then
Sleep(10000);
SetPause(true); ---- to stop Tower in town, untill u get in farm-spot
 
MoveTo(147661, 26685, -2200, moveDistance);
MoveTo(147213, 25827, -2008, moveDistance);
TargetNpc("Adventurers' Guide", 32327);
Talk();
ClickLinkAndWait("blessing_list001.htm");
ClickText("\"Wizard's Harmony, of course!\"");
ClearTargets();
LearnAllSkills();
MoveTo(*, moveDistance);
MoveTo(*, moveDistance);
MoveTo(*, moveDistance);
MoveTo(*, moveDistance);
MoveTo(*, moveDistance);
Sleep(3000);
 
if(GetZoneType() == 15) then
Sleep(11000);
SetPause(false);  ------ to reactivate Tower in farm spot.
end;
end;
until false;


After i launch hem my computer take lag i see in task mannager every l2 window where i launch that script have leac CPU.
When i stop, this leak stop.
I think m.b. that becouse (if) try check location every moment.. and that is hard...Hove fix that? Maybe do some delay for (if) check every 1min. location? Or what i do wrong? I am noob i think that i do something wrong. Help please.
(This post was last modified: 10-27-2013 11:40 AM by Fox.)
10-27-2013 11:19 AM
Find all posts by this user Quote this message in a reply
Fox Away
Fraka-kaka-kaka-kaka-kow!
******

Posts: 5,627
Joined: Oct 2011
Reputation: -6666548
Version: 1.4.2.142
Post: #2
RE: CPU leak - autofarm script
what's this ? are they valid locations? if not suspend them whit -- or remove

MoveTo(*, moveDistance);
MoveTo(*, moveDistance);
MoveTo(*, moveDistance);
MoveTo(*, moveDistance);
MoveTo(*, moveDistance);


G2A is a fantastic web-store where you can buy games cheap (40%+ Discounts!)
[Image: uaFndGu.gif]
10-27-2013 11:43 AM
Visit this user's website Find all posts by this user Quote this message in a reply
kreon Offline
Expired VIP Member
**

Posts: 47
Joined: Oct 2013
Reputation: 2
Version: 1.4.2.142
Post: #3
RE: CPU leak - autofarm script
you can write here any coordinats as you want..
help. )
10-27-2013 23:36 PM
Find all posts by this user Quote this message in a reply
Vinter Offline
Expired VIP Member
**

Posts: 299
Joined: Sep 2013
Reputation: 109
Version: 1.4.1.128
Post: #4
RE: CPU leak - autofarm script
Please post the code of "fight.lua", the problem could be there.

Also, if you're using this script as it is right now, It should be giving you an error on the coordinates of that MoveTo Fox quoted. If those are usable piece of code to the program but it's giving you errors every tick, that might be it.
Please right click on L2Tower icon right beside the clock at the bottom-right corner of the screen, go to Running Games -> The client using this script -> Logs. Upload a screenshot of the logs just right after you stop the script and everything isn't freezing anymore.

The IF checking every single moment isn't a problem on Tower nor L2 CPU usage.

Good luck
10-28-2013 04:24 AM
Find all posts by this user Quote this message in a reply
GoodLuck777 Offline
Goblin Grave Robber
*

Posts: 11
Joined: Oct 2013
Reputation: 2
Version: 1.4.1.110
Post: #5
RE: CPU leak - autofarm script
put Sleep(100); in the beggining (or in repeat cycle) of every script
10-28-2013 11:57 AM
Find all posts by this user Quote this message in a reply
kreon Offline
Expired VIP Member
**

Posts: 47
Joined: Oct 2013
Reputation: 2
Version: 1.4.2.142
Post: #6
RE: CPU leak - autofarm script
Fight.lua
Code:
function Nuke_AddSkill(id, range)
    local it = L2TConfig.NukeSetting();
    local SCONFIG = L2TConfig.GetConfig();
    it.meHpCondition = L2TConfig.ENukeCondition.NC_ALWAYS;
    it.meMpCondition = L2TConfig.ENukeCondition.NC_ALWAYS;
    it.meHpValue = 100;
    it.meMpValue = 100;
    it.useRepeat = true;
    it.requireTarget = true;
    it.skillId = id;
    it.targetCount = 1;
    it.targetHpCondition = L2TConfig.ENukeCondition.NC_ALWAYS;
    it.targetHpValue = 100;
    it.targetRange = range;
    it.useEvery = 0; --autodetect
    SCONFIG.nuke.skills:Add(it);
end;

function EnableAttackRange(range)
    local SCONFIG = L2TConfig.GetConfig();
--SCONFIG.nuke.skills:Clear(); -- Очистить нюк
    Nuke_AddSkill(1178, range*1); --Twister
    SCONFIG.nuke.enabled = true;
end;



function PreSetup()
    SCONFIG.potions.enabled = true;
    SCONFIG.potions.HP.enabled = true;
    SCONFIG.potions.HP.LesserHealingPotion.DamagePercent = 10;
    SCONFIG.pickup.userPickup.pickupRange = 300;            --Pickup Range Setup
    SCONFIG.pickup.userPickup.pickupTimeout = 15;
    SCONFIG.pickup.userPickup.mode = L2TConfig.EPickupMode.PICKUP_AFTER;            --Pickup After On
    SCONFIG.pickup:SwapFilter(512);
    SCONFIG.pickup:SwapFilter(256);
    SCONFIG.pickup:SwapFilter(128);
    SCONFIG.pickup:SwapFilter(64);
    SCONFIG.pickup:SwapFilter(8192);
    SCONFIG.pickup:SwapFilter(2);
    SCONFIG.pickup:SwapFilter(4);
    SCONFIG.pickup:SwapFilter(8);
    SCONFIG.pickup:SwapFilter(16);
    SCONFIG.resurrect.enabled = true;
    SCONFIG.resurrect.autoRevive = true;
    SCONFIG.resurrect.reviveDelay = 5;
    SCONFIG.resurrect:SwapAllowed(0x0002);
    SCONFIG.sleep.enabled = true;
    --SCONFIG.sleep.noActionSleep = true;
    SCONFIG.sleep.sitMP=23
    SCONFIG.sleep.standMP=55
    end
    ActivateSoulShot(22249,true);
    ActivateSoulShot(22250,true);
    ActivateSoulShot(22251,true);
    LearnAllSkills();
function EnableAttack()
    EnableAttackRange(700);
end;


function DisableAttack()
    local SCONFIG = L2TConfig.GetConfig();
    SCONFIG.nuke.enabled = false;
    SCONFIG.nuke.skills:Clear();
end;


function CountMonstersInRange(range)
    local me = GetMe();
    local l = GetMonsterList();
    local c = 0;
        
    for user in l.list do
        if ((user:IsAlikeDeath() == false) and (user:GetRangeTo(me)             c = c + 1;
        end;        
    end;
    return c;
end;

function KillTarget()
    local t = GetTarget();
    if (t == nil) then
        return true;
    end;
    if ((t:IsValid() == false) or (t:IsAlikeDeath() == true)) then
        return true;
    end;
    --wylacz targetowanie, wlacz attack...
    EnableAttackRange(10000);
    SCONFIG.targeting.option = L2TConfig.ETargetingType.TT_OFF;
    local paused = IsPaused();
    SetPause(false);
    repeat
        ClearTargets();
        Target(t);
        Sleep(500);
    until (t:IsValid() == false) or (t:IsAlikeDeath() == true);
    DisableAttack();
    SetPause(paused);
    return true;
end;

function KillEveryooneWhoAttacks(u)
    local monsters = GetMonsterList();
    local t = nil;
    repeat
        t = nil;
        for user in monsters.list do
            if (user:IsEnemy() and user:GetTarget() == u:GetId() ) then
                t = user;
                break;
            end;
        end;
        if (t ~= nil) then
            Target(t);
            KillTarget();
        end;
    until t == nil;
end;

function AddPathPoint(X, Y, Z, Range)
    local tmpPoint = L2TConfig.L2PathPoint();
    tmpPoint.X = X;
    tmpPoint.Y = Y;
    tmpPoint.Z = Z;
    tmpPoint.range = Range;
    tmpPoint.type = L2TConfig.ETargetingRangeType.TRT_CIRCLE;
    SCONFIG.targeting.pathPoints:Add(tmpPoint);
end;

autofarm.lua
Code:
dofile (GetDir() .. "\\scripts\\QuestsMystic\\fight.lua");
moveDistance = 30;
repeat
if(GetZoneType() == 12) then
Sleep(10000);
SetPause(true); ---- to stop Tower in town, untill u get in farm-spot

MoveTo(147661, 26685, -2200, moveDistance);
MoveTo(147213, 25827, -2008, moveDistance);
TargetNpc("Adventurers' Guide", 32327);
Talk();
ClickLinkAndWait("blessing_list001.htm");
ClickText("\"Wizard's Harmony, of course!\"");
ClearTargets();
LearnAllSkills();
MoveTo(147213, 25827, -2008, moveDistance);
Sleep(3000);

if(GetZoneType() == 15) then
Sleep(11000);
SetPause(false);  ------ to reactivate Tower in farm spot.
end;
end;
until false;
2 codes
10-28-2013 16:29 PM
Find all posts by this user Quote this message in a reply
Vinter Offline
Expired VIP Member
**

Posts: 299
Joined: Sep 2013
Reputation: 109
Version: 1.4.1.128
Post: #7
RE: CPU leak - autofarm script
You need premium account to use "fight.lua" script. Put " -- " at the beggining of
    LUA Programming
dofile (GetDir() .. "\\scripts\\QuestsMystic\\fight.lua");

line.
It will NOT attack, but it's just a matter of testing and debugging. If your CPU works Ok with that, then we know what's the problem.

Also please attach the logs I told you about.
And for god's sake, use [code=lua] to show the script properly.


Thanks
10-28-2013 17:28 PM
Find all posts by this user Quote this message in a reply
kreon Offline
Expired VIP Member
**

Posts: 47
Joined: Oct 2013
Reputation: 2
Version: 1.4.2.142
Post: #8
RE: CPU leak - autofarm script
all ok guys .. realy i just need do sleep after repeat )

    LUA Programming
moveDistance = 30;
repeat
Sleep(10000);
if(GetZoneType() == 12) then
Sleep(10000);
SetPause(true); ---- to stop Tower in town, untill u get in farm-spot
Sleep(3000);
if(GetZoneType() == 15) then
Sleep(11000);
SetPause(false); ------ to reactivate Tower in farm spot.
end;
end;
until false;

(This post was last modified: 10-28-2013 20:32 PM by Fox.)
10-28-2013 20:20 PM
Find all posts by this user Quote this message in a reply
Fox Away
Fraka-kaka-kaka-kaka-kow!
******

Posts: 5,627
Joined: Oct 2011
Reputation: -6666548
Version: 1.4.2.142
Post: #9
RE: CPU leak - autofarm script
No need for lua at the end Smile


G2A is a fantastic web-store where you can buy games cheap (40%+ Discounts!)
[Image: uaFndGu.gif]
10-28-2013 20:33 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Vinter Offline
Expired VIP Member
**

Posts: 299
Joined: Sep 2013
Reputation: 109
Version: 1.4.1.128
Post: #10
RE: CPU leak - autofarm script
(10-28-2013 20:20 PM)kreon Wrote:  all ok guys .. realy i just need do sleep after repeat )

Really guy? that actually solved it? Despite this forum account creation date, I've been using this bot for god knows how long, and wrote countless scripts and plugins without using almost no sleeps at all, and none of them gave me any sort of CPU problems.

I still don't get how are you able to use "fight.lua" script when it's clearly using premium only functions.

But well, glad you solve your issue.
10-28-2013 23:36 PM
Find all posts by this user Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Autofarm Script repeat without condition problem. either 3 703 05-25-2016 01:00 AM
Last Post: TheQQmaster
  [HELP] Autofarm teleport marianolibertad 3 2,923 03-11-2014 03:24 AM
Last Post: knutoz



User(s) browsing this thread: 1 Guest(s)