SRL Archive - OSR Help

What is the best way to make a script play a sound?


jimthesoundman

2010-02-11 21:44:05

I want all my scripts to play a sound whenever my name is mentioned in the chat box blue text. That way if I'm nearby, I can respond.

I know scar has the ability to play sounds but has anyone used this before? Any hints or tips would be appreciated.

Thanks in advance,

JIM

senrath

2010-02-11 21:48:57

PlaySound does work well. I used it in my Wine of Zamorak telegrabber with an invalid filepath to make it play the generic system error sound. But you could always use it to play other sounds as well (although I'm not sure what file types it supports).

Wanted

2010-02-11 21:50:55

Put a sound file (.WAV) in the same folder as the script you are using is saved then. Then just do

PlaySound(ScriptPath + 'FILENAMEHERE.WAV');

jimthesoundman

2010-02-15 05:17:45

I've been thinking more about this, and now I have a followup question:
Is there any way to make a script react to things in the SCAR debug box.

For instance, the function "FindNormalRandoms" will print out a message when it finds a MOD and terminate the script. I want it to play a sound at the same time.
Now, certainly I could just insert the PlaySound command inside the FindNormalRandoms script right before the line that prints out the ***FOUND MOD*** message, but for obvious reasons I don't want to do that. So instead I want a function that will play a sound when it sees those words in the dialog box. Any way to do that?

Thanks in advance,

JIM

i luffs yeww

2010-02-15 05:55:55

GetDebugLine or something. Just search for "debug" in the scar manual. ;)


procedure DeleteDebugLine(Line: Integer);
Deletes a line from the debug box.

function GetDebugLineCount: Integer;
Get the number of lines in the debug box.

function GetDebugText: string;
Gets the text in the debugbox.

function GetDebugLine(Line: Integer): string;
Returns a certain given line of the debug box.

procedure ClearDebugLine(Line: Integer);
Clears a certain line of the debug box.

procedure ReplaceDebugLine(Line: Integer; s: string);
Replaces a certain line of the debug box.

function GetDebugParams: TDebugParams;
Retrieves the default make-up settings for the debugbox.

procedure SetDebugParams(Params: TDebugParams);
Sets make-up settings for the next WriteLn to the debugbox.

And Naum has a tut about it.

jimthesoundman

2010-02-15 20:06:31

Well, that makes things easy, doesn't it?

Thank you!