‰ î function init(self) msg.post(".", "acquire_input_focus") go.set_position(vmath.vector3(527.5,348,0), "background") msg.post("/entername_gui#entername1", "enterthename", { enter = "enter your initials:" }) self.name = "" msg.post("/entername_gui#entername1", "written_name", { name = self.name }) self.max_char = 3 end function on_input(self, action_id, action) if action_id == hash("type") then if self.max_char > 0 then self.name = self.name .. action.text msg.post("/entername_gui#entername1", "written_name", { name = self.name }) self.max_char = self.max_char - 1 elseif self.max_char == 0 then print("no more characters!!!!!") end elseif action_id == hash("backspace") and action.repeated then self.name = string.sub(self.name, 0, string.len(self.name)-1) msg.post("/entername_gui#entername1", "written_name", { name = self.name }) self.max_char = self.max_char + 1 if self.max_char > 3 then self.max_char = 3 end end if action_id == hash("enter") then msg.post("main:/controller#main", "save_name", { name = self.name }) end if action_id == hash("escape") and action.pressed then msg.post("main:/controller#main", "escape") end end @main/entername.script"