AlvitrValkyrie
Member
I've got a diet script.
As you can see, the code gets a little redundant when it comes to sliders, forks, etc. Is it possible to tell the code to do a set of actions multiple times? IN what ways can I make the code faster?
Code:
void main ()
{
#### Obtain Ode to Booze for drinking.
## Modify by sending the right meat amount to your buffBot of choice.
if(have_effect($effect[Ode to Booze]) < 1)
{
cli_execute("csend 1 meat to Testudinata");
}
#### Wait for the buff to appear.
if(have_effect($effect[Ode to Booze]) < 1)
{
repeat {wait(5); refresh_status();}
until (have_effect($effect[Ode to Booze]) > 1);
}
#### Buy/Use [Potion] Milks of Magnesia
if(item_amount($item[Milk of Magnesium]) < 2)
{
buy( 2 - item_amount( $item[Milk of Magnesium]) , $item[Milk of Magnesium]);
}
use(2, $item[Milk of Magnesium]);
#### Buy [Usable] Ol' Scratch's salad forks
if(item_amount($item[Ol' Scratch's salad fork]) < 3)
{
buy( 3 - item_amount($item[Ol' Scratch's salad fork]) , $item(Ol' Scratch's salad fork);
}
#### Buy [Usable] Munchies Pills
if(item_amount($item[Munchies Pill]) < 3)
{
buy( 3 - item_amount($item[Munchies Pill]) , $item(Munchies Pill);
}
#### Buy [Usable] Frosty's frosty mugs
if(item_amount($item[Frosty's frosty mug]) < 5)
{
buy( 5 - item_amount($item[Frosty's frosty mug]) , $item(Frosty's frosty mug);
}
#### Buy [Usable] Scrolls of Drastic Healing
if(item_amount($item[Scroll of Drastic Healing]) < 8)
{
buy (8 - item_amount($item[Scroll of Drastic Healing]) , &item(Scroll of Drastic Healing);
}
#### Buy [Food] Extra-Greasy Sliders
if(item_amount($item[Extra-Greasy Slider]) < 3)
{
buy( 3 - item_amount($item[Extra-Greasy Slider]) , $item[Extra-Greasy Slider]);
}
#### Buy [Booze] Jars of Fermented Pickle Juice & Hodgman's Blankets
if(item_amount($item[Jar of Fermented Pickle Juice]) < 3)
{
buy( 3 - item_amount($item[Jar of Fermented Pickle Juice]) , $item[Jar of Fermented Pickle Juice]);
}
if(item_amount($item[Hodgman's blanket]) < 2)
{
buy( 2 - item_amount($item[Hodgman's blanket]) , $item[Hodgman's Blanket]);
}
#### Buy [Usable] Prismatic Wads
if(item_amount($item[Prismatic Wad]) < 15)
{
buy( 15 - item_amount($item[Prismatic Wad]) , $item[Prismatic Wad]);
}
#### Use [Usable] 5 Prismatic Wads.
use(5, $item[Prismatic Wad]);
#### Eat [Food] Extra-Greasy Sliders w/forks/munchies
use(1, $item[Munchies Pill]);
use(1, $item[Ol' Scratch's salad fork]);
eat(1, $item[Extra-Greasy Slider]);
use(1, $item[Scroll of Drastic Healing]);
use(1, $item[Munchies Pill]);
use(1, $item[Ol' Scratch's salad fork]);
eat(1, $item[Extra-Greasy Slider]);
use(1, $item[Scroll of Drastic Healing]);
use(1, $item[Munchies Pill]);
use(1, $item[Ol' Scratch's salad fork]);
eat(1, $item[Extra-Greasy Slider]);
use(1, $item[Scroll of Drastic Healing]);
#### Use [Usable] 5 Prismatic Wads.
use(5, $item[Prismatic Wad]);
#### Drink [Booze] Jars of Fermented Pickle Juice & Hodgman's Blanket w/mugs
use(1, $item[Frosty's frosty mug]);
drink(1, $item[Jar of Fermented Pickle Juice]);
use(1, $item[Scroll of Drastic Healing]);
use(1, $item[Frosty's frosty mug]);
drink(1, $item[Jar of Fermented Pickle Juice]);
use(1, $item[Scroll of Drastic Healing]);
use(1, $item[Frosty's frosty mug]);
drink(1, $item[Jar of Fermented Pickle Juice]);
use(1, $item[Scroll of Drastic Healing]);
use(1, $item[Frosty's frosty mug]);
drink(1, $item[Hodgman's Blanket]);
use(1, $item[Scroll of Drastic Healing]);
use(1, $item[Frosty's frosty mug]);
drink(1, $item[Hodgman's Blanket]);
use(1, $item[Scroll of Drastic Healing]);
#### Use [Usable] 5 Prismatic Wads.
use(5, $item[Prismatic Wad]);
#### This will print the message in the ""
print("Blargh blargh blargh.");
}
As you can see, the code gets a little redundant when it comes to sliders, forks, etc. Is it possible to tell the code to do a set of actions multiple times? IN what ways can I make the code faster?