HOW TO SET TEXT, SET TEXTURE (SCRIPT)
Introduction: The Mini World Game has a lot of games about parkour, pvp, pve, etc. But it can make with script and trigger. So today, I will tutorial about set text and set texture
1. How to get elements?
2. How to get UI ID (PC) Step 1: Choose “Script”
Step 2: Create a new script
Step 3: Choose “ID Library” to receive UI ID, cho picture to receive picute id
3. Set texture (script)
target: code: setText, element, UI. This is set texture form:
local function MWC (event) code = Customui:setTexture(event.eventobjid, element, url) --- url = your content if code == ErrorCode.OK then Chat:sendSystemMsg("Success") else Chat:sendSystemMsg("Failed") end end ScriptSupportEvent:registerEvent([=[UI.Show]=], MWC)
Explain:
- MWC in line 1 is a variable. You can change it to a lot of names.
- Customui:setTexture – This is action set texture
- code == ErrorCode.OK – If it runs the game will chat “Success” but if it can't run the game will chat “Failed”
- ScriptSupportEvent:registerEvent – This is game events. GAME EVENT
Practice
for example I have an element a, an url b and this is my script (please change a and b to fit your map)
local function MWC (event) code =Customui:setTexture(event.eventobjid, [[7333500111866553961]],[[7333500111866553961_1]], [[10010]]]) --- url = your content if code == ErrorCode.OK then Chat:sendSystemMsg("Success") else Chat:sendSystemMsg("Failed") end end ScriptSupportEvent:registerEvent([=[UI.Show]=], MWC)
4. Set Text
Target: Code: - Set Text, an element, an UI, strings This is set texture form:
local function MWC (event) code = Customui:setText(event.eventobjid, element, text) --- url = your content if code == ErrorCode.OK then Chat:sendSystemMsg("Success") else Chat:sendSystemMsg("Failed") end end ScriptSupportEvent:registerEvent([=[UI.Show]=], MWC)
Explain:
- MWC in line 1 is variable.
- Customui:setText in line 2 is action to activated code
- if code == ErrorCodeOK in line 3 is true condition
- Chat in line 5 is true action
- Else in line 6 is faild action
- Chat in line 7 is faild action
- end in line 8 is for if…then…else
- end in line 9 is for function
- ScriptSupportEvent:registerEvent – This is game events, you can change it to fit your map
Practice
- Exercise 1: Please write script about set Texture. Element: 10011
- Exercise 2: Please write script about set Text. String “Happy Lunar New Year”
- Exercise 3: Please write code and complete:
- 3a1) Set Text: - I love Mini
- 3a2) Set text: - I like this game….
- 3a3) Set Texture: An Element: 10012
You can send your homework to my email: dutiful1234&gmail.com I can fix your error❤️