How do I get a integer from FilePageNameInputValue?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
nillan3
Newbie
Posts: 9
Joined: Sat Jun 15, 2019 5:09 am
Contact:

How do I get a integer from FilePageNameInputValue?

#1 Post by nillan3 » Sat Jan 25, 2020 3:37 pm

Hey!
In screen.rpy under the

Code: Select all

screen file_slots(title):
tab there is a line that says

Code: Select all

default page_name_value = FilePageNameInputValue(pattern=_("Page {}"), auto=_("Automatic saves"), quick=_("Quick saves"))
and to get the number from FilePageNameInputValue you have to do

Code: Select all

value page_name_value
However, I'm trying to get the value out as an integer. I know there is [page], but that doesn't update when you press the textbutton

Code: Select all

textbutton _(">") action FilePageNext()
I'm thankful for any help I can get!
/nillan3

User avatar
gas
Miko-Class Veteran
Posts: 525
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: How do I get a integer from FilePageNameInputValue?

#2 Post by gas » Sat Jan 25, 2020 8:21 pm

FileCurrentPage()
Returns the current file page as a string.

So, probably

Code: Select all

$ page_num=int(FileCurrentPage())
But beware that this turn a bit messy if you're in the "quick" or "auto" page.
10 ? "RENPY"
20 GOTO 10

RUN

Post Reply

Who is online

Users browsing this forum: Google [Bot], SwashbucklerXX