Results 1 to 5 of 5

Thread: Two Questions

  1. #1
    Join Date
    Jul 2008
    Posts
    79
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Two Questions

    FYI THIS ISN'T RUNESCAPE

    First Question

    I'm trying to get it to play music when I start the program. It pulls up a menu of things you can choose and I'm not finished yet but I wanted to put some music in. I tried the PlaySound(); function but when the program started I didn't hear anything. Here is my script.

    Code:
    program LuminaryAutoHunterV2;
    var
      frmDesign: TForm;
      background, inventory: TImage;
      exitbutton: TButton;
      b, w, h: Integer;
      huntersclass: TComboBox;
      attackinterval: TEdit;
      attacklabel: TLabel;
    
    procedure ButtonClick1(sender: TObject);
    begin
    writeln('closing form!');
    frmDesign.ModalResult:= mrOk;
    end;
              
    Procedure InitForm;
    begin
    
    {form}
    
    frmDesign := CreateForm;
    frmDesign.Caption := 'Luminary Auto Hunter';
    frmDesign.BorderStyle := bsNone;
    frmDesign.Width := 599;
    frmDesign.Height := 600;
    frmDesign.top := 100;
    frmDesign.Left := 100;
    frmDesign.Font.Color := ClWhite;
    
    {gui}
    
    background := TImage.Create(frmDesign);
    background.Parent := frmDesign;
    background.left := 0;
    background.top := 0;
    background.width := 600;
    background.height := 600;
    b := loadbitmap('C:\Program Files\SCAR 3.15\Includes\images\autohunter_gui2.png');
    getbitmapsize(b, w, h);
    copycanvas(getbitmapcanvas(b), background.canvas, 0, 0, w, h, 0, 0, w, h);
    
    {exit}
    
    exitbutton := TButton.Create(frmDesign);
    exitbutton.Parent := frmDesign;
    exitbutton.Caption := 'Close Form';
    exitbutton.left := 529;
    exitbutton.top := 570;
    exitbutton.width := 65;
    exitbutton.height := 25;
    exitbutton.OnClick := @ButtonClick1;
    
    {class}
    
    huntersclass := TComboBox.Create(frmDesign);
    huntersclass.Parent := frmDesign;
    huntersclass.Top :=320;
    huntersclass.Left := 360;
    huntersclass.Width := 200;
    huntersclass.Height := 20;
    huntersclass.Items.Add('Melee (Sword/Axe/Spear)');
    huntersclass.Items.Add('Ranged (Bow/Gun)');
    huntersclass.Items.Add('Mage (Cane)');
    huntersclass.Text :='Pick Your Hunting Class';
    huntersclass.Font.Color := ClBlack;
    
    {Attack Intervals}
    
    attackinterval := TEdit.Create(frmDesign);
    attackinterval.Parent := frmDesign;
    attackinterval.Top := 350;
    attackinterval.Left := 360;
    attackinterval.Width := 60;
    attackinterval.Height := 20;
    attackinterval.Text :='5';
    attackinterval.Font.Color := ClBlack;
    
    {Attack Interval Seconds}
    
    attacklabel := TLabel.Create(frmDesign);
    attacklabel.Parent := frmDesign;
    attacklabel.Top := 355;
    attacklabel.left := 440;
    attacklabel.Caption := 'Attack Interval (in seconds).';
    
    {Invetory Info}
    
    inventory := TImage.Create(frmDesign);
    inventory.Parent := frmDesign;
    inventory.Top := 380;
    inventory.Left := 30;
    inventory.width := 130;
    inventory.height := 205;
    b := loadbitmap('C:\Program Files\SCAR 3.15\Includes\images\inventory.bmp');
    getbitmapsize(b, w, h);
    copycanvas(getbitmapcanvas(b), inventory.canvas, 0, 0, w, h, 0, 0, w, h);
    
    end;
    
    procedure PlayMusic;
    begin
    PlaySound('C:\Program Files\SCAR 3.15\music.mp3');
    end;
    
    procedure SafeInitForm;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;
    
    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;
    
    procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;
    
    begin
      PlayMusic;
      SafeInitForm;
      SafeShowFormModal;
    end.
    It just beeps when I run the program ><

    Question Two

    I want to have a button in my GUI that says "Start Program" and when I hit that I want the whole thing to run and it to bring up the client window. When I alt + tab I want the program to end. I tried ActivateClient(); but it didn't work. Is that the right thing to use?

  2. #2
    Join Date
    Apr 2007
    Posts
    2,593
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think PlaySound only plays wmv...

  3. #3
    Join Date
    Jul 2008
    Posts
    79
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oh, thank you.

  4. #4
    Join Date
    Jan 2008
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It plays wav files
    For the Ultimate Monk Fisher: Ultra Monkfish n Bank Click Here


  5. #5
    Join Date
    Dec 2006
    Location
    Program TEXAS home of AUTOERS
    Posts
    7,934
    Mentioned
    26 Post(s)
    Quoted
    237 Post(s)

    Default

    yes wav format, and go ahead check my tutorial, and my powerchopper out i have added a music version....

    and i did make a tutorial just search for it.

    EDIT:
    here you go would be hard for you to find so i got it for you

    http://www.villavu.com/forum/showthr...ight=add+music

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
  •