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.
I was just wondering how to make exact same thing from Ren'Py just coded in Python language. My question is mainly based around labels in Ren'Py which can't be used in Python.
So here is example that's how code looks in Ren'Py:
label BATTLE_SKELETON:
if current_player.NAME == "Bob":
if current_player.STUN_DURATION < 1:
$ bob.CURRENT_PLAYER_TURN_TRUE()
$ enemy_members_list[res].ADD_ATTACK_MARKER()
$ res = ui.interact()
label BOB_BASIC_ATTACK:
$ enemy_members_list[res].REMOVE_ATTACK_MARKER
"Lets jump back to the label!"
jump BOB_BASIC_ATTACK
And here is exact same thing just written as Function so how can I make labels and jump to it like you wold do in Ren'Py?
def BATTLE_SKELETON(self):
if current_player.NAME == "Bob":
if current_player.STUN_DURATION < 1:
bob.CURRENT_PLAYER_TURN_TRUE()
res = ui.interact()
enemy_members_list[res].ADD_ATTACK_MARKER()
# <------------------------------------------ This line what do I put inside here label can't be used
enemy_members_list[res].REMOVE_ATTACK_MARKER
renpy.say(battle_narrator, "Lets jump back to the label!")
# <-------------------------------------- And here how do I make jumps like in Ren'Py?
Python is a structured programming language, which means control tends to occur in things like loops. By contrast, Ren'Py is an unstructured language, which is okay because visual novel programs tend not to loop.
Yes I know they can't be used I just wanted to know the example of making an "label similar feature" in Python. I'm trying to use your example but I'm getting error GameLogic not defined even if it is defined? Can you please provide me with full example of how things should be working in action?
I'm needing this because I prefer to have battle engine written in Python while I use Ren'Py for story and screen editing, effects etc...
Aw that's a shame it would be insanely helpful with coding of loops. Oh well thanks for the answer guess I will have to combine labels,jumps and functions together.