0 votes
by (440 points)
How can i put sound when ui-bar-toggle is clicked for stow and open ui-bar?

1 Answer

+1 vote
by (2.2k points)

Put this into your game's JavaScript. 

$('#ui-bar-toggle').on('click', function () {
  $.wiki(`<<audio "toggle_ui_bar" play>>`);
})

Don't forget to cache your audio file as per SugarCube docs.

by (440 points)
And if I want this only make when one Variable =1, and no make when a variable is 0? Thanks for Help Notkostas...
by (2.2k points)

If you want to provide "Mute" button for player, I think it's more easily achieved using <<masteraudio>> macro

Or something like this:

$('#ui-bar-toggle').on('click', function () {
  $.wiki('<<if $myVariable eq 1>><<audio "toggle_ui_bar" play>><</if>>');
})

 

by (440 points)
Thanks ... sorry for the noob question ... This worked perfectly.
by (2.2k points)
Glad to be of help:)
...