A question on ui.jumps

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
deltazechs
Newbie
Posts: 16
Joined: Thu Nov 16, 2006 2:10 pm
Contact:

A question on ui.jumps

#1 Post by deltazechs »

I have a question regarding ui.jumps

Let's say I made a label called "ch1_part1". Now, normally, if I want to jump back to that label, I only need to simply write:

jump ch1_part1

However, what if I want to make a function that allows me to jump to any label I like as long as I call it by passing in a string as an argument, with the string holding the name of the label? Inside the function, I wrote:

$ location = "ch1_part1"
$ ui.jumps(location)


I thought that would work, but it looks like Renpy skips over ui.jumps and continue with the script. :(
Any help would be appreciated. Thanks in advance.
"Darker than a moonless night, hotter and more bitter than hell itself. That is coffee." --- Godot, Phoenix Wright Ace Attorney: Trials and Tribulations

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: A question on ui.jumps

#2 Post by PyTom »

You want to use renpy.jump, rather than ui.jumps. The former immediately jumps, while the latter returns an object that, when called, jumps.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

deltazechs
Newbie
Posts: 16
Joined: Thu Nov 16, 2006 2:10 pm
Contact:

Re: A question on ui.jumps

#3 Post by deltazechs »

Thanks for the quick reply, PyTom
"Darker than a moonless night, hotter and more bitter than hell itself. That is coffee." --- Godot, Phoenix Wright Ace Attorney: Trials and Tribulations

Post Reply

Who is online

Users browsing this forum: Dark79, Google [Bot], Majestic-12 [Bot]