This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
local result = "" -- create an empty string
local val
function add(c)
val = getObject("Game.GameCurrentScene.SceneValues[str_txt]")
result = val:getStr(VValueString) .. c
updateStr()
end
function remove()
val = getObject("Game.GameCurrentScene.SceneValues[str_txt]")
if string.len( val:getStr(VValueString) ) > 0 then result = string.sub( val:getStr(VValueString), 1, -2); updateStr() end
end
function updateStr()
val = getObject("Game.GameCurrentScene.SceneValues[str_txt]")
val:setValue(VValueString, result)
end
function clear()
stopAction("ActiveActions[display_text]")
getObject("Game.GameCurrentScene.SceneValues[str_txt]"):setValue(VValueString, "")
getObject("Game.GameCurrentScene.SceneValues[str_question]"):setValue(VValueString, "")
getObject("Conditions[key_input_active]"):setValue(VConditionValue, false)
end
The free version covers up to 25 scenes per project. For more scenes and to sell your game, you need a license. Forum readers get the Indie Bundle 15 % off with the code FORUM15: €84.15 instead of €99, valid until 31 Dec 2026.Black Friday: the Indie Bundle is 30 % off until 1 Dec 2026, €69.30 instead of €99. The code BLACKFRIDAY is already applied.
Get 15 % off Try it for freefunction keyboardHandler(eventType, character, keycode, modifiers)
if eventType==eEvtKeyTextInput then
Values["password"].String = Values["password"].String .. character
elseif eventType == eEvtKeyDown and keycode == 8 then
Values["password"].String = string.sub(Values["password"].String, 1, -2)
end
startAction("Scenes[sceneName].SceneActions[refresh]")
return false
end
registerEventHandler("keyEvent", "keyboardHandler")Would be also nice to have a cursor animation at the end of the string, don't know how to achieve that though. Maybe it's possible to calc the width based on current character and position the cursor animation based on that? Or maybe always add and delete a ¦character in a loop at the end of the string.
Ah okay seems to be simpler than i expectedAye mate, not that hard with a looping action block as you can just toggle between 2 different display object text or display narration text actions, with one that contains the _ or | thing or whatever you want it to flash at the end of the string. I know I had it do that in the demo thing I created, but it's so long ago that I created that, that I don't remember how I sorted it out.
Sebastian, do I have to add the condition "key_input" and the value "password" on the room with the password field?Yes, it would create issues if you have multiple values/conditions with same name. You can get around that though by linking directly to the scene the value is on.What if I have several values called "password" in the game? Isn't it going to collide?
game.CurrentScene.SceneValues["password"].Stringfunction keyboardHandler(eventType, character, keycode, modifiers)
if Conditions["key_input"].ConditionValue then
if eventType == eEvtKeyTextInput and string.len(game.CurrentScene.SceneValues["password"].String) 0 then
game.CurrentScene.SceneValues["password"].String = string.sub(game.CurrentScene.SceneValues["password"].String, 1, -2)
end
startAction(Actions["some_action_for_sound_effect"])
startAction(Actions["your_called_by_other_action_to_refresh_the_text_again"])
end
return false
end
registerEventHandler("keyEvent", "keyboardHandler")This thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.
New threadDeponia, The Whispered World and more than 160 other games were made with Visionaire Studio. The free version covers up to 25 scenes. For more scenes there is Visionaire Studio PRO from €75, and to sell your game the Indie Bundle for €99.
Until December 1: the Indie Bundle is 30% off with the code BLACKFRIDAY, €69.30 instead of €99.