Re: useGoodie
Posted: Sun Jun 05, 2011 1:06 am
can you show me how you write in the code, do you need to put (;) after the code (useGoodie"luck")?
In Lua code semicolons are optional i think. But you still need to form functions correctly. useGoodie("luck").harbifm wrote:can you show me how you write in the code, do you need to put (;) after the code (useGoodie"luck")?
Code: Select all
inventory:useItem(option.ID);
you don't know how glad I am to hear that, I have been putting off changing all my profiles from MACRO to keys lolrock5 wrote:I got a fix working that should solve all RoMScript problems. Just testing and cleaning up code.
Code: Select all
-- All this does is allow you to use the 'standard' buffs a bit easier, and with less code :)
-- However, I've sacrificed readability a bit for this, as you will see in the example below:
-- buffUp(true, true, false, true, false, true, false, determineFoodTypeToBuff());
--
-- Pretty cryptic huh? Well, the function buffUp is defined like this:
-- buffUp(luck, speed, mountSpeed, casting, jump, defense, aggro, foodType)
--
-- So, the parameters it takes are:
--
-- ---------------------------------------------
-- Parameter | Details
-- ---------------------------------------------
-- luck | use luck pot? true/false
-- speed | use running speed pot? true/false
-- mountSpeed | use mount speed pot? true/false
-- casting | use casting pot? true/false
-- jump | use jump pot? true/false
-- defense | use defense pot? true/false
-- aggro | use aggro generation pot? true/false
-- foodType | what type of food to use? * For this one I wrote a helper function to
-- determine if you want Physical/Magic enhancing food - this is called
-- determineFoodTypeToBuff() and will choose it based on your primary
-- class only. Otherwise specify SPECIAL_TYPES_PHYSICAL for physical food
-- or SPECIAL_TYPES_SPELL for magical food.
-- ---------------------------------------------
--
-- so in my original example, if I am a scout/mage:
-- buffUp(true, true, false, true, false, true, false, determineFoodTypeToBuff());
-- will use luck pots, speed pots, casting pots, defense pots, and a physical food.
------------------------------------------------
I wouldn't call it my function. Actually, I don't remember contributing anything except for maybe pointing out a few things.BillDoorNZ wrote:I made some changes to rocks version of this a while back
yup your getting old, all down hill from hererock5 wrote:Edit: Oh look, I did post a version. I forgot all about it. My memory is not what it used to be.
the plus side of that of course, is that its much easier going downhill ';)lisa wrote:yup your getting old, all down hill from hererock5 wrote:Edit: Oh look, I did post a version. I forgot all about it. My memory is not what it used to be.
Code: Select all
--XP/TP buff items
xpcake = {ID = 202895, buffName = 850473, castTime = 0}, -- wedding cake (+xp/tp)
xppot = {ID = 201134, buffName = 201134, castTime = 0}, -- normal Experience Potion
tppot = {ID = 201610, buffName = 201610, castTime = 0}, -- normal Skill Potion
Code: Select all
if (foodType) then
if (foodType == SPECIAL_TYPES_SPELL) then
if (countGoodie(matt3) > 0) then
useGoodie(matt3);
elseif (countGoodie(mdmg2) > 0) then
useGoodie(mdmg2);
elseif (countGoodie(matt) > 0) then
useGoodie(matt);
elseif (countGoodie(mdmg) > 0) then
useGoodie(mdmg);
else
printf("Count not apply spell food buff as you do not have any spell food!\n");
end;
elseif (foodType == SPECIAL_TYPES_PHYSICAL) then
if (countGoodie(patt3) > 0) then
useGoodie(patt3);
elseif (countGoodie(patt2) > 0) then
useGoodie(patt2);
elseif (countGoodie(critp) > 0) then
useGoodie(critp);
elseif (countGoodie(pdmg) > 0) then
useGoodie(pdmg);
else
printf("Count not apply physical food buff as you do not have any physical food!\n");
end;
else
printf("An invalid food type was specified for the buffUp function, should be physical/spell (1 and 2 respectively)\n");
end;
end;
Code: Select all
if (foodType) then
if (foodType == SPECIAL_TYPES_SPELL) then
if (countGoodie("matt3") > 0) then
useGoodie("matt3");
elseif (countGoodie("mdmg2") > 0) then
useGoodie("mdmg2");
elseif (countGoodie("matt") > 0) then
useGoodie("matt");
elseif (countGoodie("mdmg") > 0) then
useGoodie("mdmg");
else
printf("Count not apply spell food buff as you do not have any spell food!\n");
end;
elseif (foodType == SPECIAL_TYPES_PHYSICAL) then
if (countGoodie("patt3") > 0) then
useGoodie("patt3");
elseif (countGoodie("patt2") > 0) then
useGoodie("patt2");
elseif (countGoodie("critp") > 0) then
useGoodie("critp");
elseif (countGoodie("pdmg") > 0) then
useGoodie("pdmg");
else
printf("Count not apply physical food buff as you do not have any physical food!\n");
end;
else
printf("An invalid food type was specified for the buffUp function, should be physical/spell (1 and 2 respectively)\n");
end;
end;
Code: Select all
if (foodType) then
Code: Select all
if (foodType == SPECIAL_TYPES_SPELL) then
Code: Select all
elseif (foodType == SPECIAL_TYPES_PHYSICAL) then
if (countGoodie("patt3") > 0) then
useGoodie("patt3");
elseif (countGoodie("patt2") > 0) then
useGoodie("patt2");
elseif (countGoodie("critp") > 0) then
useGoodie("critp")
Code: Select all
if foodtype then
if foodtype == TYPE_SPELL then
-- use spell type goodies.
if foodtype == TYPE_PHYSICAL then
-- use physical goodies.
else
-- must have used an invalid value for 'foodtype'
end
end
Code: Select all
if (countGoodie("patt3") > 0) then
useGoodie("patt3");
elseif (countGoodie("patt2") > 0) then
useGoodie("patt2");
end
if (countGoodie("critp") > 0) then
useGoodie("critp");