SRL Archive - OSR Help

is it possible to play a sound?


ogustuce

2013-01-08 16:57:27

i think i saw that already in another script(cant remember which one). how to play a .wav in a script?

example of what i want to do:


if FindBlackChatMessage('yo dude') then
play alarm.wav


Ashaman88

2013-01-08 16:59:46

I think it's just Playsound(), but it's been awhile

I have it in my salamander script though if you want to check out the use of it

ogustuce

2013-01-08 17:00:27

kk thanks

ogustuce

2013-01-08 17:08:53

but how do you code the path to the sound? (where do you put the .wav and how to write the path to it?)

Ashaman88

2013-01-08 17:18:39

SoundPath:=ScriptPath+'noyelling.wav';

PlaySound(SoundPath);

soundpath is a string

That's from my sally script

ogustuce

2013-01-08 17:21:17

yeah i saw that but you must have 'noyelling.wav' somewhere on your computer for that to work, right? so whrere to put it? (ex: C:/simb/includes/)

Ashaman88

2013-01-08 17:22:25

From: ogustuce
yeah i saw that but you must have 'noyelling.wav' somewhere on your computer for that to work, right? so whrere to put it? (ex: C:/simb/includes/)


oh yeah it's just in the same folder as the script - which is why i used scriptpath (but you can do wherevers)

ogustuce

2013-01-08 17:42:18

kk ill try that out

ogustuce

2013-01-08 18:10:53

hmm I wrote something fast to check if it works but it doesnt do anything when i run it….. did i write something wrong?


program OgyAFK;

{$DEFINE SMART}
{$I SRL/SRL.Simba}


procedure DeclarePlayers;
begin
HowManyPlayers := 1; // Number of Players to use
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0; // Player to start with, first one is 0
Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Active := True; // just leave it as is.
Players[0].Pin := ''; // Bank Pin. Leave it if you don't have one.
Players[0].Integers[1] := 10000; // Number of loads
Players[0].Integers[2] := 375; // Xp For 1 Pouch Made <----------------------------------------
end;

var
SoundPath:string;

Procedure Alert;
begin
SoundPath:=ScriptPath+'Bang.wav';
PlaySound(SoundPath);
end;







begin
SRL_SixHourFix := True;
Smart_FixSpeed := True;
SetupSRL;
DeclarePlayers;
LogInPlayer;



repeat
alert;
wait(3000);
until (false)
end.


i should be hearing the .wav when i press play?

Rezozo

2013-01-08 18:11:49

Yea, as long as its in the same folder, it should find it.
~Rez

Edit: in the repeat-until you use in the main execution, try adding a wait? Might be mass playing the sound, so you wont hear it?

ogustuce

2013-01-08 18:16:36

still doenst work =/

Sax

2013-01-08 18:18:20

From: Ashaman88
SoundPath:=ScriptPath+'noyelling.wav';

PlaySound(SoundPath);

soundpath is a string

That's from my sally script


Ahah I remember running your salamander script and was browsing on internet and suddenly I hear a guy screaming: "No yelling on the bus!". And I was like WTF??? Then I noticed a guy walking by the hunter spot :D

Echo_

2013-01-08 18:36:55

Either your putting the sound in the wrong directory, or the file is messed up. You can check if it's in the correct directory by doing:

begin
if FileExists(ScriptPath + 'bang.wav') then
WriteLn('The file is there.')
else
WriteLn('The file isn''t there.');
end.

ogustuce

2013-01-08 18:39:49

nvm the problem is my .wav, i tried with ash's 'noyelling' wav and it works

Ashaman88

2013-01-08 18:49:43

NO YELLING ON THE BUS



glad you figured it out