Converting an input_text string into an int?

Hey, everyone!

I’m currently working on my life simulator, and a largely requested feature is allowing players to create their own families instead of running through my dynamic generation system (which is understandable).

Until I reached it today, I didn’t think of a glaring problem…

Choosing how old a family member is.

We’re talking about the possibility of 80 numbers, which is a lot to have to weave and code as an example. What would be an ‘easy’ fix of course is using input_text, except that the data it produces is a string. This is problematic because age in Once in a Lifetime is declared as an integer variable and needs to be read as such for transition processing and incrementation.

What I’m trying to figure out is if there’s a way to pull that string data so it can be made into an int. It doesn’t appear that way, but it’ll save me the time of needing to create a transition processing script that’ll read the individual strings by writing it out, and then using if statements to evaluate and assign as needed.

Anyways, figured I’d reach out and throw a hail mary here.

Thanks!

This is what you want.

4 Likes

I have no idea how I have spent 2 years programming on Choicescript and did not realize that this was a thing, and then spent 2 hours searching for a converting option instead of thinking there was an input_number alternative LMAO.

You’re the best!

2 Likes

To make it worse…

I have used this in my current game already (after doing a code search) extensively and just… brain-blanked.

It’s a Monday, folks.

2 Likes

This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.