SRL Archive - RS3 Outdated / Broken Scripts

Low HP + Random Alert


riskbling

2007-08-08 22:17:27

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.




I posted this on sythe and I got a script made, but two days later runescape updated with all this clan chat stuff.



History made this and it worked excellent till the update:

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.

Buckleyindahouse

2007-08-09 04:22:59

Training at the bandits is dangerous. I wouldn't AFK at all. I know a lvl 110 that died there running to use the bathroom really quick came back. Lost a fury,zerker ring and a whip along with full guthans. Dont AFK at bandits.

n3ss3s

2007-08-09 04:57:40

FFS I posted here yesterday a huge post but its gone?! Someone removed it propably :(

Dude

2007-08-09 05:02:52

Im really not sure, I've never made a script with scar but for my C++ experience this might work

if (HpPercent <25) //changed from 10 as per tails comment below
then
begin
PlaySound(SoundDirectory);
end;

Let me know if it works?

EDIT: for the random events… i was thinking something along the lines of

if FindNormalRandomsChoice(Talk:Flag, Misc:Flag, Lamp:Flag, Box:Flag, Demon:Flag, ScapeRune:Flag, Trade:Flag, GameTab:Flag, Pinball:Flag, Frog:Flag, Certer:Flag, Sandwich:Flag, Plant:Flag, Black:Flag, ClickContinue:Flag)
Begin
If (flag=true)
Begin
PlaySound(SoundDirectory);
end;

Now im not sure on syntax etc…its a newb idea but change and use as you will…

PS. The work you guys have done is amazing just reading through the function lists..wow

Tails111

2007-08-09 10:11:55

You might not want to use percent because lets say you have 60 health and 10 percent that gets done to 6 health before so maybe just a straight number would work better.

xxlegitxx

2007-08-09 16:24:11

http://www.villavu.com/forum/showthread.php?t=4984?t=5813

Try that. I'll update if need be when I get home.

riskbling

2007-08-09 23:20:29

Thats why you use a Ring of life and not the other ring ;]