ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

No way to actively switch off playing sound !?

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

No way to actively switch off playing sound !?

Postby TommoHawk » Wed Aug 26, 2020 5:32 pm

I want to play a looping sound "vacuum cleaner" but then want the player to be able to switch off the vacuum cleaner by pressing the on/off switch. The on/off switch of the static vacuum cleaner being turned off won't stop the sound! Any suggestions?
User avatar
TommoHawk
 
Posts: 16
Joined: Mon Nov 10, 2003 5:13 pm

Re: No way to actively switch off playing sound !?

Postby Denk » Wed Aug 26, 2020 10:02 pm

Sure, you can switch sound on and off with tasks. ADRIFT can have 8 parallel sound channels so make sure you turn the right one off.

First, to play a looping audio file (example), put this text in the message field of the task:
adrift Code: Select all
The music is now playing...
<audio play src="C:\Users\kp\Desktop\IF\KPgames\Bash3\Creepy_Percussion_6.mp3" channel=1 loop=Y>
(replace path and file name [C:\Users\kp\Desktop\IF\KPgames\Bash3\Creepy_Percussion_6.mp3] with your own path and file)

Note that I have chosen channel 1. If I omit channel number, ADRIFT assumes channel 1.

To stop a looping audio file from the message field of a task:
adrift Code: Select all
The music has stopped...
<audio stop channel=1>


But I think I know why you could not get it to work. If the message field is completely empty, except from the audio tab, the audio tab will not be carried out!
It is easy to fix this by simple adding a single space in the message field. Then the audio tab will be executed.

If you still can't make it work, you can attach a taf-file which we can look at and then tell you what to do.
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
User avatar
Denk
 
Posts: 541
Joined: Mon Feb 22, 2016 6:21 pm
Location: Hjørring, Denmark
Points: 251

Re: No way to actively switch off playing sound !?

Postby TommoHawk » Thu Aug 27, 2020 11:21 am

Is there no easy "menu click" way to do this rather than code text? I want to teach very young children the basic creativity of making games without any coding. My only option was to simplify sounds in games to short sounds that never require to be shut off. e.g. Play sound for completing a task.
User avatar
TommoHawk
 
Posts: 16
Joined: Mon Nov 10, 2003 5:13 pm

Re: No way to actively switch off playing sound !?

Postby Denk » Thu Aug 27, 2020 4:28 pm

Instead of code, you can use the audio tab right of the message field of a task. But remember that the text field must not be completely empty. A single space is sufficient.
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
User avatar
Denk
 
Posts: 541
Joined: Mon Feb 22, 2016 6:21 pm
Location: Hjørring, Denmark
Points: 251


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 4 guests