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.
-
RyuMaster
- Newbie
- Posts: 10
- Joined: Mon Apr 08, 2013 6:53 am
-
Contact:
#1
Post
by RyuMaster » Tue Apr 09, 2013 7:56 am
Hi! Is it possible to make functions from this block of code: (because I'm going to reuse it heavily)
show rose surprised_talk
rosec "Some text.{nw}"
hide rose surprised_talk
show rose surprised
rosec "Some text.{fast}"
So thay I could call it from anywhere like:
function (rose surprised, rose surprised_talk, "Some_Text")
I've tried this and that, but always end up with the errors
-
RyuMaster
- Newbie
- Posts: 10
- Joined: Mon Apr 08, 2013 6:53 am
-
Contact:
#3
Post
by RyuMaster » Wed Apr 10, 2013 4:58 am
Ah, I wasn't very clear. I want to pass custom parameter there, like
function (_image1, _image1_talk, _text)
so I wondered how to make such function to work, and will it understand all those "hide" and "show" statements inside it.
-
Alex
- Lemma-Class Veteran
- Posts: 2981
- Joined: Fri Dec 11, 2009 5:25 pm
-
Contact:
#4
Post
by Alex » Wed Apr 10, 2013 4:15 pm
Something like this?
Code: Select all
# Declare characters used by this game.
define e = Character('Eileen', color="#c8ffc8")
image a = "a.png"
image b = "b.png"
image c = "c.png"
label my_label:
show expression img_1
char1 "[text_1]"
show expression img_2
"..."
hide img_1
hide img_2
return
# The game starts here.
label start:
"Line 1"
$ img_1 = "a"
$ char1 = e
$ text_1 = "text 1"
$ img_2 = "b"
call my_label from call_1
"Line 2"
"Line 3"
$ img_1 = "c"
$ char1 = ""
$ text_1 = "text 2"
$ img_2 = "b"
call my_label from call_2
e "You've created a new Ren'Py game."
e "Once you add a story, pictures, and music, you can release it to the world!"
return
Users browsing this forum: No registered users