You've reached a page on the Ren'Py wiki. Due to massive spam, the wiki hasn't been updated in over 5 years, and much of the information here is very out of date. We've kept it because some of it is of historic interest, but all the information relevant to modern versions of Ren'Py has been moved elsewhere.
Some places to look are:
Please do not create new links to this page.
This executes the
konami_code label when the Konami Code is entered on the keyboard. The code consists of the following keys in sequence:
It should be fairly easy to change the code and the label branched to.
# This lets you easily add the Konami code to your Ren'Py game. When # the Konami code (up up down down left right left right a b) has been # entered, this calls the konami_code label (in a new context, so that # the current game state isn't lost. init python hide: class KonamiListener(renpy.Displayable): def __init__(self, target): renpy.Displayable.__init__(self) import pygame # The label we jump to when the code is entered. self.target = target # This is the index (in self.code) of the key we're # expecting. self.state = 0 # The code itself. self.code = [ pygame.K_UP, pygame.K_UP, pygame.K_DOWN, pygame.K_DOWN, pygame.K_LEFT, pygame.K_RIGHT, pygame.K_LEFT, pygame.K_RIGHT, pygame.K_b, pygame.K_a, ] # This function listens for events. def event(self, ev, x, y, st): import pygame # We only care about keydown events. if ev.type != pygame.KEYDOWN: return # If it's not the key we want, go back to the start of the statem # machine. if ev.key != self.code[self.state]: self.state = 0 return # Otherwise, go to the next state. self.state += 1 # If we are at the end of the code, then call the target label in # the new context. (After we reset the state machine.) if self.state == len(self.code): self.state = 0 renpy.call_in_new_context(self.target) return # Return a small empty render, so we get events. def render(self, width, height, st, at): return renpy.Render(1, 1) # Create a KonamiListener to actually listen for the code. store.konami_listener = KonamiListener('konami_code') # This adds konami_listener to each interaction. def konami_overlay(): ui.add(store.konami_listener) config.overlay_functions.append(konami_overlay) # This is called in a new context when the konami code is entered. label konami_code: "You just earned an additional 30 lives!" "While they might not be of much use in a dating sim, good for you!" return