Syntax Question

Metraxis

Member
The information about maps at wiki.kolmafia.us is spare, so I have the following question:

If I wish to create a map of maps, is the syntax: type [type] [type] or type [type,type]?

Example:
I wish to do this:
Code:
boolean disguised;
if(count(Disguises[WorldState.CurrentGoal.area]) > 0) {
  disguised = true;
} else {
  diguised = false;
}

if(disguised) {
  foreach Thing in Disguises[WorldState.CurrentGoal.area] {
    if(!have_equipped(Thing) { disguised = false; }
  }
}

What should the declaration of the Disguises Map look like? The key to Disguises would be location, the key in each submap would be item, and the values would be throwaway ints.
 

macman104

Member
I wonder, is Veracity's starter intro thingy to Maps over here, or on sourceforge. Metraxis it might be on the sourceforge manual.
 

Veracity

Developer
Staff member
[quote author=Metraxis link=topic=640.msg3008#msg3008 date=1166299962]If I wish to create a map of maps, is the syntax: type [type] [type] or type [type,type]?[/quote]
The latter.

What should the declaration of the Disguises Map look like?  The key to Disguises would be location, the key in each submap would be item, and the values would be throwaway ints.
Try this:

Code:
int [ location, item ] Disguises;

boolean disguised = ( count(Disguises[WorldState.CurrentGoal.area]) > 0 );

if (disguised) {
  foreach Thing in Disguises[WorldState.CurrentGoal.area] {
    if (!have_equipped(Thing) {
      disguised = false;
      break;
    }
  }
}
 

Metraxis

Member
Aha! I was not aware that there was additional documentation on sourceforge that had not made the jump to the wiki. This will be most useful.
 
Top