Forum rules - please read before posting.

a simple string to int ?

 I must have an int to use the variable:Run Sequence. From a special Menu I enter a number and a Button initiates an Action List to determine what to do depending on the number I entered. The Variable:Run Sequence is perfect for my purpose but I can't get an int from the Menu->Input field, so I can't use the variable:Run Sequence. Since I have about 10 choices I would have to have 10 variable:check to check each number from 1 to 10 !!!

I could write the simplest atoi() in script but isn't there a solution within AC?

Comments

  • You could use the "Formula" opton in the "Variable: Set" Action to do this.

    You'll basically want to store your string into a separate variable to your integer, and then use "Variable: Set" with "Method" set to "Formula".  Then insert the string variable, as set by your input box, into the formula field using tokens, eg:

    [var:2]

    Which will be replaced by your variable of ID=2 when run in-game.
  • Yes, thank you. It is not very clear that the Method "Formula" does a conversion just by using the converse variable, I suppose this would work also if I were to convert an int to string.

    Thank you.

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.