-
Notifications
You must be signed in to change notification settings - Fork 11
Comments
Comments allow you to add text to a script that will not be executed. Typically they are used to better describe what a portion of the code is doing. RAScript uses a double slash to indicate the start of a comment. When a double slash is encountered, the rest of the line is ignored by the interpreter.
// This is a comment
// The comment is continued here
// This function will do something
code()
my_var = func(3) // func(4) wasn't working
RAScript supports special comments at the top of the file that provide additional context to the interpreter.
The first comment is assumed to be the game name. Somewhere in the next few lines, an "#ID" comment must be present so the interpreter can find the associated game data from one of the RACaches. Any non-comment after the first comment will end the header comment block.
// Super Mario Bros.
// #ID=1446
By default, RATools will try to generate achievement code using the oldest functionality available for the largest compatibility with old versions of emulators. For example, if your logic is only comparisons, and you have an achievement with a large number of ORs in it, it will cross-multiply those OR clusters into Alt Groups to support versions of emulators that don't have OrNext. If something in your script is using a syntax feature that's at least as recent as OrNext (like Trigger), then it is more likely to use OrNext over creating Alt groups. It may still create Alt groups for simply OR clauses.
To specify a minimum feature set without actually using it, you can use the #MinimumVersion
header comment. It can go anywhere in the first set of comments after the game title. For consistency, it's recommended to keep the #ID
next to the title.
// Super Mario Bros.
// #ID=1446
//
// OrNext was introduced in 0.78. This tells the interpreter to prefer OrNext over cross-multiplying conditions.
// #MinimumVersion=0.78
You can also specify versions above your minimum version. Using the above example, you could have also said #MinimumVersion=1.0
.
A list of per-version features is available here.
Note: RATools will not automatically force a minimum version even if it's severely outdated. This ensures scripts written several years ago still generate the same output (or at least something reasonably close). If we assumed the minimum version was whatever was released two years ago, scripts older than two years could start generating significantly different output, which makes it slightly more difficult to work any tickets that might arise.