CreateText(10, "" )
SetTextSize(10, 33)
SetTextColor(10, 255, 0, 0, 255)
SetTextPosition(10, 5, 280)
SetTextString(10, "Name= " + txtInput(10))
SetTextVisible(10, 1)
repeat
sync()
until GetPointerPressed()
endFunction
function txtInput(length)
out as string
SetCursorBlinkTime(0.5)
SetTextInputMaxChars(length)
StartTextInput("")
repeat
out = GetTextInput()
sync()
until GetTextInputCompleted()
if GetTextInputCancelled()
out = "N/A"
endif
StopTextInput()
endFunction out
To get something outside the scope of a function, you either need have it return something, or pass it a pointer (aka pass by reference) to a type. In this case, it returns a string. Also, nesting if's is a very bad idea unless you absolutely have to. In this case, you don't - so I tidied it up a bit. Also your c and state variables didn't do anything, so I just got rid of them.