That FN Ninja
Member
Okay, so I've been trying to learn more about maps and I'm trying to make my first multi-dimensional map! I was going with an outfit item map and I've got this:
which works as expected, but I realize that mafia has an outfits.txt so I tried to utilize file_to_map without any success. I tried this:
That just generated an unexpected error. I assume because some outfits would be missing the third key, like the Bugbear Costume in the above example. I also tried:
That did generate a map, but it was very weird and the keys didn't necessarily correspond to the outfit. Again I assume it was because of a lot of outfits having a third item. Anyways, I'm just trying to find out if there is a way to use file_to_map with the outfits.txt to generate a map that follows the syntax of my first example before I spend all that time typing everything all out.
Also, speaking of maps, I don't really understand the record function. I've been looking through several scripts, but am not sure how it works, or when it's required. Thanks for everyones patience with me while I'm learning my very first scripting/programming language - ASH!
Code:
string[item, item, item] outfititems;
outfititems[$item[bugbear beanie], $item[bugbear bungguard], $item[none]] = "Bugbear Costume";
foreach key1, key2, key3, attire in outfititems{
if(key3 == $item[none])
print("The outfit " +attire+ " consists of these items: " +key1+ " & " +key2);
else
print("The outfit " +attire+ " consists of these items: " +key1+ " & " +key2+ " & " +key3);
}
which works as expected, but I realize that mafia has an outfits.txt so I tried to utilize file_to_map without any success. I tried this:
Code:
string[item, item, item] outfititems;
file_to_map("outfits.txt",outfititems);
foreach key1, key2, key3, attire in outfititems{
if(key3 == $item[none])
print("The outfit " +attire+ " consists of these items: " +key1+ " & " +key2);
else
print("The outfit " +attire+ " consists of these items: " +key1+ " & " +key2+ " & " +key3);
}
That just generated an unexpected error. I assume because some outfits would be missing the third key, like the Bugbear Costume in the above example. I also tried:
Code:
string[item, item, item] outfititems;
file_to_map("outfits.txt",outfititems);
foreach key1, key2, attire in outfititems{
print("The outfit " +outfititems[key1,key2]+ " consists of these items: " +key1+ " & " +key2);
}
That did generate a map, but it was very weird and the keys didn't necessarily correspond to the outfit. Again I assume it was because of a lot of outfits having a third item. Anyways, I'm just trying to find out if there is a way to use file_to_map with the outfits.txt to generate a map that follows the syntax of my first example before I spend all that time typing everything all out.
Also, speaking of maps, I don't really understand the record function. I've been looking through several scripts, but am not sure how it works, or when it's required. Thanks for everyones patience with me while I'm learning my very first scripting/programming language - ASH!