Skip to main content

StartTyping

This function was added in DSL 1

Description

Start allowing keyboard input that can be retrieved using GetTypingString.

If typing was already active, then this function will return false.

function StartTyping(initial) --[[ ... ]] end

Parameters

  • initial: string? - (Optional) The initial string to set as the starting point for typing. If not provided, it defaults to an empty string.
info

DSL7 - The optional initial argument can put some text in the string to begin with.

Return Values

  • started: boolean - Returns true if typing was successfully started, otherwise false if typing was already active.

Example

Start a mission when a button is pressed.

function main()
while not SystemIsReady() do
Wait(0)
end
while true do
-- Arrow down to start typing
if IsButtonBeingPressed(3, 0) and StartTyping() then
while IsTypingActive() do
TextPrintString('Start mission: ' .. GetTypingString(), 0, 1)
Wait(0)
end
if not WasTypingAborted() then
ForceStartMission(GetTypingString())
end
end
Wait(0)
end
end

See Also