Hello Experts,
I am trying to do an unbreakable encryption of a dialog line with the rot13 cypher documented here: https://www.renpy.org/doc/html/custom_t ... l#examples
However, neither the text tag {rot13} mentioned there, nor using function text.encode("rot13") directly work but give the error:
unknown encoding: rot13
I found other threads concerning rot13 in python (some importing codecs module, suggesting other methods, renaming to rot-13 or rot_13), but also no luck. Does anybody know how to do this without implementing the codec myself?
Many thanks!
unknown encoding: rot13
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.
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.
Re: unknown encoding: rot13
Mumble...
A dialogue line alone?
No need to devise a tag. Use a python shell and copy the result of rot-13 on a string.
UPDATE: verified by console that, for some reason, rot13 is actually not accessible not even listed in the codecs module. More probably, that example wasn't tested with recent releases.
A dialogue line alone?
No need to devise a tag. Use a python shell and copy the result of rot-13 on a string.
UPDATE: verified by console that, for some reason, rot13 is actually not accessible not even listed in the codecs module. More probably, that example wasn't tested with recent releases.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
10 ? "RENPY"
20 GOTO 10
RUN
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: unknown encoding: rot13
Try changing the
in the definition to
Note: Rot13 is not in any way unbreakable
Code: Select all
text = text.encode("rot13")
Code: Select all
text = renpy.translation.generation.rot13_transform(text)
# or
text = renpy.translation.generation.rot13_filter(text) # better for tags and interpolation
Last edited by Remix on Wed Jan 15, 2020 12:23 pm, edited 1 time in total.
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: unknown encoding: rot13
Thanks, will try that!Remix wrote: ↑Wed Jan 15, 2020 12:17 pm Try changing thein the definition toCode: Select all
text = text.encode("rot13")
Code: Select all
text = renpy.translation.generation.rot13_transform(text)
Nooooo!Note: Rot13 is not in any way unbreakable
I knew that
Re: unknown encoding: rot13
OK, tried it and found out that rot13_transform is totally bugged. It contains no less than two typos that make it anything but the rot13 transformation:
In fact, the parameters of the zip need to be ("ABCDEFGHIJKLM", "NOPQRSTUVWXYZ") to make it rot13.
So I went and implemented a combined rot13/rot5 to make it permutate digits as well. For those who are interested:
Thanks for the help, though!
Code: Select all
def rot13_transform(s):
ROT13 = { }
for i, j in zip("ABCDEFGHIJKLM", "NMOPQRSTUVWYZ"):
ROT13[i] = j
ROT13[j] = i
i = i.lower()
j = j.lower()
ROT13[i] = j
ROT13[j] = i
return "".join(ROT13.get(i, i) for i in s)
So I went and implemented a combined rot13/rot5 to make it permutate digits as well. For those who are interested:
Code: Select all
def rot135_transform(s):
ROT135 = { }
for i, j in zip("ABCDEFGHIJKLM01234", "NOPQRSTUVWXYZ56789"):
ROT135[i] = j
ROT135[j] = i
i = i.lower()
j = j.lower()
ROT135[i] = j
ROT135[j] = i
return "".join(ROT135.get(i, i) for i in s)
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: unknown encoding: rot13
I let Tom know about the rot13_transform and he has applied a fix (will be available in next main release)
Fixes to the documentation code are also on his agenda
Fixes to the documentation code are also on his agenda
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Who is online
Users browsing this forum: Google [Bot]