PDA

View Full Version : have_effect() not working in 8.1?



bismuth
06-21-2006, 07:17 AM
Hi!

I have a drinking script that basically does the following:

cli_execute("send 1 meat to Testudinata");
int max_iterations = 10;
int cur_iteration = 0;
while((cur_iteration < max_iterations) &&
(!ode_obtained))
{
cur_iteration = cur_iteration + 1;
cli_execute("wait 30");
cli_execute("effects refresh");
ode_obtained = (have_effect($effect[ode to booze]) > 0);
}
if (ode_obtained)
{
//some code that selects a stat optimal DB drink from the available drinks
//and drinks that untill hammered
}
else
{
print("No ode, no drinks for you boyo");
}

When I look at Kolmafia executing this script I see that:
1. The active effects page at some point (usually after the first "effects refresh") shows I have ode to booze.
2. Kolmafia doesn't see that, keeps looping and ends without drinking anything.

Where does this go wrong?
My first thought is that have_effect() doesn't work as I expected, but it could also have something to do with the synchronization of data after the cli_execute("effects refresh"); line.

anyone know what I am doing wrong? or should I file a bug report on this?

macman104
06-21-2006, 08:21 AM
It's been noted on the main forums, holatuwol was anticipating that ode to booze would be changed like some of the other skills to have "The" in front, so he made a pre-emptive change. However, that change has not happened, so mafia doesn't recognize it. While the new names are settling in, it's suggested, that you may want to manually do some of that stuff.

bismuth
06-22-2006, 11:24 AM
Ah I see, thanks!

Sako
07-01-2006, 09:15 AM
Still no fix for this? My script keeps waiting for Ode to Booze, with or without the "the", using 8.1.

macman104
07-01-2006, 05:38 PM
Still no fix for this? My script keeps waiting for Ode to Booze, with or without the "the", using 8.1.
Can you attach your script so we can see it all? In it's entirety?

Sako
07-02-2006, 08:40 AM
void CheckOde(int x)
{
int iterations;

if (have_skill($skill[The Ode To Booze]))
{
if (have_effect($effect[Ode To Booze]) < 1)
{
restoreMP(50);
use_skill(1, $skill[The Ode To Booze]);
}
}
else
{
if (have_effect($effect[Ode To Booze]) < 1)
{
if (x == 1)
cli_execute("send 1 meat to Testudinata");
if (x == 2)
cli_execute("send 11 meat to Testudinata");

iterations = 0;
while (have_effect($effect[Ode to Booze]) < 1)
{
if(iterations > 3)
{
break;
}
cli_execute("wait 30");
cli_execute("effects refresh");
iterations = (iterations + 1);
}
}
}
}
Here is the Ode-related part. The script doesn't recognize I have an active Ode effect, and keeps looping all the iterations.

holatuwol
07-02-2006, 09:39 AM
Go into the gCLI, type "update" and restart KoLmafia. Then try the script again.

Sako
07-03-2006, 09:44 AM
I see... it's working fine now. Thanks!