tutorial
Read-only tutorial state kept in sync by the tutorial start and end triggers.
api.tutorial. 2 members.
| Member | Returns | Summary |
|---|---|---|
isActive() | boolean | True from the tutorial start trigger until the tutorial end trigger. |
getApproach() | 'compressed' or 'newspaper' or 'fail-forward' or 'none' or null | The active tutorial's approach, or null when no tutorial is active. |
isActive#
api.tutorial.isActive(): booleanTrue from the tutorial start trigger until the tutorial end trigger.
Returns: boolean. true while a tutorial is active; false before the first tutorial and after it ends.
js
function showMyOnboarding() {
api.ui.showNotification('Welcome to my mod', 'info');
}
if (!api.tutorial.isActive()) showMyOnboarding();
else api.hooks.onTutorialEnd(() => showMyOnboarding());getApproach#
api.tutorial.getApproach(): 'compressed' | 'newspaper' | 'fail-forward' | 'none' | nullThe active tutorial's approach, or null when no tutorial is active.
Returns: 'compressed' | 'newspaper' | 'fail-forward' | 'none' | null. compressed, newspaper, fail-forward or none while a tutorial is active; null otherwise.
js
const approach = api.tutorial.getApproach(); // null when no tutorial runs
if (approach === 'newspaper') console.log('Newspaper tutorial running');