PDA

View Full Version : use_skill returns true on auto-recovery failure



Metraxis
11-09-2006, 04:32 PM
Build 2295:

My self-buffing code has this snippet in it:



while(have_effect(TEffect) < turns && flag) {
flag = use_skill(1, TSkill);
}
return (have_effect(TEffect) >= turns);


Unfortunately, it is not behaving as I intend.

My intent is for this snippet to keep casting the skill until I have the target number of turns of the effect, but to stop if it fails to cast the skill (for example, because I have run out of meat and cannot afford any more mmj.)

However, use_skill() seems to return true even if it is unable to cast the skill due to autorecovery failure. So is this a bug, or am I just being stupid?

Friedfisch
11-09-2006, 06:24 PM
i guess you might try this one:

while ((have_effect(TEffect) < turns) && flag)

Metraxis
11-11-2006, 08:06 PM
I actually tried that, and it didn't help. A little creative print() ing showed that use_skill() seems to always return true, even if there was not enough mp to cast the skill. I worked around the problem by checking after each cast to be sure that I had more turns of the effect than before.

holatuwol
11-12-2006, 10:41 AM
I actually tried that, and it didn't help. A little creative print() ing showed that use_skill() seems to always return true, even if there was not enough mp to cast the skill. I worked around the problem by checking after each cast to be sure that I had more turns of the effect than before.


Not entirely true; there are a lot of spellcasting failures that will result in a false value. However, auto-recovery was not considered a spellcasting failure (it was considered an internal error) and therefore it should have caused a script abort ... except you were storing the value which reset that flag. I don't have a multi to test the fix (I tend to be well-stocked on MP restores), but you should be seeing false come back when auto-recovery fails in the next release.

Metraxis
11-13-2006, 06:42 PM
Much appreciated.