Skip to content
User670 edited this page Jan 18, 2024 · 3 revisions

1. Parameters

The schema file should be a syntactically valid Lua program file, which must return a table whose contents include:

1.1. color

Required, the color of the mode, which is used for the prompt text displayed after clicking the map icon.


1.2. env

Required, the mode environment variable, determines the attributes of the level.

See the table below for specific parameters:

Attribute name Default Explanation
drop 60 Drop delay (in frames, supports positive integers, 2^(-n), and 0 [20G])
lock 60 Lock delay (in frames)
wait 0 Block delay(in frames)
fall 0 Line clear delay(in frames)
hang 0 Apnea delay(in frames)
bone false Whether to enable bone block mode
fieldH 20 Field height
heightLimit 1e99 Height limit
nextCount 6 Blocks in Next queue
nextStartPos 1 Blocks to show in start position
holdCount 1 Number of blocks to hold
infHold false Whether to hold blocks infinitely
phyHold false Whether to enable Hold physics
ospin true Whether to allow O-Spins
deepDrop false Whether to enable Deep Drop
RS 'TRS' Rotation system
das 10 DAS
arr 2 ARR
sddas 2 Soft drop DAS
sdarr 2 Soft drop ARR
mindas 0 Minimum DAS
minarr 0 Minimum ARR
minsdarr 0 Minimum soft drop ARR
ihs true Whether to Hold in advance
irs true Whether to rotate in advance
ims true Whether to move in advance
FTlock true Whether to enable logical frame tracking and force acceleration logic when the screen is less than 60 frames, so as not to slow down the game
skinSet [set up] Block texture, only the name of the built-in skin can be filled in
skin [set up] Block color, a table of 25 integers (1~16)
face [set up] Block orientation, a table of 25 integers (0~3)
block true Whether to display the block
ghost 0.3 Ghost block transparency(0~1
center 1 Rotation center transparency(0~1
smooth false Whether the block falls smoothly
grid 0.16 Grid transparency(0~1
bagLine true Whether to show packet boundaries (if present)
lockFX 2 Lock effect level (integer from 0~5)
dropFX 2 Hard drop effect level(integer from 0~5
moveFX 2 Movement effect level(integer from 0~5
clearFX 2 Line clear effect level(integer from 0~5
splashFX 2 Splash effect level(integer from 0~5
shakeFX 2 Shake effect levle(integer from 0~5
atkFX 2 Attack effect level(integer from 0~5
text true Whether to display line text
score true Whether to display score
highCam false Whether to open the super screen view
nextPos false Whether to enable generate preview
showSpike false Whether to enable the spike counter
hideBoard false To hide upper/lower halves of the board ("down", "up", "all")
flipBoard false To flip or rotate the board ("U-D", "L-R", "180")
sequence bag Sequence mode is a refresh function for the next sequence after putting a block, you can use several default functions to represent with strings,
you can also write one yourself. Note: use coroutine technology
seqData {1,2,3,4,5,6,7} "packet" data used by sequence mode (The essence is to generate the data for the sequence, which will be passed as a parameter to the sequence generation function called sequence above, not necessarily a package)
mission false A table containing tasks, the description is omitted temporarily
life 0 Revive count
garbageSpeed 1 Garbage receive to release time
pushSpeed 3 Rising speed of garbage
noTele false Whether to disable the advanced movement keys
visible 'show' Block visibility, fill in several fixed strings
freshLimit 1e99 Lock delay refresh limit
easyFresh true Whether to use standard lock delay refresh rules
bufferLimit 1e99 Maximum number of attack buffer lines
fkey1 false Function executed after pressing function key 1
fkey2 false Function executed after pressing function key 2
keyCancel {} Contains the ID of disabled keys. For example, {1,2} means that left and right movements are disabled
fine [set up] Whether to enable non-minimalist prompts
fineKill false Whether to kill player if they make a non-minimalist move
b2bKill false Whether to kill player if they lose their B2B
missionKill false Whether to kill player if they fail the mission
noInitSZO false Whether to disable SZO block opening. If disabled, the opening sequence will automatically skip up to five consecutive SZOs.
mesDisp NULL Information that needs to be displayed in the player sidebar (or a function list, executed sequentially, can be displayed anywhere, but it is strongly not recommended to leave the player frame), and enter the player object
hook_drop NULL Put the function to be executed after placing a block (or a list of functions, executed in sequence), and enter the player object
hook_die NULL Triggered when the usual death conditions (super height and suffocation) (or function list, executed in sequence), enter the player object
task NULL Each frame will continue to execute the function (or function list, executed in sequence, returning true will clear itself from the queue) (will be executed once during initialization, and can be used to set the venue, etc.), enter the player object, Note: Use coroutine technology
eventSet false Use the default event package name (string), which will overlap with the above four packages. Please be careful when using it and try not to specify too many components at the same time.
bg 'none' Background, you can only fill in the name of a built-in background
bgm 'race' Background music name (or a random list, such as 'race' or 'push'}), only a song in the built-in music library can be used
allowMod true Whether to allow modifiers

1.3. load

Required, mode initialization function, generally just create a player, no input, no output.


1.4. score

Optional (if not filled in, there will be no score saving or calculation), the data to be stored after a round is played.

Input the player object, output the moment the game ends, and return a data table containing data that directly determines the results of the mode (the "date" tag will be force-added).


1.5. scoreDisp

Optional (no need to write when the mode does not appear on the map), it is a function that converts the table saved by score() into a string and displays it. Input a grade table and output a string.


1.6. comp

Optional (no need to write when there is no score function), it is the comparison and sorting rule between score tables.

Input two score tables and output a Boolean value of [whether the first is ranked in front of the second] (can be compared to the "less than" operation)


1.7. getRank

Optional, the mode rating function is a function used to evaluate player performance.

Input the player object, output 0~5, 0 means do nothing except record to the ranking list;

1/2/3/4/5 represents ranks B/A/S/U/X, which unlocks the connected mode and also causes the mode icon to display a different color on the map.


2. Example

The following is the content of the "40-line sprint" file:

--sprint_40l.lua
return{ --Return a table, you can also define some constants or functions before
	color=COLOR.green,
	env={ --Mode environment variables
		drop=60,lock=60,
		eventSet='checkLine_40',--This default "eventSet" contains "dropPiece" and "mesDisp", which is what is needed for 40 lines
		bg='bg2',bgm='race',
	},
	load=function() --Mode loading function. Only one player is generated here. The commonly used single-player mode does not need to be written. This function is used by default.
		PLY.newPlayer(1) --1 is the player number, and the default user controls Player 1
	end,
	score=function(P)return{P.stat.time,P.stat.piece}end,--Key information of this game that needs to be saved at the end of the game
	scoreDisp=function(D)return STRING.time(D[1]).."   "..D[2].." Pieces"end,--Method to display the data returned by "score"
	comp=function(a,b)return a[1]<b[1]or a[1]==b[1]and a[2]<b[2]end,--Sort by time, if there's a tie, sort by block count
	getRank=function(P) --Calculate rating
		if P.stat.row<40 then return end --You have to complete 40 lines, right? Otherwise, the "return" will be empty and the results will not be recorded.
		local T=P.stat.time
		return
		T<=26 and 5 or --Time less than or equal to 26 seconds is required for X rank
		T<=32.6 and 4 or --U rank requirements
		T<=52.6 and 3 or --S rank requirements
		T<=92.9 and 2 or --A rank requirements
		T<=183 and 1 or --B rank requirements,minimum standards for unlocking other modes
		0 --Minimum standards for recording achievements
	end,
}
Clone this wiki locally