Talk:To item

From Kolmafia
Revision as of 06:48, 16 September 2010 by imported>Bale
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Surprisingly, to_item() works on familiars, but with unexpected results. For many familiars, it returns the hatchling of the given familiar:

Fuzzy Dice, Spooky Pirate Skeleton, Barrrnacle, Blood-Faced Volleyball, Star Starfish, Hovering Sombrero, Ghost Pickle on a Stick, Jill-O-Lantern, Hand Turkey, Hanukkimbo Dreidl, Baby Yeti, Clockwork Grapefruit, Inflatable Dodecapede, Pygmy Bugbear Shaman, Attention-Deficit Demon, Cymbal-Playing Monkey, Sweet Nutcracker, Pet Rock, Snowy Owl, Teddy Bear, Ninja Pirate Zombie Robot, Wind-up Chattering Teeth, Astral Badger, Comma Chameleon, Misshapen Animal Skeleton, Scary Death Orb, Jitterbug, Nervous Tick, Reassembled Blackbird, Evil Teddy Bear, Toothsome Rock, Dandy Lion, O.A.F., Exotic Parrot, Wizard Action Figure, Casagnova Gnome, Hunchbacked Minion, Crimbo P. R. E. S. S. I. E., Bulky Buddy Box, Teddy Borg, RoboGoose, El Vibrato Megadrone, Adorable Seal Larva, Hobo Monkey, Uniclops, Psychedelic Bear, Mutant Fire Ant, Mutant Cactus Bud, Mutant Gila Monster, Cuddlefish, Pair of Ragged Claws, Magic Dragonfish, Midget Clownfish, Syncopated Turtle, Grinning Turtle, Wereturtle, Rock Lobster, Chauvinist Pig, Jack-in-the-Box, Pottery Barn Owl

However, there were several interesting exceptions:

Mosquito => tiny plastic mosquito
Levitating Potato => tiny plastic levitating potato
Angry Goat => tiny plastic angry goat
Howling Balloon Monkey => tiny plastic howling balloon monkey
Grue => tiny plastic grue
Baby Gravy Fairy => tiny plastic baby gravy fairy
Cocoabo => tiny plastic cocoabo
Coffee Pixie => tiny plastic coffee pixie
Cheshire Bat => tiny plastic Cheshire bat
MagiMechTech MicroMechaMech => stuffed MagiMechTech MicroMechaMech
Flaming Gravy Fairy => stuffed flaming gravy fairy
Frozen Gravy Fairy => stuffed frozen gravy fairy
Stinky Gravy Fairy => stuffed stinky gravy fairy
Spooky Gravy Fairy => stuffed spooky gravy fairy
Sleazy Gravy Fairy => stuffed sleazy gravy fairy
Ancient Yuletide Troll => tiny plastic ancient yuletide troll
Stocking Mimic => tiny plastic stocking mimic

Perhaps they are chosen by matching the familiar name with the item name. For reference, the list of familiars for whom to_item() returns nothing:

Leprechaun, Sabre-Toothed Lime, Stab Bat, Ghuol Whelp, Killer Bee, Whirling Maple Leaf, Crimbo Elf, Feather Boa Constrictor, Emo Squid, Personal Raincloud, Doppelshifter, Temporal Riftlet, Wild Hare, Spirit Hobo, Origami Towel Crane, Ninja Snowflake, Penguin Goodfella, Jumpsuited Hound Dog, Green Pixie, Ragamuffin Imp, Gluttonous Green Ghost, Mad Hatrack, Untamed Turtle, Animated Macaroni Duck, Pet Cheezling, Autonomous Disco Ball, Mariachi Chihuahua, Llama Lama, Cotton Candy Carnie, Disembodied Hand, Black Cat, Baby Mutant Rattlesnake, Sugar Fruit Fairy, Imitation Crab, Frumious Bandersnatch, Purse Rat, Baby Sandworm, Slimeling, He-Boulder, Urchin Urchin, Grouper Groupie, Squamous Gibberer, Dancing Frog, Snow Angel, BRICKO chick, Baby Bugged Bugbear, Underworld Bonsai, Rogue Program, Mini-Hipster

That's weird, though. If to_item() is actually using the familiar name to match the item, why does it return $item[none] for the Leprechaun (tiny plastic leprechaun, leprechaun hatchling) or the Stab Bat (rewinged stab bat, tiny plastic stab bat)? Another mysterious quirks of ASH. --PhilmASTErpLus 00:58, 16 September 2010 (UTC)


You're overanalyzing a very simple problem. It's just fuzzy matching. $item[] is attempting to fuzzy match an item name. In many cases the familiar hatchling will match the partial name. For instance barrrnacle and star starfish are the names of both the familiar and the hatchling, differentiated only by upper-case letters for the familiar. In those cases it produces a familiar hatchling. IF it doesn't match anything, like BRICKO chick (whose hatchling is a BRICKO egg) then it returns $item[none]. The problem with $item[Leprechaun] is that it could match either the tiny plastic leprechaun, leprechaun hatchling so it returns $item[none]. I suspect that is what is going on. --Bale 05:54, 16 September 2010 (UTC)

Forgot to mention one important thing. In case you're wondering why to_item() would do fuzzy matching on a $familiar, please note that the parameter is a string. The familiar's name is converted to a string and then that string is converted to an item. Ta-Daa! --Bale 06:48, 16 September 2010 (UTC)