Trying to jump labels in a Python block

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
User avatar
burnt_offering
Regular
Posts: 107
Joined: Sun Feb 23, 2014 4:21 pm
Completed: The Stroke of Midnight
Organization: Ace Of Spades
IRC Nick: burnt_offering or TheTapDancer
Skype: aceofspadesvn
itch: aceofspadesvn
Location: London
Contact:

Trying to jump labels in a Python block

#1 Post by burnt_offering »

I've been trying to program a code lock as part of a puzzle sequence, but I was putting the code in a python block to avoid messing around with textbuttons. However, when in a block, ren'py doesn't seem to acknowledge jump as a function, so I'm not sure how to proceed.

For reference, here's the code:

Code: Select all

screen GenCodeInput:
tag puzzle
use navigation
imagemap:
    ground "gencode.png"
    idle "gencode.png"
    hover "gencodehover.png"
            
    hbox:
        for i in (0,9):
            textbutton str(i) action code(i,10529,opengen)
        textbutton clear action clearcode

init python:
    def code(i,k,label):
        if code==0:
            code=i
        elif code<10:
            code= 10*code + i
            if code==k:
                jump label
        elif code>9999:
            codestring=str(code)
            for ch in codestring:
                codestring2 = str(codestring[-4:])
                code = int(codestring2)
                code = 10*code + i
                if code==k:
                   jump label
[url]http:\\aceofspades@vnovel.com[/url]
Or just follow me at @AceOfSpades_VN


Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]