Bug - Not A Bug Undefinded function with recent mafia builds

Ethelred

Member
After upgrading to KoLmafia-19890 (from KoLmafia-19885), I was unable to run my daily script due the the error msg:

Code:
Function 'int_to_string( int )' undefined. This script may require a more recent version of KoLmafia and/or its supporting scripts. (TPSDrink.ash, line 279)

I tried again with KoLmafia-19891, but still no luck. Has that function been deleted? Checking the kolmafia wiki, it looks like I could/should replace it with the more generic function to_string( any ). Will int_to_string( int ) be returning? Or do I need to update my code?

Thanks KoLmfia devs for all the work you do updating and maintaining KoLmafia. I couldn't bear to play KoL without it.
 

gausie

D̰͕̝͚̤̥̙̐̇̑͗̒e͍͔͎͈͔ͥ̉̔̅́̈l̠̪̜͓̲ͧ̍̈́͛v̻̾ͤe͗̃ͥ̐̊ͬp̔͒ͪ
Staff member
Support for that super old style was removed in r19887. You can stay on r19886 if you like or, as you suggested, update to using to_string!
 

Veracity

Developer
Staff member
There is no function named "int_to_string". There was code that noticed that such a function was not defined and stripped off everything in front of "to_string" and just returned to_string. That means you could have "boogers_to_string" and it would "work".

I was in there rewriting how we look up functions, and that irritated me, so I removed the kludge. I was hoping that very few ancient scripts still used that. Apparently, there still are some.

I suggest/request that you update your script. I don't want to reinstate the kludge.

Sorry/Thank you.
 
So I guess that applies to "Function 'string_to_int( string )' undefined. This script may require a more recent version of KoLmafia and/or its supporting scripts. (auto_mushroom.ash, line 482)" as well.
Looks like the mushroom plot script generator still uses that function. As for auto_mushroom, I'll just make local changes.
 

Veracity

Developer
Staff member
By the way - the previous behavior hid a bug in my Spacegate script. It had this function:

Code:
typedef int army;

string army_detected_to_string( army a )
{
    return ( ( a & DETECTED ) == DETECTED ) ? "detected" : "not detected";
}

and one of the calls was:

army__detected_to_string( p1_detected )

Notice the two "_". That is a typo. There is no such function. Howver, because of the "compatibility" kludge, I ended up getting to_string( int ) - exactly what I did not want.

I suppose an improved "campatibility" kludge would strip off the prefix only if it were "int_", "string_", and so on, which would not hide typos like that, but it seemed better, to my eye, to remove "temporary" kludges.
 

Veracity

Developer
Staff member
So I guess that applies to "Function 'string_to_int( string )' undefined. This script may require a more recent version of KoLmafia and/or its supporting scripts. (auto_mushroom.ash, line 482)" as well.
I just fixed auto_mushroom.ash. "svn update" will fix it.

Looks like the mushroom plot script generator still uses that function.
Whoah. KoLmafia sure has extensive internal support for your mushroom plot.
I haven't actually owned one for 300 ascensions.

I found the generated ASH script with the obsolete function. I'll fix MushroomManager to not do that. :)
 
Top