macman104
Member
I decided to begin work on a script that would determine how many days till stat days, and some other fun things, mainly for my own enjoyment, and because I wanted to keep playing around with maps and such. I tried to make the following script, but I get the message "Index type 'day' is not a primitive type (MoonTest.ash, line 7)". Can we not index by records like that? Do I just need to use a map like this instead of the record?
I wanted to use the record, just because it was cleaner and easier to work with. Is this not possible, or am I missing something? I need to index by the days, and not by the stats since eventually, I'm also going to have moons in there that are indexed to a $stat[none] type as well...
Script:
Code:
stat [string, string] moonList
Script:
Code:
record day
{
string ronald;
string grimace;
};
stat [day] moonList;
stat moxie = $stat[moxie];
stat muscle = $stat[muscle];
stat myst = $stat[mysticality];
day makeDay(String ronald, String grimace)
{
day newDay;
newDay.ronald = ronald;
newDay.grimace = grimace;
return newDay;
}
void main()
{
moonList[makeDay("moon1.gif", "moon1.gif")] = moxie;
moonList[makeDay("moon8.gif", "moon8.gif")] = moxie;
moonList[makeDay("moon5.gif", "moon3.gif")] = myst;
moonList[makeDay("moon5.gif", "moon7.gif")] = myst;
moonList[makeDay("moon1.gif", "moon5.gif")] = muscle;
moonList[makeDay("moon2.gif", "moon5.gif")] = muscle;
map_to_file(moonList, "moonMap.txt");
}