Mini World’s Dev Mode: Block Art is a mode that helps future programmers maximize their creativity. Let’s learn how to use scripts in Dev Mode in Mini World!
How to use scripts in the Dev Mode of Mini World: Block Art
Scripting (script) editing in Mini World: Block Art
Step 1: Create an internal map Dev Mode.
Step 2: Click on the last iconin the upper right corner.
Step 3: Click the script buttonon the left to open the editor.
Step 4: Click Script Set on the right, then press New Script to edit your script.
Step 5: Don’t forget to save by clicking on the Save iconin the upper left corner. Switch to Play Mode to execute the script.
Tips: Copy and paste the script highlighted in black Game – Trigger – Script. Press Play Mode to execute this script!
Example 1: Want to import Hello! Mini World into the chat box:
Chat:sendSystemMsg(“Hello! Mini World!”)
Code analysis:
- You can replace the text in brackets ().
- If you want to send multiple chats, create them similar to the one above.
Example 2: Born Jockey at coordinates: 5,7,5:
World:spawnCreature(5, 7, 5, 3102)
Code analysis:
- Jockey is an extremely popular mob in Mini World but it appears completely random. By pasting this script in the corresponding box, you can spawn Jockey in a selected location.
- Feel free to change the coordinates.
Basic script syntax in Mini World: Block Art
Mini World there is some basic script syntax that you have to adhere to otherwise it won’t work.
- There must be a space between words.
- When declaring more than one variable or parameter on the same line, you need to use an ampersand
,
separate them. The way to declare a variable is as follows:- Declare a variable named a, with the value 1: local a = 1
- Many variables named a, b, c: local a, b, c = 1, 2, 3
- Script with conditional conditions
- Format: if () … then …
- Explanation: if (condition) then…. If the condition is correct, the “then” action will occur.
- Some conditional examples:
- (1> 2): 1 is greater than 2, false
- (1 <2): 1 is less than 2, yes
- (1 ~ = 2): 1 is not equal to 2, yes
- (1 == 2): 1 equals 2, false
- (a == b): There is no value assigned to a and b, so it is nil (empty). As such, this condition is true. If you have assigned a value, the conditional command is true or false depending on whether it is equal to that value or not.
Illustration: The script places a block of stone in front of the character:
local ret1, playerId = Player: getMainPlayerUin ()
local ret2, x, y, z = Player: getPosition (playerId)
local ret3, curdir = Player: getCurPlaceDir (playerId)
if curdir == FACE_DIRECTION.DIR_NEG_X then x = x + 1 end
if curdir == FACE_DIRECTION.DIR_POS_X then x = x-1 end
if curdir == FACE_DIRECTION.DIR_NEG_Z then z = z + 1 end
if curdir == FACE_DIRECTION.DIR_POS_Z then z = z-1 end
Block: replaceBlock (104, x, y, z, FACE_DIRECTION.DIR_POS_Y)
– Place down block ID 104, 104 is the id of stone block
– “-” Symbols are used for comments, The script will not execute content inside “-“.
Delete scripts in Mini World: Block Art
In the script editing interface, tap the trash can iconto delete all current scripts.
Enter the script in Mini World: Block Art
In the script editing window, touch the folder iconto import scripts from the device.
See the step-by-step instructional images below to get a better picture:
Hope the article is useful to you!
Source link: Mini World Block Art: How to use and edit scripts in Developer mode
– https://emergenceingames.com/