file_to_map and "au jus gezund heit"

fronobulax

Developer
Staff member
So I am writing a variation on EatDrink from scratch so I understand it ;-) I am building it up from small pieces and am working on a piece that reads in the mafia datafiles fullness.txt, inebriety.txt and spleenhit.txt using file_to_map. When I look at the size of the resulting map it is less than the number of lines in the input file, even accounting for comments and the version identifier. The first item I identified that was in the file but not my map was "au jus gezund heit" from fullness.

For giggles, I made a version of fullness.txt that just had three lines:
Code:
1
au jus gezund heit	4	1	4-6	0	0	0

When I read it and print out the contents of the map, I get "none" rather than "au jus gezund heit". I get "none" whether I call print with the item or to_string of the item.

Any ideas about what makes "au jus gezund heit" special? I can't find any special processing for the item and don't know why the fact that it is a Chez Snootee item should make a difference. I am running my test when I am not logged in but it doesn't make sense that file I/O would be "censored" based upon the player/game state at the time of reading. I don't think the fact that there are three spaces in the item name matters since other items with three or more spaces are fine.

I'm not posting my code (now) because it is a little fussy because it has to define records for the I/O. The fact that all of the spleen items do appear in my map suggests that the code is probably right and this is an issue with specific items and my understanding.

Ideas? Usually when I get to this point it turns out I am just missing something obvious.

Thanks.
 
au jus gezund heit is not an item; it has no item number and you cannot have it in your inventory.
 
au jus gezund heit is not an item; it has no item number and you cannot have it in your inventory.

So my problem is that I am reading it (fullness.txt) into a map indexed by item? I suppose for my purposes I should use a string as an index and then, at some point, filter out indices that begin with a "#" since that means they were commented out in the file.

Thank you.
 
I'm going to append this here, even if it might be worthy of a new topic. The trigger for this was converting the strings in the map to items, when possible.
This code
Code:
record tr {
   string a;
   string b;
};
tr[string] test;
test["Hatorade"].a="hatorade a";
test["Hatorade"].b="hatorade b";
item itx;
foreach it in test {
   print(it);
   print(test[it].a);
   print(test[it].b);
   print($item[it]);
   itx = $item[it];
   print(itx);
   print($item[Hatorade]);
   print($item["Hatorade"]);
}
generates the following output.
Hatorade
hatorade a
hatorade b
Item #13
Item #13
Hatorade
Hatorade

I would expect the two Item #13s to be Hatorade. The fact that they are not confuses me since I am expecting that the implicitly declared foreach variable "it" would be a string in this instance. That does not seem to be the case.

What am I missing or what am I assuming that is not true?

Thanks again. My brain still seems to be addled with Thanksgiving turkey.
 
$item[xxx] is a compile-time constant that looks up exactly the string xxx in the item list. NOT whatever is in variable xxx. You want to do that, use to_item().
 
Back
Top