The most basic sound script is triggered off by someone clicking on a
door or spot.
ON SELECT {
"
" SOUND
}
This works for all midi and wav files. The MIDIPLAY command can be used
for midi files as well but the SOUND command does the same thing. Once a wav file is
triggered, there isn't a way to shut it off. However, the midi file is easily
interruptable with the following command typed into the text box: /
MIDISTOP.
You can easily program in a shortcut for your users by using an OUTCHAT
command. This means that if the user types in the special command, usually 'ms', the Midi
file automatically stops playing. The user does not need to know the exact filename of the
midi playing. It will not affect any one else in the room who may be listening to the midi
as well. This can be done by adding an section to your script (highlighted in italics),
for e.g.:
ON SELECT {
"
"SOUND
}
ON OUTCHAT {
{"
" MIDISTOP } CHATSTR "ms" == IF
}
If you wish to provide a jukebox in your palace, check out the jukebox
scripts at the Script Barn. You can choose to implement it with elaborate graphics or use
a simple list triggered by OUTCHAT commands.
Sounds that play upon entry tend to be ambient sounds or a greeting
message. If this is part of a room tour, ensure that you provide a seperate room for
people to predownload the sound before entering that room otherwise, they will not hear
the sound the first time.
Predownloading sounds can be done in two ways.
The Upfront way - via the simple ON SELECT function:
Label: To predownload sounds click here...
Script: ON SELECT {
"
" SOUND
"
" SOUND
"
" SOUND
;and so on
}
The Sneaky way - via an ON ENTER script:
Use a short wav as the first wav. Using one of the sound effects supplied with palace is a
good idea. Then sneak in the wavs you wish the user to download after it. Place this
script in a 'entrance room' for your presentation.
Script: ON ENTER {
"debut"SOUND
"
" SOUND
"
" SOUND
;and so on
}
Getting Loopy
Some rooms - like waterfalls, fountains and fireplaces are favourite
targets of animation. To further enhance the atmosphere, a looped wav can be inserted.
ON ENTER {
0 ME SETALARM
}
ON ALARM {
"
" SOUND
400 ME SETALARM
}
What happens in this script is, that when you enter the room, an alarm
gets triggered which activates the script in that spot. 400 is the number of ticks before
the script is repeated again. (Modify it according to the duration you want) A tick is
roughly 1/60th of a second but in realtime, it is modified by the speed of your client and
server and network load.
A brief note on animations
To adequetely cover the topic of animation, I would probably have to
write a whole new document with chapters of its own. Since I am no animation expert, nor
talented enough to draw people without stick limbs, a round head and a smiley face, I feel
I would be out of my depth to embark on such a task. So here's an extremely short
introduction to them:
Animations on palace can be triggered or ambient. Examples of triggered
animations include - ghostly figures that appear when clicking on a spot, pictures that
appear by command etc. Popular ambient animations include running water, a flickering
flame, stars etc.
Each animation slice must be saved as a seperate gif file. Make sure
they are the same size otherwise you will get pictures out of synch with each other. When
you add them to a spot, each slice gets a spotstate number. The first slice is always 0.
Animations in palace work by cycling through these spotstates - either as a loop (ambient
animations) or simple spotstate changes (triggered animation).
Simple triggered animation script: (
SETSPOTSTATELOCAL)
ON SELECT {
1 5 SETSPOTSTATELOCAL
{0 5 SETSPOTSTATELOCAL} 300 ALARMEXEC
}
This script changes the spotstate in spot 5, to 1 therefore showing the
second animation slice. It reverts back to 0 (the first slice) after 300 ticks.
SETSPOTSTATELOCAL means that the statechange can only be seen by the person triggering it.
To make the whole room see the statechange, replace it with SETSPOTSTATE.
Simple looped animation script:
ON ENTER
{
50 ME SETALARM
}
ON ALARM
{ { 0 ME SETSPOTSTATELOCAL }
{ ME GETSPOTSTATE 1 + ME SETSPOTSTATELOCAL }
ME GETSPOTSTATE 1 > IFELSE
50 ME SETALARM
}
This looped scripts works only with 3 sliced loops. You need to modify
the number in the 3rd line after ON ALARM to the number of slices you have in your loop -2
slices. The 4th line sets how quickly each frame is to be shown.
WARNING... don't make that number too small otherwise you may get killed
from your own palace for 'flooding' everytime that script is activated.
For a great example of a combination of looped sound and ambient
animation, check out Edge of Heaven's fountain.
Ok, now that you have absolutely no idea what I'm talking about, have a
look in Ori's Palace Instructions for
more detailed explainations of everything I have mentioned here.