have_effect() not working in 8.1?

bismuth

New member
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

Member
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.
 

Sako

Member
Still no fix for this? My script keeps waiting for Ode to Booze, with or without the "the", using 8.1.
 

macman104

Member
[quote author=Sako link=topic=235.msg1277#msg1277 date=1151745310]
Still no fix for this? My script keeps waiting for Ode to Booze, with or without the "the", using 8.1.
[/quote]Can you attach your script so we can see it all? In it's entirety?
 

Sako

Member
Code:
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.
 
Top