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.
-
ShippoK
- Veteran
- Posts: 348
- Joined: Wed Mar 28, 2012 8:59 pm
- Projects: Eyes of Gold (In-Progress)
- Organization: (Red Moon)
- Location: Glorious Nippon (A.K.A the USA)
-
Contact:
#1
Post
by ShippoK » Mon Dec 24, 2012 5:14 pm
I'm having some trouble...
I wanted a function which gave you the choice to either turn on/off the
'End Sentence Arrow' when reading the text. But I can't quite get it to work...
My problem is that whether I turn it
'on' or
'off', it stays
'on' no matter what.
Example:

This is when it's both
'on' and
'off' in the game.
Here's where I got the information to do it:
Link
In #Screens
Code: Select all
frame:
style_group "pref"
has vbox
label _("End Arrows")
textbutton _("On") action SetField(persistent, "arrow", True)
textbutton _("Off") action SetField(persistent, "arrow", False)
in #Script
Code: Select all
init python:
# Set the default value.
if persistent.arrow is True:
persistent.arrow = True
if persistent.arrow is False:
persistent.arrow = False
if persistent.arrow:
image arrow_pointred:
"arrow1red.png"
0.1
"arrow2red.png"
0.1
"arrow3red.png"
0.1
"arrow2red.png"
0.1
repeat
if persistent.arrow:
define r = Character("(Ryouka):", ctc="arrow_pointred", color="882C21")
Much Appreciated for those who took the Survey!

Eyes of Gold
[BL (Suspense) (+18)] IN-PROGRESS
Alternate Online
[(Friendship) (+10)] ON-HOLD
•
DeviantART• •
[Honest critique] -
'Honesty is its own reward.'•
-
nyaatrap
- Crawling Chaos
- Posts: 1824
- Joined: Mon Feb 13, 2012 5:37 am
- Location: Kimashi Tower, Japan
-
Contact:
#2
Post
by nyaatrap » Tue Dec 25, 2012 7:55 pm
How about if image is defined by ConditionSwitch? The code is just a whim (I don't know None work or not):
Code: Select all
ctc=ConditionSwitch("persistent.arrow==True", "animation(...)","persistent.arrow==False", None)
-
ShippoK
- Veteran
- Posts: 348
- Joined: Wed Mar 28, 2012 8:59 pm
- Projects: Eyes of Gold (In-Progress)
- Organization: (Red Moon)
- Location: Glorious Nippon (A.K.A the USA)
-
Contact:
#3
Post
by ShippoK » Wed Dec 26, 2012 1:11 am
nyaatrap wrote:How about if image is defined by ConditionSwitch? The code is just a whim (I don't know None work or not):
Code: Select all
ctc=ConditionSwitch("persistent.arrow==True", "animation(...)","persistent.arrow==False", None)
I've been having some trouble in how I should lay this code down.
By that, I mean I've spent two hours blindly places this code in random places.
I tried putting it in the 'define character ='
Code: Select all
define u = Character("(???):", ctc=ConditionSwitch("persistent.arrow==True", "arrow_pointred.png","persistent.arrow==False"), color="#4C4646")
Something like this, it says I need it to be an 'Even number of arguments'
I looked over some
Doc's. with the "Conditionswitch' statement.
Code: Select all
if persistent.arrow:
image arrow_point = ConditionSwitch("persistent.arrow==True", "arrow1grey.png"
0.1
"arrow2grey.png"
0.1
"arrow3grey.png"
0.1
"arrow2grey.png"
0.1
repeat, "persistent.arrow==False")
I even tried to do the 'if' statement... Failed completely.
Invalid syntax, WE MEET AGAIN!
It's the first time I've seen a code like this and it's leaving me stumped. I'm probably way off to what it's actually suppose to look like.
Much Appreciated for those who took the Survey!

Eyes of Gold
[BL (Suspense) (+18)] IN-PROGRESS
Alternate Online
[(Friendship) (+10)] ON-HOLD
•
DeviantART• •
[Honest critique] -
'Honesty is its own reward.'•
-
nyaatrap
- Crawling Chaos
- Posts: 1824
- Joined: Mon Feb 13, 2012 5:37 am
- Location: Kimashi Tower, Japan
-
Contact:
#4
Post
by nyaatrap » Wed Dec 26, 2012 3:53 am
Something like this
Code: Select all
define u = Character("(???):", ctc=ConditionSwitch("persistent.arrow==True","arrow_pointred", "persistent.arrow==False", "transparent"), color="#4C4646")
Code: Select all
image transparent = "#0000"
image arrow_pointred:
"arrow1red.png"
0.1
"arrow2red.png"
0.1
"arrow3red.png"
0.1
"arrow2red.png"
0.1
repeat
-
ShippoK
- Veteran
- Posts: 348
- Joined: Wed Mar 28, 2012 8:59 pm
- Projects: Eyes of Gold (In-Progress)
- Organization: (Red Moon)
- Location: Glorious Nippon (A.K.A the USA)
-
Contact:
#5
Post
by ShippoK » Wed Dec 26, 2012 4:43 pm
nyaatrap wrote:Something like this
Code: Select all
define u = Character("(???):", ctc=ConditionSwitch("persistent.arrow==True","arrow_pointred", "persistent.arrow==False", "transparent"), color="#4C4646")
Code: Select all
image transparent = "#0000"
image arrow_pointred:
"arrow1red.png"
0.1
"arrow2red.png"
0.1
"arrow3red.png"
0.1
"arrow2red.png"
0.1
repeat
You're awesome, the code works perfectly! Thanks for all the help.

Much Appreciated for those who took the Survey!

Eyes of Gold
[BL (Suspense) (+18)] IN-PROGRESS
Alternate Online
[(Friendship) (+10)] ON-HOLD
•
DeviantART• •
[Honest critique] -
'Honesty is its own reward.'•
Users browsing this forum: Bing [Bot], Ocelot