LUA Code Example - daemitus/SomethingNeedDoing GitHub Wiki

I've seen some questions regarding how to write loops with LUA, so I'll happily share mine! This is my actual loop that I use. If food or potion is not needed, those sections can be commented out.

while true do

yield('/wait 1')
if(NeedsRepair())
then
yield('/runmacro Repair')
end

yield('/wait 1')
if(CanExtractMateria())
then
yield('/runmacro Materia')
end

yield('/wait 1')
if (not HasStatus("Well Fed")) 
then
yield('/runmacro FoodBuff')
end

yield('/wait 1')
if (not HasStatus("Medicated")) 
then
yield('/runmacro PotBuff')
end

yield('/runmacro CPLUA')
end