Hello!
I want to save the user name as a string and send it to the game manager.
Type the user name, press the keyboard enter button, and it’ll be sent to the game manager.
But… I’ve looked up a lot of data, but I don’t know how to do
I’m working really hard, but I don’t know well.
Can you help me?
Where are you currently stuck? Can you type in the username in the input field?
Yes, I can type in the username in the input field
Ok, great! So next step then is to:
Is the game manager in some other script? You can send it using a message:
function on_input(self, action_id, action)
self.username = dirtylarry:input(...
dirtylarry:button("send_username_button_id", action_id, action, function ()
-- send the username when the button is clicked
msg.post("url to game manager", "username", { username = self.username })
end)
end
Oh, Thank you very much:smile:
yes, game manager is in other script!
so, I will make nwe button?
or Can I just press the Enter key to send it?
If you want the user to press a button to send the username then yes, you need to create a button.
Sure. Add a key binding for KEY_ENTER and when you detect a press of that key in your on_input() function you send the message containing the username.
Thank you so much!!!