Input test from player

  • #1, by petertermanhansenWednesday, 11. August, 08:57 A month ago
    Hi 
    Is there in the studio a way to get a string input from the player? Found a 7 year old notice in this forum, but may be there is a new way implemented?
    Regards
    Peter

    Newbie

    57 Posts


  • #2, by afrlmeWednesday, 11. August, 12:01 A month ago
    Yes, but it's a bit complicated to provide a quick example on here. A while ago Simon implemented the ability to listen out for key presses & key input via an event listener.

    I created a script-free example years ago, but I don't recommend that. I believe I actually wrote & shared a very very basic key input example on our Discord server. I'll see if I can dig it out...

    ah yeah, here you go.

    Speaking of Discord, you should consider joining our server if you want faster support than on here. It's not as organized as a forum as it's essentially a multi-room chatroom, but myself, Simon, Sebastian, & most of the regular posters are online most days, most of the time. https://discord.gg/g5zFejW

    Imperator

    7005 Posts

  • #3, by petertermanhansenWednesday, 11. August, 13:17 A month ago
    great example - just what i neddded. thanks. Will look at the forum you mentiond.
    Regards

    Newbie

    57 Posts

  • #4, by petertermanhansenMonday, 16. August, 11:01 A month ago
    Hi again

    Looking at your example, I want to stop the loop in the Scene0.update_txt action. In the action there is an unconditional jump to action #1. I want to make this conditional, so the action is finished when the user enters 'enter'. That is perfectly defined in the definitionscript: txt_input in the function processTxt. 

    So I would like to set a condition to true in process.txt, and stop the loop in Scene0.update_txt action. But I cannot find out how the condition in the definition-script is transferred to the script at the scene. Guess it is simple - or?

    Regards Peter

    Newbie

    57 Posts

  • #5, by esmeraldaMonday, 16. August, 12:19 A month ago
    you cannot call a condition you created only in script via the editor. But you can use conditons you created in the editor inside the script.

    So create a condition in the editor, add it in the action where you need it to be and change its value inside the script.

    Conditions["condition_name"].Value = true        (or false)


    Great Poster

    432 Posts

  • #6, by afrlmeMonday, 16. August, 12:23 A month ago
    Hmm, I just looked over the ved. I'm not sure why I decided on the term basic text input, as the script itself is still fairly complex - not as complex as the text adventure template I was working on as that one contained a load more lines of code & lots of functions to simulate keyword parsing in multiple word sentences.

    What you are saying is that you only want the key input to work on a specific scene when a specific condition is set, yes?

    Check out line 88 where it says return false. You could replace that line & link the return to a condition you create somewhere inside of the editor. Name it "stop_text_input". Now replace line 88 with return Conditions["stop_text_input"].Value. Now you can toggle when text input is allowed by setting that condition to false, or true to allow it.

    Imperator

    7005 Posts

  • #7, by petertermanhansenMonday, 16. August, 17:43 A month ago
    Thanks for replies. I tried as Esmeralde said.

    And as  I was writing this post to document that it did not work - in the same time testing - suddenly it worked like I would want it to.

    Thanks a lot



    Newbie

    57 Posts

  • #8, by petertermanhansenMonday, 16. August, 18:25 A month ago
    Now I can ask for a birth-date, calculate the players planets position by call to a command-line program, that writes data to a file. Then read this file, and thus make a personalized Astro-Quest game. Great


    Newbie

    57 Posts

Write post