[Solved] Turn conversation into a variable?

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
Rekoija
Newbie
Posts: 15
Joined: Wed Nov 20, 2019 3:19 pm
Contact:

[Solved] Turn conversation into a variable?

#1 Post by Rekoija » Wed May 27, 2020 10:46 am

Aight so, I want to make this code as simple to repeat as I can, it gets a bit annoying having to copy paste a conversation a bunch of times if there's an easier way.

So I've been wondering, is there some sort of way to turn a conversation into something that's really easy to call?

(gonna show you some code i definitely know won't work, but'll demonstrate what i'd like)

$ convo1 = (
if x = True:
xyz "blah blah"
else:
xyz "blergh"
)

and then somehow making the convo play whenever i use the variable?
it sounds like it'll be really complicated or even impossible, but i'm not super experienced with code, so who knows?
i'll post it just in case i'm wrong.

Thanks in advance!
(and if you know it's not possible, i'd also appreciate a reply saying that :D)
Last edited by Rekoija on Wed May 27, 2020 2:45 pm, edited 1 time in total.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3001
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Turn conversation into a variable?

#2 Post by Imperf3kt » Wed May 27, 2020 10:57 am

If you have something you want to repeat multiple times that'll never really change, you can just put it in its own label, put a return at the end, and use "call label_name" to make your script jump to the label, and back when it's done.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

Post Reply

Who is online

Users browsing this forum: AdventAnyx, Google [Bot]