Skip to main content

sm.challenge

The Challenge api contains functions related to the Challenge game mode.

Functions

getCompletionTime

sm.challenge.getCompletionTime( level )
Server-Only

Returns the challenge completion time.

Arguments:
  • level [ Uuid ]: The level uuid.
Returns:
  • [ number ]: The completion time.

getSaveData

sm.challenge.getSaveData( level )
Server-Only

Returns the challenge level save data.

Arguments:
  • level [ Uuid ]: The level uuid.
Returns:
  • [ table ]: The save data.

hasStarted

sm.challenge.hasStarted()
Server-Only

Returns whether the challenge has started.

Returns:
  • [ bool ]: Whether the challenge has started or not.

isMasterMechanicTrial

sm.challenge.isMasterMechanicTrial()
Client-Only

Returns whether the challenge is part of the "Master Mechanic Trials" pack.

Returns:
  • [ bool ]: The content pack status.

levelCompleted

sm.challenge.levelCompleted( level, time, save )
Server-Only

Completes a challenge level and saves progression.

Arguments:
  • level [ Uuid ]: The level uuid.
  • time [ number ]: The completion time.
  • save [ table ]: A table containing save data.

resolveContentPath

sm.challenge.resolveContentPath( path )
Server-Only

Resolves a path containing $CONTENT_DATA to path that can be accessed in the main scripting environment.

Arguments:
  • path [ string ]: The unresolved path.
Returns:
  • [ string ]: The resolved path.

start

sm.challenge.start()
Server-Only

Starts the challenge.


stop

sm.challenge.stop()
Server-Only

Stops the challenge.


takePicture

sm.challenge.takePicture( width, height, rotation )
Server-Only

Takes a picture of the challenge level with a custom resolution.

Arguments:
  • width [ int ]: The preview width.
  • height [ int ]: The preview height.
  • rotation [ int ]: The rotation step.

takePicturesForMenu

sm.challenge.takePicturesForMenu( rotation )
Server-Only

Takes pictures of the challenge level to use as icon and preview.

Arguments:
  • rotation [ int ]: The rotation step.