Censor on and off Images via Custom Pref Button.

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
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:

Censor on and off Images via Custom Pref Button.

#1 Post by ShippoK » Sat Mar 01, 2014 5:06 pm

(Been some time sense I've asked for some help.)
I've been having some trouble implanting a working censor option into my game. I had a similar issues with textbox arrows a while back and I was hoping it would work the same.

#Screens

Code: Select all

hotspot (35, 282, 117, 45) action SetField(persistent, "arrow", "non") activate_sound "Buttonexit.mp3" 
hotspot (167, 282, 117, 45) action SetField(persistent, "arrow", "arr") activate_sound "Buttonexit.mp3"
hotspot (376, 358, 181, 63) action SetField(persistent, "censor", "cen") activate_sound "Buttonexit.mp3" 
hotspot (571, 358, 181, 63) action SetField(persistent, "censor", "non2") activate_sound "Buttonexit.mp3"
#Script

Code: Select all

init -1 python: #Censored
    if persistent.censor:
        persistent.censor="cen"
    if not persistent.censor:
        persistent.censor="non2"
init -1 python: #Arrows
    if persistent.arrow: 
        persistent.arrow="arr"
    if not persistent.arrow: 
        persistent.arrow="non"
#Script

Code: Select all

image SxSceneHamaruRouteHamaruRyouka 1a = "ConditionSwitch("persistent.censor==True","zensoredSxSceneHamaruRouteHamaruRyouka 1a", "persistent.censor==False", "SxSceneHamaruRouteHamaruRyouka 1a")"
I've tried the Conditional Switch code above, but, I get a Syntax error; I might be using it the wrong way.
Any help is appreciated!
Much Appreciated for those who took the Survey!

Image Image
Eyes of Gold [BL (Suspense) (+18)] IN-PROGRESS
Alternate Online [(Friendship) (+10)] ON-HOLD
DeviantART• •[Honest critique] - 'Honesty is its own reward.'

jw2pfd
Regular
Posts: 87
Joined: Tue Sep 18, 2012 9:55 pm
Location: DFW, TX, USA
Contact:

Re: Censor on and off Images via Custom Pref Button.

#2 Post by jw2pfd » Sat Mar 01, 2014 7:09 pm

ShippoK wrote:

Code: Select all

image SxSceneHamaruRouteHamaruRyouka 1a = "ConditionSwitch("persistent.censor==True","zensoredSxSceneHamaruRouteHamaruRyouka 1a", "persistent.censor==False", "SxSceneHamaruRouteHamaruRyouka 1a")"
http://www.renpy.org/doc/html/displayab ... tionSwitch

As far as syntax goes, you definitely don't want quotes around the entire ConditionSwitch statement. It should look like this:

Code: Select all

image SxSceneHamaruRouteHamaruRyouka 1a = ConditionSwitch("persistent.censor==True","zensoredSxSceneHamaruRouteHamaruRyouka 1a", "persistent.censor==False", "SxSceneHamaruRouteHamaruRyouka 1a")

User avatar
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:

Re: Censor on and off Images via Custom Pref Button.

#3 Post by ShippoK » Sat Mar 01, 2014 9:54 pm

jw2pfd wrote:
Much thanks for that link, I got it working!
Here's an example for anyone else who needs it in the future.

Code: Select all

image SxSceneHamaruRouteHamaruRyouka 1a = ConditionSwitch(
"persistent.censor == 'cen'","zensoredSxSceneRyoukaHamaru1a.png", 
"persistent.censor == 'non2'", "SxSceneRyoukaHamaru1a.png",
"cen", "zensoredSxSceneRyoukaHamaru1a.png",
"non2", "SxSceneRyoukaHamaru1a.png")
I'll fiddle with it some more here and there just to make sure it works 100%.
Thanks again~ 8)
Much Appreciated for those who took the Survey!

Image Image
Eyes of Gold [BL (Suspense) (+18)] IN-PROGRESS
Alternate Online [(Friendship) (+10)] ON-HOLD
DeviantART• •[Honest critique] - 'Honesty is its own reward.'

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Ocelot