Forum rules - please read before posting.

Checking value of input box text

I'm using a menu to allow input of numerals only, and I have a button that on-click I'd like to check and see if the values match predetermined numbers (it's a combination lock). However, I'm only seeing options to set input values, not read what is stored in them. Am I missing an available option, or is this something that is not built into the asset currently?

Thanks!

Comments

  • The "built-in" workflow is to first set the input box's contents to a Global String Variable with the Variable: Set Action, so that it's value can be compared with the Variable: Check Action.

    Through script, you can read the contents directly:

    string contents = (PlayerMenus.GetElementWithName ("MyMenu", "MyInput") as MenuInput).GetContents ();
    
  • @ChrisIceBox Looking at the Variable: Set action, I'm assuming I would have to use a formula, but I'm unsure of how to call the menu's input box element so as to store it in a variable. Or is there another way I'm not thinking of to capture the input box text into a variable?

  • See how it's done in this tutorial. If your variable is a String, then you'll get the option to set its value from an Input box element. Though your Input box is limited to numerics, its contents are still considered a String, and not an Integer.

  • Thanks, I didn't think about using strings instead of ints!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.