Results 1 to 15 of 15

Thread: is it possible to play a sound?

  1. #1
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default is it possible to play a sound?

    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:

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

  2. #2
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    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

  3. #3
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    kk thanks

  4. #4
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    but how do you code the path to the sound? (where do you put the .wav and how to write the path to it?)
    Last edited by ogustuce; 01-08-2013 at 10:11 PM.

  5. #5
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    SoundPath:=ScriptPath+'noyelling.wav';

    PlaySound(SoundPath);

    soundpath is a string

    That's from my sally script

  6. #6
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    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/)

  7. #7
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

    Default

    Quote Originally Posted by ogustuce View Post
    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)

  8. #8
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    kk ill try that out

  9. #9
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

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

    Simba Code:
    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?
    Last edited by ogustuce; 01-08-2013 at 11:17 PM.

  10. #10
    Join Date
    Dec 2011
    Location
    Nj
    Posts
    2,341
    Mentioned
    1 Post(s)
    Quoted
    18 Post(s)

    Default

    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?

    For the basics of the basics of pascal, try my TuT. ||Photoshop Editing ||MapleResourceDung Script || Book a flight! BuySellTrip

  11. #11
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    still doenst work =/

  12. #12
    Join Date
    Oct 2012
    Location
    Porto, Portugal
    Posts
    218
    Mentioned
    0 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by Ashaman88 View Post
    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

  13. #13
    Join Date
    Jan 2011
    Location
    Denver, CO
    Posts
    1,351
    Mentioned
    2 Post(s)
    Quoted
    72 Post(s)

    Default

    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:

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

  14. #14
    Join Date
    Feb 2012
    Posts
    224
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

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

  15. #15
    Join Date
    Dec 2011
    Location
    Hyrule
    Posts
    8,662
    Mentioned
    179 Post(s)
    Quoted
    1870 Post(s)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •