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.
I'm reading through the input documentation and its says that i could provide a value
value
An input value object that this input uses. InputValue objects determine where the default value is taken from, what happens when the text is changed, what happens when enter is pressed, and if the text is editable by default.
This should not be given at the same time as default and changed.
default
Now I checked the input value documentation and I see something like this
VariableInputValue(variable, default=True, returnable=False)
An input value that updates variable.
variable
A string giving the name of the variable to update.
default
If true, this input can be editable by default.
returnable
If true, the value of this input will be returned when the user presses enter.
I've tried a few things but I can't seem to get it to work So my question is how and when do you actually use this? What is the difference between ScreenVariableInputValue and VariableInputValue If possible can you post some code since I understand it better that way. THANKS in advance.
Last edited by Enchant00 on Thu Apr 19, 2018 1:38 am, edited 1 time in total.
From the documentation it looks like the difference is that ScreenVariableInputValue only changes a variable that's local to the scope of the screen; VariableInputValue changes a global variable. So you'll most likely want to use the VariableInputValue for whatever you're doing.
I'm thinking that if VarialeInputValue works as intended, then I don't need to call the screen and show would suffice since the variable would be edited anyway and theore I don't really need its return value.
At the moment this is the error I receive:
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 32, in script
'screen test'
TypeError: object of type 'int' has no len()
Tell me if you need the full traceback and I'll send it when I'm able
kivik wrote: ↑Tue Apr 17, 2018 5:31 pm
Oh god, I made a mistake when searching and missed the "input" part of the function, ignore what I said about BarValues!
I can't test this right now, but the "add" keyword is for adding displayables, try ditching it and see if it works?
The Input is part of the screens documentation and in a sense it is a displayable. If you remove the add it would return an eror. I could use the pythonic equivalent for input but my goal is not really to make the input work. My problem is rather on the general idea of how the VariableInputValue is even suppose to function I can't really wrap my head around when/how to use it or what the result would even look like. Hopefully, this is not too confusing but thanks for suggesting your ideas.
If you can find any code online, specifically used with the input displayable, then that would be apprecited. Thanks again in advance.
Wow thanks a lot kivik I tested their code and it works well and it seems that my problem would lie on my default variable. Apparently, in order for the VariableInputValue to function properly, the variable to be changed should have a value that is a string. So if you need an int then you just have to covert the string to an int.
Again mate, thanks for the help as this has been bugging me for days now