Page 1 of 1

Censor on and off Images via Custom Pref Button.

Posted: Sat Mar 01, 2014 5:06 pm
by ShippoK
(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!

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

Posted: Sat Mar 01, 2014 7:09 pm
by jw2pfd
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")

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

Posted: Sat Mar 01, 2014 9:54 pm
by ShippoK
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)