Need help editing gathering script menu

User Tag List

Results 1 to 5 of 5
  1. #1
    dbh-'s Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help editing gathering script

    Hi guys,

    I found a script online for a bot I'm using which works great to gather peacebloom and silverleaf, unfortunately it's not scripted to gathering anything other than those two.

    Could someone here kindly explain how I can edit it/what I need to add to the script in order to make it gather other herbs or nodes?

    Be gentle, I'm really noob with scripting/botting


    script_gather = {
    isSetup = false,
    useVendor = false,
    useMount = true,
    nodeObj = nil,
    timer = 0,
    tickRate = 100,
    nextNodeDistance = 5,
    gatherDistance = 100,
    lootDistance = 3,
    lastPathIndex = -1,
    message = 'Gather...',
    collectMinerals = true,
    collectHerbs = true,
    herbs = {},
    numHerbs = 0,
    minerals = {},
    numMinerals = 0
    }

    function script_gather:addHerb(name, id, use)
    self.herbs[self.numHerbs] = {}
    self.herbs[self.numHerbs][0] = name;
    self.herbs[self.numHerbs][1] = id;
    self.herbs[self.numHerbs][2] = use;
    self.numHerbs = self.numHerbs + 1;
    end

    function script_gather:addMineral(name, id, use)
    self.minerals[self.numMinerals] = {}
    self.minerals[self.numMinerals][0] = name;
    self.minerals[self.numMinerals][1] = id;
    self.minerals[self.numMinerals][2] = use;
    self.numMinerals = self.numMinerals + 1;
    end

    function script_gather:setup()
    script_gather:addHerb('Peacebloom', 269, true);
    script_gather:addHerb('Silverleaf', 270, false);

    script_gather:addMineral('Copper Vein', 310, true);
    script_gather:addMineral('Tin Vein', 315, false);

    self.isSetup = true;
    end

    function script_gather:ShouldGather(id)

    if(self.collectMinerals) then
    for i=0,self.numMinerals - 1 do
    if(self.minerals[i][1] == id and self.minerals[i][2]) then
    return true;
    end
    end
    end

    if(self.collectHerbs) then
    for i=0,self.numHerbs - 1 do
    if(self.herbs[i][1] == id and self.herbs[i][2]) then
    return true;
    end
    end
    end
    end

    function script_gather:GetNode()
    local targetObj, targetType = GetFirstObject();
    local bestDist = 9999;
    local bestTarget = nil;
    while targetObj ~= 0 do
    if (targetType == 5) then --GameObject
    if(script_gather:ShouldGather(targetObj:GetObjectDisplayID())) then
    if(targetObj:IsInLineOfSight() or IsUsingNavmesh()) then
    local dist = targetObj:GetDistance();
    if(dist < self.gatherDistance and bestDist > dist) then
    local _x, _y, _z = targetObj:GetPosition();
    if(not IsNodeBlacklisted(_x, _y, _z, 5)) then
    bestDist = dist;
    bestTarget = targetObj;
    end
    end
    end
    end
    end
    targetObj, targetType = GetNextObject(targetObj);
    end
    return bestTarget;
    end

    function script_gathereBugInfo()
    -- color
    local r = 255;
    local g = 2;
    local b = 233;

    -- position
    local y = 152;
    local x = 25;

    -- info
    DrawRectFilled(x - 10, y - 2, x + 230, y + 16, 0, 0, 0, 160, 0, 0);
    DrawLine(x - 10, y - 2, x - 10, y + 16, r, g, b, 2);

    DrawText(self.message .. " " .. self.lastPathIndex, x, y, r, g, b); y = y + 15;

    if(self.nodeObj ~= nil) then
    local _x, _y, _z = self.nodeObj:GetPosition();
    local _tX, _tY, onScreen = WorldToScreen(_x, _y, _z);
    if(onScreen) then
    DrawText('^', _tX, _tY, r, g, b);
    end
    end
    end

    function script_gather:draw()

    script_gathereBugInfo();

    end

    function script_gather:run()

    if(not self.isSetup) then
    script_gather:setup();
    end

    if(GetTimeEX() > self.timer) then
    self.timer = GetTimeEX() + self.tickRate;

    local localObj = GetLocalPlayer();
    local isInCombat = IsInCombat();
    self.nodeObj = script_gather:GetNode();

    if(isInCombat) then
    self.message = "Combat!";
    if(GetTarget() ~= 0) then
    RunCombatScript(GetTarget():GetGUID());
    end
    self.lastPathIndex = -1;
    return;
    else
    if (RunRestScript()) then
    self.message = "Resting!";
    return;
    end
    end

    if (AreBagsFull()) then
    if(self.useVendor) then
    --NOT DONE
    StopBot();
    return;
    else
    SetSatusText("Gather", "Bot Stopped, Bags are Full!");
    StopBot();
    return;
    end
    end

    if(self.nodeObj ~= nil) then

    local _x, _y, _z = self.nodeObj:GetPosition();
    local dist = self.nodeObj:GetDistance();

    if(dist < self.lootDistance) then
    if(IsMoving()) then
    StopMoving();
    end
    if(IsMounted()) then
    DisMount();
    else
    if(not IsLooting() and not IsChanneling()) then
    self.nodeObj:GameObjectInteract();
    else
    LootTarget();
    end
    end
    else
    Move(_x, _y, _z);
    end

    self.lastPathIndex = -1;

    return
    end

    if(IsLooting() or IsCasting() or IsChanneling()
    or IsDrinking() or IsEating()) then
    return;
    end

    if(self.useMount and not IsMounted()) then
    if(RunMountScript()) then
    return;
    end
    return --FIX, return not working (Could be in water, need to move)
    end

    if(IsPathLoaded(0)) then

    local pathSize = GetPathSize(0); -- walkPath = 0
    local _lx, _ly, _lz = localObj:GetPosition();

    if(self.lastPathIndex == -1) then
    local _bestDist = 1000;
    for index = 0, pathSize do
    local _x, _y, _z = GetPathPositionAtIndex(0, index);

    if(GetDistance3D(_x, _y, _z, _lx, _ly, _lz) < _bestDist) then
    _bestDist = GetDistance3D(_x, _y, _z, _lx, _ly, _lz);
    self.lastPathIndex = index;
    end
    end
    else
    local _x, _y, _z = GetPathPositionAtIndex(0, self.lastPathIndex);
    Move(_x, _y, _z);

    if(GetDistance3D(_x, _y, _z, _lx, _ly, _lz) < self.nextNodeDistance) then
    self.lastPathIndex = self.lastPathIndex + 1;

    if(self.lastPathIndex >= pathSize) then
    self.lastPathIndex = 0;
    end
    end
    end
    end
    end
    end

    function script_gather:menu()

    if(not self.isSetup) then
    script_gather:setup();
    end

    if (CollapsingHeader("[Gather")) then
    wasClicked, self.useMount = Checkbox("Use Mount", self.useMount);
    self.gatherDistance = SliderFloat("Gather Distance", 1, 100, self.gatherDistance);
    self.lootDistance = SliderFloat("Loot Distance", 1, 6, self.lootDistance);
    self.nextNodeDistance = SliderFloat("Next Node Distance", 1, 10, self.nextNodeDistance);
    self.tickRate = SliderFloat("Tick Rate", 1, 1000, self.tickRate);
    wasClicked, self.collectMinerals = Checkbox("Mining", self.collectMinerals);
    wasClicked, self.collectHerbs = Checkbox("Herbalism", self.collectHerbs);

    if(self.collectMinerals) then
    Separator();
    Text('Minerals');

    for i=0,self.numMinerals - 1 do
    wasClicked, self.minerals[i][2] = Checkbox(self.minerals[i][0], self.minerals[i][2]);
    end
    end

    if(self.collectHerbs) then
    Separator();
    Text('Herbs');

    for i=0,self.numHerbs - 1 do
    wasClicked, self.herbs[i][2] = Checkbox(self.herbs[i][0], self.herbs[i][2]);
    end
    end
    end
    end

    Need help editing gathering script
  2. #2
    ev0's Avatar ★ Elder ★ murlocs.com

    CoreCoins Purchaser Authenticator enabled
    Reputation
    1850
    Join Date
    Jul 2012
    Posts
    2,737
    Thanks G/R
    313/377
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    7 Thread(s)
    Looks simple enough:

    under the function: function script_gather:setup()

    script_gather:addHerb('Peacebloom', 269, true);

    You just add the Name, objectID, and i'm not 100% sure what "use" means, but you could just set that to true or false and see what it does.
    Need a guild in the US? Visit murlocs.com

  3. #3
    dbh-'s Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks man

    how do you know what number to use? example :script_gather:addHerb('Peacebloom', 269, true);

    if i want to keep adding herbs to the list, how do i work out the numbering?

    Again, sorry im really useless at coding
    Last edited by dbh-; 12-12-2018 at 10:11 PM.

  4. #4
    ev0's Avatar ★ Elder ★ murlocs.com

    CoreCoins Purchaser Authenticator enabled
    Reputation
    1850
    Join Date
    Jul 2012
    Posts
    2,737
    Thanks G/R
    313/377
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    7 Thread(s)
    Copper = 310,
    Tin = 315,
    Incendicite = 384,
    Silver = 314,
    Iron = 312,
    Indurium = 384,
    Gold = 311,
    LesserBloodstone = 48,
    Mithril = 313,
    Truesilver = 314,
    DarkIron = 2571,
    SmallThorium = 3951,
    RichThorium = 3952,
    ObsidianChunk = 6650,
    FelIron = 6799,
    Adamantite = 6798,
    Cobalt = 7881,
    Nethercite = 6650,
    Khorium = 6800,
    Saronite = 7804,
    Titanium = 6798
    Peacebloom = 269,
    Silverleaf = 270,
    Earthroot = 414,
    Mageroyal = 268,
    Briarthorn = 271,
    Stranglekelp = 700,
    Bruiseweed = 358,
    WildSteelbloom = 371,
    GraveMoss = 357,
    Kingsblood = 320,
    Liferoot = 677,
    Fadeleaf = 697,
    Goldthorn = 698,
    KhadgarsWhisker = 701,
    Wintersbite = 699,
    Firebloom = 2312,
    PurpleLotus = 2314,
    ArthasTears = 2310,
    Sungrass = 2315,
    Blindweed = 2311,
    GhostMushroom = 389,
    Gromsblood = 2313,
    GoldenSansam = 4652,
    Dreamfoil = 4635,
    MountainSilversage = 4633,
    Plaguebloom = 4632,
    Icecap = 4634,
    BlackLotus = 4636,
    Felweed = 6968,
    DreamingGlory = 6948,
    Terocone = 6969,
    Ragveil = 6949,
    FlameCap = 6966,
    AncientLichen = 6967,
    Netherbloom = 6947,
    NightmareVine = 6946,
    ManaThistle = 6945,
    TalandrasRose = 7865,
    Goldclover = 7844,
    AddersTongue = 8084

    Good place to start


    script_gather:addHerb('Peacebloom', 269, true);

    just change peacebloom, #, and try setting it to TRUE
    Need a guild in the US? Visit murlocs.com

  5. #5
    dbh-'s Avatar Member
    Reputation
    1
    Join Date
    Mar 2014
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks man, I'll try it out

Similar Threads

  1. Need help with my script [lua]
    By Satzen in forum World of Warcraft Emulator Servers
    Replies: 5
    Last Post: 05-18-2008, 05:19 PM
  2. [WIP] Need help editing Hyena.M2!
    By Elthea in forum World of Warcraft Model Editing
    Replies: 2
    Last Post: 05-14-2008, 07:48 AM
  3. [C++]Need help with my Scripted Item
    By freezer1012 in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 01-13-2008, 05:55 PM
  4. [Help] I need help creating a script.
    By jokerjokes in forum World of Warcraft Emulator Servers
    Replies: 23
    Last Post: 01-10-2008, 10:06 PM
  5. Need help editing itemcache.wdb and sword position
    By Kaiderai in forum World of Warcraft General
    Replies: 2
    Last Post: 09-06-2007, 05:28 PM
All times are GMT -5. The time now is 08:38 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search