zarqon
Well-known member
string_modifier($item[class-specific skill book],"Class") should return a class
While writing a little scriptlet to deal with skill books after breaking the prism, I ran afoul of the Traveling Trader books being class-specific. Trying to use them causes mafia to print a "(usable quantity of Uncle Romulus is limited to 0 by your class)" message. However, I couldn't seem to find any way of detecting this information in ASH so as to avoid using impossible books. I could hardcode a list, but I was fairly sure mafia has some kind of framework for knowing these sorts of things.
A quick look at modref revealed a string modifier called "Class". Aha! However, for each class-specific Traveling Trader book, Both string_modifier(i, "Class") and class_modifier(i,"Class") returned "" and $class[none], respectively. (Those methods seem to be identical other than return type, by the way (both return positive results for the same number of items). And while we're here, why is there a second parameter for class_modifier()? Is it ever anything other than "Class"? Perhaps I am -- once again -- missing something?)
I wasn't sure whether to call this a feature request or a bug, so I looked more closely at the 143 items with positive results. The overwhelming majority of them are equipment, so at first I thought I might be requesting new functionality. However! While 142 of the 143 items are equipment, 1 of them is a usable item! Yes, the experimental carbon fiber pasta additive returns "Pastamancer", and thus the precedent is established and this must therefore be a bug.
Anyway, I would find it handy if the Traveling Trader books (and their used variants) had the appropriate class modifier. Thanks!
While writing a little scriptlet to deal with skill books after breaking the prism, I ran afoul of the Traveling Trader books being class-specific. Trying to use them causes mafia to print a "(usable quantity of Uncle Romulus is limited to 0 by your class)" message. However, I couldn't seem to find any way of detecting this information in ASH so as to avoid using impossible books. I could hardcode a list, but I was fairly sure mafia has some kind of framework for knowing these sorts of things.
A quick look at modref revealed a string modifier called "Class". Aha! However, for each class-specific Traveling Trader book, Both string_modifier(i, "Class") and class_modifier(i,"Class") returned "" and $class[none], respectively. (Those methods seem to be identical other than return type, by the way (both return positive results for the same number of items). And while we're here, why is there a second parameter for class_modifier()? Is it ever anything other than "Class"? Perhaps I am -- once again -- missing something?)
I wasn't sure whether to call this a feature request or a bug, so I looked more closely at the 143 items with positive results. The overwhelming majority of them are equipment, so at first I thought I might be requesting new functionality. However! While 142 of the 143 items are equipment, 1 of them is a usable item! Yes, the experimental carbon fiber pasta additive returns "Pastamancer", and thus the precedent is established and this must therefore be a bug.

Anyway, I would find it handy if the Traveling Trader books (and their used variants) had the appropriate class modifier. Thanks!