Low Hp & Random Alert - Via sound -

Discussion in 'Script Requests' started by Matt1, Aug 4, 2007.

Low Hp & Random Alert - Via sound -
  1. Unread #1 - Aug 4, 2007 at 4:32 AM
  2. Matt1
    Joined:
    Apr 22, 2005
    Posts:
    70
    Referrals:
    10
    Sythe Gold:
    0

    Matt1 Member

    Low Hp & Random Alert - Via sound -

    Hi guys,
    I train at bandits and it is a training spot where the monsters will never stop attacking you if you have a zamarok item. You cant AFK forever because of randoms and due to the fact you will eventually need to eat.

    This is what I would want it to do:

    Play a sound when I reach "X" amount of hp (Ex.20) or when a random event pops up. However under no circumstance macro on my account. Meaning no moving the mouse no doing anything except simply playing a sound (prefer a path to a song ex: C:\song.mp3)

    Just an alert that there is no chance in hell of jagex knowing without invading your house and spying on you through your windows to see what your doing.

    I'd like input on what you think of this and I will pay you the price that you think is fair. If you decide your up for it post your estimate before hand.
     
  3. Unread #2 - Aug 4, 2007 at 1:17 PM
  4. the scar noob
    Joined:
    Jan 21, 2007
    Posts:
    620
    Referrals:
    0
    Sythe Gold:
    0

    the scar noob Forum Addict

    Low Hp & Random Alert - Via sound -

    i can handle that, don't have scar here though!
     
  5. Unread #3 - Aug 4, 2007 at 5:25 PM
  6. Matt1
    Joined:
    Apr 22, 2005
    Posts:
    70
    Referrals:
    10
    Sythe Gold:
    0

    Matt1 Member

    Low Hp & Random Alert - Via sound -

    Thanks for viewing my thread than :)
     
  7. Unread #4 - Aug 4, 2007 at 11:59 PM
  8. blind
    Joined:
    Jul 22, 2005
    Posts:
    341
    Referrals:
    0
    Sythe Gold:
    0

    blind Forum Addict
    Banned

    Low Hp & Random Alert - Via sound -

    matt, i could def use this script too.
     
  9. Unread #5 - Aug 5, 2007 at 8:31 AM
  10. HISTORY
    Referrals:
    0

    HISTORY Guest

    Low Hp & Random Alert - Via sound -

    working on it :) Give me some time.
     
  11. Unread #6 - Aug 5, 2007 at 9:42 AM
  12. HISTORY
    Referrals:
    0

    HISTORY Guest

    Low Hp & Random Alert - Via sound -

    Code:
    program alerter;  //by Evil Kukka or HISTORY
    //Drag the crosshir over the runescape client
    const
    UseForm='true';//"true" to use form, anythign else not to.
    //set up line 34 and 35 if not using form
    
    
    type
      TUser = record
        Name: string; // * User Name
        Nick: string; // * Screen Name for random detection
      end;
    
    var
      Players :TUser;
      Sounddirectory : string;
      minhp,x,y,ax,ay,NickNameBMP, ScapeRune : Integer;
    
    var
      frmDesign : TForm;
      Label1 : TLabel;
      Label2 : TLabel;
      Label3 : TLabel;
      Username : TEdit;
      Edit2 : TEdit;
      Button1 : TButton;
      Edit1 : TEdit;
    procedure setup;
    
    var a,b:string;
    begin
      if(not(UseForm='true'))then
      begin
        soundDirectory:='C:\Windows\';
        Players.Name:='username';
        minhp:=5;
      end;
      a:=UpperCase(Copy(Players.Name,1,1));
      b:=Copy(Players.Name,2,2);
      Players.Nick:=a+b;
    end;
    
    procedure buttonclick(sender: TObject);
    begin
    
      Players.Name:=Username.Text;
      soundDirectory:=Edit2.Text;
      minhp:=StrToInt(Edit1.Text);
      frmDesign.ModalResult:= mrOk;
    end;
    
    
    procedure InitForm;
    begin
      frmDesign := CreateForm;
      frmDesign.Left := 250;
      frmDesign.Top := 114;
      frmDesign.BorderStyle := bsDialog;
      frmDesign.Caption := 'Alerter by Evil Kukka aka HISTORY';
      frmDesign.ClientHeight := 65;
      frmDesign.ClientWidth := 272;
      frmDesign.Font.Color := clWindowText;
      frmDesign.Font.Height := -11;
      frmDesign.Font.Name := 'MS Sans Serif';
      frmDesign.Font.Style := [];
      frmDesign.Visible := False;
      frmDesign.PixelsPerInch := 96;
      Label1 := TLabel.Create(frmDesign);
      Label1.Parent := frmDesign;
      Label1.Left := 133;
      Label1.Top := 9;
      Label1.Width := 48;
      Label1.Height := 13;
      Label1.Caption := 'Username';
      Label2 := TLabel.Create(frmDesign);
      Label2.Parent := frmDesign;
      Label2.Left := 133;
      Label2.Top := 30;
      Label2.Width := 78;
      Label2.Height := 30;
      Label2.Caption := 'Link to music file';
      Label3 := TLabel.Create(frmDesign);
      Label3.Parent := frmDesign;
      Label3.Left := 56;
      Label3.Top := 51;
      Label3.Width := 58;
      Label3.Height := 13;
      Label3.Caption := 'Minimum Hp';
      Username := TEdit.Create(frmDesign);
      Username.Parent := frmDesign;
      Username.Left := 6;
      Username.Top := 3;
      Username.Width := 121;
      Username.Height := 21;
      Username.TabOrder := 8;
      Username.Text := 'Username';
      Username.Text :=LoadSetting('alerter','username');
      Edit2 := TEdit.Create(frmDesign);
      Edit2.Parent := frmDesign;
      Edit2.Left := 6;
      Edit2.Top := 27;
      Edit2.Width := 121;
      Edit2.Height := 21;
      Edit2.ParentShowHint := False;
      Edit2.ShowHint := False;
      Edit2.TabOrder := 9;
      Edit2.Text := 'Sound Directory';
      Edit2.Text:=LoadSetting('alerter','directory');
      Button1 := TButton.Create(frmDesign);
      Button1.OnClick:= @buttonclick;
      Button1.Parent := frmDesign;
      Button1.Left := 212;
      Button1.Top := 8;
      Button1.Width := 52;
      Button1.Height := 38;
      Button1.Caption := 'OK';
      Button1.TabOrder := 10;
      Edit1 := TEdit.Create(frmDesign);
      Edit1.Parent := frmDesign;
      Edit1.Left := 7;
      Edit1.Top := 49;
      Edit1.Width := 44;
      Edit1.Height := 16;
      Edit1.TabOrder := 11;
      Edit1.Text := '5';
      Edit1.Text := LoadSetting('alerter','minhp');
    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;
    procedure theform;
    begin
      SafeInitForm;
      SafeShowFormModal;
    end;
    
    function GetHpAmount: Integer;
    var
      T: TPoint;
      TmpResult: string;
      i: Integer;
    begin
      t.x := 650;
      t.y := 210;
      tmpResult := GetTextAtEx(T.x, T.y, 100, StatChars, False, True, 0, 5, -1, 2,
        True, tr_Digits);
      if (Trim(tmpResult) = '') then
        for i := 1 to 5 do
        begin
          tmpResult := GetTextAtEx(T.x + i, T.y, 100, StatChars, False, True, 0, 5,
            -1, 2, True, tr_Digits);
          if (Trim(tmpResult) <> '') then
            Exit;
        end
      else
        Result := StrToInt(Trim(tmpResult));
    end;
    
    
    
    
    
    
    const gTalkOldComputer = False;
    
    var
      gtalksBox, YelSkipBoxs: array of TBox;
    
    function FindTalk: Boolean;
    var
      ax, ay, yCount, zCount, Count2, x1, y1, x2, y2, Count1: Integer;
    begin
      begin
    
        if FindColor(ax, ay, 65535, 0, 0, 515, 334) then
        begin
    
          SetArrayLength(gtalksBox, 0);
          SetArrayLength(YelSkipBoxs, 0);
    
          while FindColorSkipBoxArray(ax, ay, 65535, 0, 0, 515, 334, YelSkipBoxs) do
          begin
    
            y1 := ay;
            if ( ( ay + 5 ) > 334 ) then y2 := 334 else y2 := ay + 5;
    
            x1 := ax; x2 := x1;
            zCount := 0;
    
            repeat
              if FindColor(ax, ay, 65535, x2, y1 + 2, x2 + 3, y2 + 3) then
                zCount := 0
              else
                zCount := zCount + 1;
    
              if ( zCount = 4 ) then Break;
              x2 := x2 + 3;
            until ( x2 + 3 > 515 );
    
            if ( x2 + 3 <= 515 ) then x2 := x2 - 12;
    
            if (x2 - x1 >= length(Players.Nick) * 4) then
            begin
    
              x1 := x1 - 8;
              y1 := y1 - 8;
              x2 := x2 + 8;
              y2 := y2 + 8;
    
              if ( x1 < 0 ) then x1 := 0;
              if ( y1 < 0 ) then y1 := 0;
              if ( x2 > 515 ) then x2 := 515;
              if ( y2 > 334 ) then y2 := 334;
    
              Count2 := Count2 + 1;
              Count1 := Count1 + 1;
              SetArrayLength(gtalksBox, Count2);
              gtalksBox[Count2 - 1].x1 := x1;
              gtalksBox[Count2 - 1].y1 := y1;
              gtalksBox[Count2 - 1].x2 := x2;
              gtalksBox[Count2 - 1].y2 := y2 + 6;
    
              SetArrayLength(YelSkipBoxs, Count1);
              YelSkipBoxs[Count1 - 1].x1 := x1;
              YelSkipBoxs[Count1 - 1].y1 := y1;
              YelSkipBoxs[Count1 - 1].x2 := x2;
              YelSkipBoxs[Count1 - 1].y2 := y2;
    
            end else
            begin
              y1 := y1 - 2;
              y2 := y2 + 8;
              x1 := x1 - 5;
              x2 := x2 + 5;
              if ( x1 < 0 ) then x1 := 0;
              if ( y1 < 0 ) then y1 := 0;
              if ( x2 > 515 ) then x2 := 515;
              if ( y2 > 334 ) then y2 := 334;
    
              Count1 := Count1 + 1;
              SetArrayLength(YelSkipBoxs, Count1);
              YelSkipBoxs[Count1 - 1].x1 := x1;
              YelSkipBoxs[Count1 - 1].y1 := y1;
              YelSkipBoxs[Count1 - 1].x2 := x2;
              YelSkipBoxs[Count1 - 1].y2 := y2;
            end;
          end;
    
          if ( GetArrayLength(gtalksBox) <> 0 ) then
          begin
            for yCount := 0 to GetArrayLength(gtalksBox) - 1 do
            begin
              if FindBitmapMaskTolerance(NickNameBMP, ax, ay, gtalksBox[yCount].x1, gtalksBox[yCount].y1, gtalksBox[yCount].x2, gtalksBox[yCount].y2, 0, 40) then
              begin
                WriteLn('Found your name');
                PlaySound(SoundDirectory);
                Result:=true;
              end;
            end;
          end;
        end;
      end;
    end;
    
    function FindName:boolean;
    var
      tmpx, tmpy: Integer;
    begin
      if (FindColor(tmpx, tmpy, 65535, 10, 25, 511, 334)) then
        begin
          if (FindBitmapMaskTolerance(NickNameBMP, x, y, 3, 3, 515, 336, 0, 40)) then
          Result:=true;
        end;
    end;
    
    function LoggedIn: Boolean;
    begin
      Result := (GetColor(421, 480) = 16777215);
    end;
    
    
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          procedure importantrandoms; begin writeln('A script made by Evil Kukka');writeln('Made for a request on sythe.org');writeln('may be reposted on other sites');writeln('Credits:SRL Anti-Randoms Sub include coders, ripped it totally=p');end;
    begin
      theform;
      Setup;
      SaveSetting('alerter','directory',soundDirectory);
      SaveSetting('alerter','username',Players.Name);
      SaveSetting('alerter','minhp',IntToStr(minhp));
      NickNameBMP := CreateBitmapMaskFromText(Players.Nick,upchars);
      if (ScapeRune = 0) then
      ScapeRune := CreateBitmapMaskFromText('ScapeRune', SmallChars);
      importantrandoms;
      repeat
        if(GetHpAmount<=minhp)then PlaySound(SoundDirectory);
        if(FindName)then PlaySound(SoundDirectory);
        if (GetColor(30, 418) = 0) and (GetColor(72, 429) = 0) then PlaySound(SoundDirectory);
        //dead
        if (FindColor(ax, ay, 11503238, 10, 350, 479, 433)) then PlaySound(SoundDirectory);
        //mime
        if (FindColorTolerance(ax, ay, 15395562, 129, 34, 129, 34, 4)) and
        (FindColorTolerance(ax, ay, 15395562, 378, 39, 378, 39, 4)) then PlaySound(SoundDirectory);
        //maze
        if FindBitmapMaskTolerance(ScapeRune, x, y, 17, 355, 300, 434, 10, 50) then PlaySound(SoundDirectory);
        //scaperune
         if ((GetColor(83, 431) = 0) and (GetColor(88, 418) = 0)) or
        ((GetColor(83, 430) = 0) and (GetColor(88, 417) = 0)) or
        ((GetColor(151, 426) = 0) and (GetColor(470, 393) = 0) and
        (GetColor(372, 370) = 128)) then PlaySound(SoundDirectory);
        //pinball
        if (FindColorTolerance(x, y, 11034756, 200, 90, 315, 200, 25)) or
        (FindColorTolerance(x, y, 617041, 200, 90, 315, 200, 25)) then PlaySound(SoundDirectory);
        //plant
        FindTalk;
        //talking randoms
        if(not(LoggedIn))then PlaySound(SoundDirectory);
      until(False)
    end.
    NOTE: Not tested.
     
  13. Unread #7 - Aug 5, 2007 at 2:48 PM
  14. Matt1
    Joined:
    Apr 22, 2005
    Posts:
    70
    Referrals:
    10
    Sythe Gold:
    0

    Matt1 Member

    Low Hp & Random Alert - Via sound -

    Hey thank you it works pretty good - Aside from one factor which is most likely my noob scar skills.

    ok so here is my path to my music file

    "C:\Documents and Settings\Matt\My Documents\My Music\04 Meaning In The Static.m4a"

    Do I need to put that in the scar folder or does it have to be .wmv it just kinda makes a noise since it cant find the audio filee or maybe i have something that prevents scar from doing that? im using itunes
     
  15. Unread #8 - Aug 5, 2007 at 3:41 PM
  16. the scar noob
    Joined:
    Jan 21, 2007
    Posts:
    620
    Referrals:
    0
    Sythe Gold:
    0

    the scar noob Forum Addict

    Low Hp & Random Alert - Via sound -

    is it history from srl forums, if it is than this shiould be a good script, lol :)

    EDIT: i made smething lk ethis (without scar) dunno how it works, dunno if it even works :D
    i think you should add player settings cause of nickname (for randoms).
    Code:
    program Low_Hp_And_Random_alert;
    {.include srl/srl.scar}
    
    {
    Can't check the unsolveble randoms like mimes acuse the functions to check that logs out
    the current player which isn't a good idea when you're fighting rofl :D
    So yea i can only do the others.
    }
    
    begin
    
    var
      HitPoints : Integer;
    
    const
      sound_path = '';//the path of the sound you want to be played, leave blank for default one in windows folder..
      hp_amount = 20;//number of hp to play sound when low health
      Skill = 'attack';//skill for lamp (genie)
    
    procedure PlayTheSound;
    begin
      if sound_path <> '' then
      begin
        PLaySound(sound_path);
      end else
      begin
        PlaySound(C:\WINDOWS\Media\tada.wav);
      end;
    end;
    
    procedure Low_Hp;
    begin
      HitPoints:= GetHP;
      if HitPoints =< hp_amount then PlayTheSound;
    end;
    
    Function FindFastRandoms: Boolean;//from Wt-Fakawi
    var
      i: Integer;
    begin
      for i:=1 to 6 do
      begin
        case I of
         1:  If SolvePinball then
               Result := True;
         2:  If FindQuiz then
               Result := True;
         3:  If FindDemon then
               Result := True;
         4: if FindLamp(Skill) then
              Result := True;
         5: if (FindNewBox) then
            begin
              Result := True;
              if (UseBoxSolver) then
                SolveBox
              else
                GambleNewBox;
            end;
         6: if FindTrade then
              Result := True;
        end;
        wait(1);
      end;
    end;
    
    procedure CheckRandoms;
    begin
      if FindFastRandoms then PlayTheSound;
    end; 
    
    begin
      SetupSRL;
      repeat
        Low_Hp;
        CheckRandoms;
      until(IsFKeyDown(10));
    end.
     
  17. Unread #9 - Aug 5, 2007 at 6:43 PM
  18. Matt1
    Joined:
    Apr 22, 2005
    Posts:
    70
    Referrals:
    10
    Sythe Gold:
    0

    Matt1 Member

    Low Hp & Random Alert - Via sound -

    Thank you scar noob, and I fixed my problem scar only plays wav files
     
  19. Unread #10 - Aug 5, 2007 at 9:29 PM
  20. blind
    Joined:
    Jul 22, 2005
    Posts:
    341
    Referrals:
    0
    Sythe Gold:
    0

    blind Forum Addict
    Banned

    Low Hp & Random Alert - Via sound -

    i get this error with scar noobs

    Failed when compiling
    Line 12: [Error] (14762:1): Identifier expected in script

    and i get this error with history's

    Failed when compiling
    Line 163: [Error] (163:41): Unknown identifier 'StatChars' in script
     
  21. Unread #11 - Aug 6, 2007 at 6:50 AM
  22. HISTORY
    Referrals:
    0

    HISTORY Guest

    Low Hp & Random Alert - Via sound -

    what version of scar are you using? I recommend SCAR DIVI 3.11.

    And yes it's me from srl :p
    The scar noob, your script would solve some of the randoms, oh and you have a begin and the beginning, remove it :p.
     
  23. Unread #12 - Aug 6, 2007 at 10:19 AM
  24. Matt1
    Joined:
    Apr 22, 2005
    Posts:
    70
    Referrals:
    10
    Sythe Gold:
    0

    Matt1 Member

    Low Hp & Random Alert - Via sound -

    The script was working good, but now that rs updated it no longer works :X
     
  25. Unread #13 - Aug 8, 2007 at 8:43 PM
  26. Matt1
    Joined:
    Apr 22, 2005
    Posts:
    70
    Referrals:
    10
    Sythe Gold:
    0

    Matt1 Member

    Low Hp & Random Alert - Via sound -

    Any chance you could update it :]?
     
  27. Unread #14 - Aug 9, 2007 at 2:00 AM
  28. HISTORY
    Referrals:
    0

    HISTORY Guest

    Low Hp & Random Alert - Via sound -

    Ill post The LoggedIn fucntion later.
     
  29. Unread #15 - Aug 9, 2007 at 7:02 AM
  30. the scar noob
    Joined:
    Jan 21, 2007
    Posts:
    620
    Referrals:
    0
    Sythe Gold:
    0

    the scar noob Forum Addict

    Low Hp & Random Alert - Via sound -

    lol sorry guys made it without scar :d
    working one:
    Code:
    program Low_Hp_And_Random_alert;
    {.include srl/srl.scar}
    
    {
    Can't check the unsolveble randoms like mimes acuse the functions to check that logs out
    the current player which isn't a good idea when you're fighting rofl :D
    So yea i can only do the others.
    }
    
    
    var
      HitPoints : Integer;
    
    const
      sound_path = '';//the path of the sound you want to be played, leave blank for default one in windows folder..
      hp_amount = 20;//number of hp to play sound when low health
      Skill = 'attack';//skill for lamp (genie)
    
    procedure PlayTheSound;
    begin
      if sound_path <> '' then
      begin
        PLaySound(sound_path);
      end else
      begin
        PlaySound('C:\WINDOWS\Media\tada.wav');
      end;
    end;
    
    procedure Low_Hp;
    begin
      HitPoints:= GetHP;
      if HitPoints <= hp_amount then PlayTheSound;
    end;
    
    Function FindFastRandoms: Boolean;//from Wt-Fakawi
    var
      i: Integer;
    begin
      for i:=1 to 6 do
      begin
        case I of
         1:  If SolvePinball then
               Result := True;
         2:  If FindQuiz then
               Result := True;
         3:  If FindDemon then
               Result := True;
         4: if FindLamp(Skill) then
              Result := True;
         5: if (FindNewBox) then
            begin
              Result := True;
              if (UseBoxSolver) then
                SolveBox
              else
                GambleNewBox;
            end;
         6: if FindTrade then
              Result := True;
        end;
        wait(1);
      end;
    end;
    
    procedure CheckRandoms;
    begin
      if FindFastRandoms then PlayTheSound;
    end;
    
    begin
      SetupSRL;
      repeat
        Low_Hp;
        CheckRandoms;
      until(IsFKeyDown(10));
    end.
    EDIT:
    nope wiat until srl it fixed :)
    nowone can auto (with a script that uses srl) now :(
     
< fishing guild fisher | Port sarim rune buyer >

Users viewing this thread
1 guest


 
 
Adblock breaks this site