PDA

View Full Version : illarion's healing script v1.0 (ASH)



illarion
03-27-2006, 09:33 PM
Nice work Daychilde. I've been thinking about suggesting something like this for a while. Meant to reply in the mafia thread, but I've been tres busy :(

Anyway, here's my current full heal script, still WIP:

( Attached at bottom... -Daychilde ;D )



#restores HP using Med.Herbs if possible,
#drastic scroll if available, else ointment, without
#wastage.
#
#no safety check for available meat, or guild being opened.
#
#Written by Illarion/Aaron Gunstone, March 2006
#Based on ASH tutorial by Xylpher

void use_galaktik( int amount)
{
if( item_amount( $item[Doc Galaktik's Ailment Ointment]) < amount)
{
buy( amount - item_amount( $item[Doc Galaktik's Ailment Ointment]), $item[Doc Galaktik's Ailment Ointment]);
}
use( amount, $item[Doc Galaktik's Ailment Ointment]);
}

void heal_galaktik()
{
while( my_maxhp() > my_hp())
{
int toheal;
int amount;
toheal = my_maxhp() - my_hp();
amount = toheal / 10;
if( amount == 0)
{
break;
}
use_galaktik( amount);
}
}

boolean heal_herbs()
{
if( item_amount( $item[Medicinal Herb's medicinal herbs]) < 1)
{
buy( 1, $item[Medicinal Herb's medicinal herbs]);
}
use( 1, $item[Medicinal Herb's medicinal herbs]);

cli_execute( "status refresh");
if (my_hp() == my_maxhp())
{
return true;
}
else
{
return false;
}
}

boolean heal_scroll()
{
if( can_interact() && (item_amount( $item[scroll of drastic healing]) == 0))
{
buy( 1, $item[scroll of drastic healing]);
}

if( item_amount( $item[scroll of drastic healing]) > 0)
{
return use( 1, $item[scroll of drastic healing]);
}
}

string main()
{
string retval;
boolean useHerbs;
useHerbs = false;
cli_execute( "status refresh");
if( my_class() == $class[turtle tamer] || my_class() == $class[seal clubber])
{
useHerbs = true;
}
if( my_class() == $class[accordion thief] && my_level() >= 9)
{
useHerbs = true;
}
if( useHerbs)
{
if (heal_herbs())
{
retval = "healed with herbs";
}
else
{
useHerbs=false;
}
}

if (!useHerbs)
{
if (heal_scroll())
{
retval = "healed with scroll";
}
else
{
heal_galaktik();
if ((my_maxhp() - my_hp()) > 10)
{
retval = "failed to heal";
}
else
{
retval = "healed with Ointment";
}

}
}
return retval;
}

bjorfrend
06-21-2006, 02:37 PM
wanna use both illarion's HP and MP restore scripts? add this:



import <Illarion - Healing Script.ash>;
import <Illarion - Mana Restore Script.ash>;

string main()
{
string retVal;

retval = MPmain();
retval = "MP: " + retval + " HP: " + HPmain();

return retval;
}



to a new script file. The one I use is attached.

Sako
06-25-2006, 01:44 PM
You might want to add a check on the beaten up effect.

if (have_effect($effect[beaten up]) > 0)
{
if (item_amount($item[soft green echo eyedrop antidote]) < 1)
{
buy(1, $item[soft green echo eyedrop antidote]);
}
}

if (have_effect($effect[beaten up]) > 0)
{
cli_execute("uneffect beaten up");
}

Maybe off-topic... why do level 9 accordion thieves have access to herbs?

Presto Ragu
06-25-2006, 05:55 PM
Maybe off-topic... why do level 9 accordion thieves have access to herbs?


It is an inherent class ability. AT's higher than level 8 can sneak into every class store.