Page Menu
Home
1F616EMO Bugtracker
Search
Configure Global Search
Log In
Files
F151015
init.lua
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
init.lua
View Options
-- twi_mods/chatroom_tutorial/init.lua
-- Tutorial of how to open chat, and hud message
-- Copyright (C) 2024 1F616EMO
-- SPDX-License-Identifier: LGPL-3.0-or-later
local
S
=
core
.
get_translator
(
"chatroom_tutorial"
)
local
hud
=
mhud
.
init
()
teacher
.
register_turorial
(
"chatroom_tutorial:chatroom"
,
{
title
=
S
(
"How to find help?"
),
{
texture
=
"chat_grant_interact_teacher_1.jpg"
,
text
=
{
S
(
"If you need help in non-English languages, type in the chatroom with your mother language, "
..
"or use a translator (e.g. Google Translate) to communicate."
),
S
(
"To seek help, use the chatroom. To start chatting:"
),
S
(
"On Mobile Phones or iPads: Look at the top right corner of your screen. "
..
"Tap the chat box icon."
),
S
(
"On PC or Mac: Press the
\"
T
\"
key on your keyboard to open the chat box."
),
}
},
})
local
function
show_to
(
name
)
local
player
=
core
.
get_player_by_name
(
name
)
if
player
then
teacher
.
unlock_and_show
(
player
,
"chatroom_tutorial:chatroom"
,
nil
)
end
end
core
.
register_on_newplayer
(
function
(
player
)
player
:
get_meta
():
set_int
(
"chatroom_tutorial_show_msg"
,
1
)
core
.
after
(
-
1
,
show_to
,
player
:
get_player_name
())
end
)
core
.
register_on_joinplayer
(
function
(
player
)
if
player
:
get_meta
():
get_int
(
"chatroom_tutorial_show_msg"
)
~=
0
then
hud
:
add
(
player
,
"chatroom_tutorial_show_msg"
,
{
hud_elem_type
=
"text"
,
position
=
{
x
=
0.5
,
y
=
0.5
},
offset
=
{
x
=
0
,
y
=
42
},
text
=
S
(
"Click on the top-right speech bubble icon to get help. (T on PC)"
),
text_scale
=
1
,
color
=
0xFFD700
,
})
end
end
)
twi_fx
.
register_on_chat_message
(
function
(
name
,
message
)
if
string.sub
(
message
,
1
,
1
)
==
"/"
then
return
end
local
player
=
core
.
get_player_by_name
(
name
)
if
not
player
then
return
end
if
hud
:
exists
(
player
,
"chatroom_tutorial_show_msg"
)
then
player
:
get_meta
():
set_int
(
"chatroom_tutorial_show_msg"
,
0
)
hud
:
remove
(
player
,
"chatroom_tutorial_show_msg"
)
end
end
)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jan 8 2026, 9:35 PM (7 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
81/df/276baeb039efc95c7230d18b4f0c
Default Alt Text
init.lua (2 KB)
Attached To
Mode
rTWIMODS Survival Server Custom Modifications
Attached
Detach File
Event Timeline
Log In to Comment