Tutorials:Conditionals

From SMTheming Wiki

Jump to: navigation, search

StepMania allows for the use of conditional metrics, which allows you to check for things such as the current song or the checking the date.

Contents

General Things

For those not familiar with conditional metrics, this may seem confusing.

In order to use these, you need to have a Condition= line in your BGAnimation.ini (StepMania 3.9) or a Condition="" attribute in your default.xml/default.lua (StepMania 4.0). Alternatively, in StepMania 4, you can check conditionals inside of a function.

Usage

Generally, you want to check if something is true, false, or a certain value. StepMania uses Lua for the scripting in both versions, although the implementation in 3.9 is more rudimentary.

Operators

Operator Explanation
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
== Equality
~= Not Equals
and Chain conditions (both must be true)
or Chain conditions (one must be true)
not  

Putting it Together

Now that you know the operators, you can look below to see what conditions you can check. Remember to always put () after the Conditional Name, as these are functions.

Examples

These examples are for StepMania 3.9.

This will check if the current month is December, January, or February: Condition=MonthOfYear() == 12 or MonthOfYear() < 3

This will check if the current song's full title equals "MEI -for X-": Condition=CurSong() == Song("MEI -for X-")

This will check if the best grade is an AAA or better AND if the current second is past 29: Condition=GetBestGrade() <= Grade("AAA") and Second() > 29

References

Personal tools