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.
It just beeps when I run the program ><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.
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?


Reply With Quote







