MMOMinion

Full Version: First LUA help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm writing my first lua and learning by doing. It's going to be for gathering common materials I use when crafting. The idea is that it will go to one spot, get x amount and then move onto the next. 

So I have a couple of questions. 

1) Is there a way I can make it so when its counting what I've collected, it only counts HQ versions?

2) How do I add an end profile that means that once its done, it'll teleport me somewhere safe (ideally my FC estate)?
(07-28-2017, 12:01 AM)taffyapple Wrote: [ -> ]I'm writing my first lua and learning by doing. It's going to be for gathering common materials I use when crafting. The idea is that it will go to one spot, get x amount and then move onto the next. 

So I have a couple of questions. 

1) Is there a way I can make it so when its counting what I've collected, it only counts HQ versions?

2) How do I add an end profile that means that once its done, it'll teleport me somewhere safe (ideally my FC estate)?

Hello Taffy,

I am not sure if you can count HQ items only. But you could just set a command to count the regular item and use the skill profile for HQ items. With a little trial and error, you could figure out exactly how many you need to gather before moving on. Example: by the time you obtain 500 regular ore,you would have maybe 150 HQ? 

The LUA code automatically moves onto the next numerical task after the current task is completed. They do not have to be in perfect order - it goes from least to greatest, notice how mine goes from #28 to #99.

I have linked some code below, after 1000 iron ore are obtained - the bot goes back to uldah and sits there. All you need to teleport somewhere safe and just sit there is a map ID and some coordinates that you get from the dev tools in game using ffxivminion. See below.

[28] = {  --Iron Ore 
["type"] = "mining";
["timeout"] = 2500;
["radius"] = 100;
["minlevel"] = 1;
["maxlevel"] = 70; 
["item1"] = "Iron Ore";
["mapid"] = 140;
["pos"] =  { 
["x"] = 292.831;
["y"] = 63.072;
                ["z"] = -250.353;
};
["condition"] = {
["ItemCount(5111) < 1000"] = true;
};
["complete"] = {
["ItemCount(5111) >= 1000"] = true;
    };
};

    [99] = { -- Go back to town and AFK
["mapid"] = 131;
["pos"] =  { 
["x"] = 148.893;
["y"] = 4.000;
    ["z"] = -42.073;
    };
};
    };
}
You don't even need the ["complete"] statement. It will just be done when the ["condition"] is met. I use this all the time to make profiles for gathering items for gear sets and such.

I don't know about counting HQ only using ItemCount. But to make it count HQ in the total, it's going to look like ["ItemCount(5111,true) < 1000"] = true;

Course, this isn't learning LUA I guess. Just the content of making the profiles.

EDIT: After looking at the ffxiv_helpers.lua file, it doesn't appear that ItemCount takes an argument for "Count HQ only". But this seems to work for the condition (which only ends up counting HQ only):

["(ItemCount(5111,true) - ItemCount(5111)) < 1000"] = true;