Fixing F2 (ToggleSound) Issue with Companion: Difference between revisions

From Sierra Wiki
Jump to navigationJump to search
Andrew Branscom (talk | contribs)
m 1 revision imported
Andrew Branscom (talk | contribs)
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 12: Line 12:
==<br /> Introduction ==
==<br /> Introduction ==


As [[User:MusicallyInspired|Brandon]] has noted, sometimes it appears as though F2, or toggle sound, works and sometimes it does not. The problem arises out of sci companion's compiler. While there are no errors thrown, the compiled script fails to mute or unmute the sounds.
As [[Brandon Blume]] ([[User:MusicallyInspired|MusicallyInspired]]) has noted, sometimes it appears as though F2, or toggle sound, works and sometimes it does not. The problem arises out of sci companion's compiler. While there are no errors thrown, the compiled script fails to mute or unmute the sounds.


<div class="CodeBlockHeader">Code:</div>
<div class="CodeBlockHeader">Code:</div>
Line 42: Line 42:
Simply replace the whole procedure with this new one and the game will respond correctly regardless of which editor you use to compile the script.
Simply replace the whole procedure with this new one and the game will respond correctly regardless of which editor you use to compile the script.


==<br /> References ==
<references />
==<br /> Related Links ==
* &nbsp;
&nbsp;
&nbsp;
[[Category:Troubleshooting]]
[[Category:Troubleshooting]]
[[Category:SCI Troubleshooting]]
[[Category:SCI Troubleshooting]]

Latest revision as of 20:11, 28 April 2025

SCI Tutorials SCI Tutorials and Guides


Fixing F2 (ToggleSound) Issue with Companion
By Cloudee1



Introduction

As Brandon Blume (MusicallyInspired) has noted, sometimes it appears as though F2, or toggle sound, works and sometimes it does not. The problem arises out of sci companion's compiler. While there are no errors thrown, the compiled script fails to mute or unmute the sounds.

Code:
(procedure public (ToggleSound)
    (var SOUND_OFF)
    = SOUND_OFF DoSound(sndSET_SOUND)
    = SOUND_OFF DoSound( sndSET_SOUND not(SOUND_OFF) )
    (if(SOUND_OFF)
        SetMenu(MENU_TOGGLESOUND smMENU_TEXT "Turn On")
    )(else
        SetMenu(MENU_TOGGLESOUND smMENU_TEXT "Turn Off")
    )
)

Luckily, fixing the procedure isn't too difficult. The logic of the procedure, if you can play the sound then mute, otherwise unmute. Simple enough right? So here it is.

Code:
(procedure public (ToggleSound) // mute, unmute
    (if(DoSound(sndSET_SOUND)) // if true, mute
            DoSound(sndSET_SOUND FALSE)
            SetMenu(MENU_TOGGLESOUND smMENU_TEXT "Turn On")
        )
    (else  // must be false, unmute
            DoSound(sndSET_SOUND TRUE)
            SetMenu(MENU_TOGGLESOUND smMENU_TEXT "Turn Off")
        )
)

Simply replace the whole procedure with this new one and the game will respond correctly regardless of which editor you use to compile the script.


References



Related Links

  •