In making a complex script involving heavy walking, (think mind runes
) I stumbled on a great set of new functions in SRL 4; MusicLocation.scar.
The included functions are good, but a little heavy for what i had planed, so I made this. To use this function, simply insert the name of the music that plays in the area you character is in. If that music is not found, the script exits.
Fast, and light! Hope you like it.
SCAR Code:
function CheckMusic(Music: string): Boolean; //By Cbris
var
PlayingMusic: string;
begin
PlayingMusic := GetMusic;
if (PlayingMusic = Music) then
begin
WriteLn(music + ' is playing, you are in the right place.');
end else
begin
WriteLn(music + 'is NOT playing, you are lost!');
WriteLn('exiting...');
TerminateScript;
end;
Result := True;
end;
To use simply copy and paste into you script and add the MusicLocation include.
SCAR Code:
{.include SRL/SRL/misc/MusicLocation.scar}