DaftBrit/NoitaArchipelago

Chat client in-game

Opened this issue · 3 comments

It would be nice to have a chat client directly in-game for sending messages and AP commands.

Research notes:

The built in UI with GuiTextInput is a disaster. There's no way to capture the ENTER key in the normal mod API, text input happens when the mouse hovers over it (no concept of active control), holding backspace doesn't repeatedly delete characters.

Safe to say this will be on hold for now.

local ChatBox = {}

local ID_TXT = 44480

function ChatBox:create()
	self.gui = GuiCreate()
  self.text = ""
end

function ChatBox:update()
	if self.gui == nil then return end

	GuiStartFrame(self.gui)

	local _, screen_height = GuiGetScreenDimensions(self.gui)

  local x = 16
	local y = screen_height - 32
  self.text = GuiTextInput(self.gui, ID_TXT, x, y, self.text, 120, 120)
end

return ChatBox

Noita Together has a chat box. It has the same limitations as you're stating above, but it's at least usable.

I wonder if specifying newline as a valid char would allow newline in the control? After which we would detect and clear it. Might be something to test. Can also look at Noita Together.