-
Notifications
You must be signed in to change notification settings - Fork 27
Keyword
MAS allows several keywords to be used in config files. These keywords provide values that would be difficult or impossible to provide in other ways. Each keyword is listed below, along with where it's valid and why you may want to use it.
The %AUTOID%
keyword tells MAS to generate a string comprised of the current props name and ID. The intent of this keyword is to make a unique name for a persistent variable when a specific name isn't required, such as for a dummy switch (irrelevant fields omitted for clarity):
MODULE
{
name = MASComponent
COLLIDER_EVENT
{
onClick = fc.TogglePersistent("%AUTOID%")
...
}
ANIMATION_PLAYER
{
variable = fc.GetPersistentAsNumber("%AUTOID%")
...
}
}
This configuration will toggle the animation on or off each time the switch is clicked. A similar trick can be used to make a momentary button:
MODULE
{
name = MASComponent
COLLIDER_EVENT
{
onClick = fc.SetPersistent("%AUTOID%", 1)
onRelease = fc.SetPersistent("%AUTOID%", 0)
...
}
ANIMATION_PLAYER
{
variable = fc.GetPersistentAsNumber("%AUTOID%")
...
}
}
The keyword can be part of a string, eg fc.TogglePersistent("%AUTOID%-value1")
, if multiple variables need to be tracked on the same prop. The %AUTOID%
keyword is a simple string substitution, so it should only be used within quotation marks.
Be aware that if the order of props in an IVA is changed, or props are added or removed, the automatic ID for the props may change.
The %FLAG%
keyword tells MAS to use the current part's flagURL for the texture. Most of the time, the flagURL is the flag that was set for the part when the craft was launched. You can use this keyword to display the flag texture on a MASMonitor using the IMAGE page node, or you can use it on other props with the MASComponent IMAGE node.
The %PROPID%
keyword only provides the prop ID, which is a number that tells you the index of the prop in the IVA's config. It provides a shorter unique identifier for a given prop. Be aware that if the order of props in an IVA is changed, or props are added or removed, the prop ID for props may change.