Key shortcut jumps to a label

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
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

Key shortcut jumps to a label

#1 Post by monele » Wed Jun 28, 2006 3:25 am

I already use the curried_call_in_new_context (or something very close) but it does what it says : "call". Is there anyway to have the same thing do a "jump" ? I'd like to keep the possibility of rolling back and other things that the new context won't make possible.

User avatar
shaja
Regular
Posts: 73
Joined: Sun Oct 16, 2005 8:34 am
Contact:

#2 Post by shaja » Wed Jun 28, 2006 7:51 am

The python equivalent of the normal jump command is renpy.jump('label'), but there is no curried version of it, which is what you'd need to add to the keymap.

I took a few minutes to check how adding a curried version to the renpy source would work, but I'm not sure how to add it in just a game script file.

The result was that you could jump to a label using just a key, and then rollback to before the jump, but rolling forward after that would just go to the point where you hit the jump key.

PyTom will no doubt know exactly why it behaves like that, and whether the key-based jump could be saved in the rollback, but I don't. :)

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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:

#3 Post by PyTom » Wed Jun 28, 2006 8:32 am

Actually, there is a curried version of renpy.jump, and that's ui.jumps. Admittedly, that's one of the more non-orthagonal bits of Ren'Py. The jump will be saved in the rollback, but not in the roll-forward, since nothing is saved in the roll-forward.

One interesting thing is that roll-forward and roll-back are two different things. Roll-back is very complicated, while roll-forward simply skips the current statement iff it has already been encountered.

What are we trying to accomplish here? In general, I'd suspect using the keyboard isn't a good idea, as several keys are already bound to Ren'Py specific functionality, and in general the user should be given a choice of input device. (Mouse, Keyboard, or Joystick.)

User avatar
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#4 Post by monele » Wed Jun 28, 2006 1:26 pm

No worries, this is only for debugging purpose, ie. jumping to a menu of scenes, or at least to a central point in my game. So far I've curried_called a function that does the jump... but as to be expected, roll back doesn't work properly anymore :). Minor annoyance but I was scared it might imply other problems...

*just tried ui.jumps*... seems perfect ^^

Post Reply

Who is online

Users browsing this forum: _ticlock_