Voice Refuses to Toggle Off [SOLVED]

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
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Voice Refuses to Toggle Off [SOLVED]

#1 Post by AsHLeX »

Thanks for reading this! As the title says, I can't seem to get my characters voice to toggle off (as in the " hotspot (556,300,87,56) action ToggleVoiceMute("m") and ToggleVoiceMute("g") and Return(value=None)" button does nothing, the voices still play as normal.

Code: Select all

init:
    $ man = Character("Man", voice_tag="m")
    $ girl = Character("Girl", voice_tag="g")

Code: Select all

voice "stop.ogg" 
    man "Are you going to stop me?"

Code: Select all

call screen toggle_voice

screen toggle_voice:
    key "dismiss" action [[]]
    imagemap:            
            ground "voice_acting_base.png"
            hover "voice_acting_hover.png"
        
            hotspot (422,302,71,50) action Return(value=None)
            hotspot (556,300,87,56) action ToggleVoiceMute("m") and ToggleVoiceMute("g") and Return(value=None)
I've attached my script files below if needed.
Thank you.
Attachments
screens.rpy
480-487 (screen toggle_voice)
(14.24 KiB) Downloaded 41 times
script.rpy
(22.42 KiB) Downloaded 55 times
Last edited by AsHLeX on Sat Feb 10, 2018 12:58 pm, edited 1 time in total.
Image
New demo out 24/12/23!!

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Voice Refuses to Toggle Off

#2 Post by Remix »

try
action [ ToggleVoiceMute("m"), ToggleVoiceMute("g"), Return(value=None) ]
Frameworks & Scriptlets:

User avatar
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Re: Voice Refuses to Toggle Off

#3 Post by AsHLeX »

Thanks for replying!
Tried that, still didn't work. :(
Image
New demo out 24/12/23!!

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Voice Refuses to Toggle Off

#4 Post by Remix »

It might be time to debug or consider just muting the entire voice channel ( ToggleMute("voice") )
Debug would be just an overlay screen showing the persistent._voice_mute data...

Code: Select all

screen show_mutes():
    $ mutes = "\n".join(persistent._voice_mute)
    text "Mutes:\n[mutes]"
init python:
    config.overlay_screens.append("show_mutes")
Frameworks & Scriptlets:

User avatar
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Re: Voice Refuses to Toggle Off

#5 Post by AsHLeX »

Tried that as well, but the debug screen doesn't display anything but "Mute:". I suspect there's a problem with the "off" button for whatever reason but I can't seem to figure out why.
"
Image
New demo out 24/12/23!!

User avatar
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Re: Voice Refuses to Toggle Off

#6 Post by AsHLeX »

Finally solved it! I don't know if it's what's actually causing the problem, but putting Return(value=None) at the end of a list of 'and'

Code: Select all

hotspot (556,300,87,56) action ToggleVoiceMute("m") and ToggleVoiceMute("g") and Return(value=None)
probably caused the program to run "ToggleVoiceMute("m")" and "Return(value=None)" at the same time so the return overrided the mute. (At least that's what my programmer friend said, he's not too sure about it either.)
But making another separate button like "Confirm" as Return solved this problem, so yay!
Thanks Remix for your help! :D
Image
New demo out 24/12/23!!

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Voice Refuses to Toggle Off [SOLVED]

#7 Post by Remix »

Tbh, using a list --- action [ Action, Action, Action ] --- would still semantically be better as python uses 'and' within conditional logic...
>>> print 1 and 1 and 1
1
>>> print 1 and 1 and 0
0
>>> print (1 and 0) and 1
0
Using and within the action could be interpreted as returning the result of the conditional rather than just running each action. I've never before seen anyone use and within multiple actions and I would be dubious of the return value if you needed a not None/False/0 result.

Glad you got it working anyway :)
Frameworks & Scriptlets:

User avatar
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Re: Voice Refuses to Toggle Off [SOLVED]

#8 Post by AsHLeX »

Thanks!
Image
New demo out 24/12/23!!

Post Reply

Who is online

Users browsing this forum: fufuffiero, Sugar_and_rice