Renpy pasteable input

yozayozo

Newbie
Sep 14, 2021
18
2
A game I'm working on needs an input in which a special code can be pasted. The code is a random hash of 24 characters, which would be hard for players to write manually. I haven't found any good quality ways of implementing such an input.

Can anyone help? If possible a step by step guide?

I'm just started with Renpy not so long ago and my knowledge is currently scarce
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,608
2,256
I don't know the answer.

However, this thread from about 6 years ago has a reply from PyTom that suggests using .


This from a year later gives a specific example (though that is TO the clipboard).


I guess a custom with both a text input box and a / with "[PASTE]" on it would suit your needs.

Perhaps use if pygame.scrap.contains(pygame.SCRAP_TEXT): to decide whether the enable/disable the "[PASTE]" button, then use pygame.scrap.get(pygame.SCRAP_TEXT) to pull the text into a variable as the button's action().
Alternatively, you could use a keybind for paste... just keep in mind that [CTRL] is bound by default to skipping dialogue... and messing with that will seriously piss off a significant majority of your players. So [CTRL+V] is probably off the table.

That second example specific mentions encoding the text as UTF-8. Though that is probably only required when putting data onto the clipboard rather than reading it.
 

yozayozo

Newbie
Sep 14, 2021
18
2
Thank you for your response! My bad is that I didn't read the documentation with proper concetration.

For anyone who stumbles upon this thread in the future:
I have just found out that in the documentation there is copypaste option!
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,608
2,256
My bad is that I didn't read the documentation with proper concentration.

D'oh. Me neither.
In my defence, I did write some test code (which was why I knew it'd dislike [CTRL+V]).
But I only looked at and didn't check the section of the screen language.

So yeah... I guess.
 
Last edited:
  • Like
Reactions: yozayozo