SRL Archive - SRL Archives

All new functions by MasterKill


MasterKill

2007-10-30 12:22:06

Heey guys,

some stuff i made that should be in srl :) i'll update it evry time i made an new srl include :D

Stuffs:

* Function AutoResponder(FindText, SayText: TStringArray; LookInLastIntegerLines: integer): Boolean;
* Function NumberOfActive(UseWriteLn: boolean): Integer;
* Function FindEnemyOutAttack(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; AnemyHight, Tolerance: Integer): Boolean;
* Function PickItem(UpTexts: TStringArray; Colors: TIntegerArray; RChooseOption: String; Tolerance: Integer): Boolean;

Future stuffs:

* you i'll see that when i'm done, i don't want my idee get stolen

<—————————————————–>

AutoResponder(…): boolean;

{*******************************************************************************
Function AutoResponder(FindText, SayText: TStringArray; LookInLastIntegerLines: integer):Boolean;
By: MasterKill.
Description: If Found the FindText then random say one of the SeyTexts
Use: AutoResponder(['bot','auto','macro'], ['im not an bot!','im not ' +PlayerName,'whats that?'], 2);
Error: Use 'PlayerName' on own risk! scars GetTextAt is a lil buggy
*******************************************************************************}
var
PlayerName: String;
Function AutoResponder(FindText, SayText: TStringArray; LookInLastIntegerLines: integer):Boolean;
var
textx, texty, Ymod, GetNameTrys, Coordspace, SRT, R: Integer;
TextSayd, TextFound: String;
begin
If (LookInLastIntegerLines > 8) then
begin
WriteLn(' auto respond [ERROR] Wrong >LookInLastIntegerLines< not setted up correct:');
WriteLn(' error in Respond: ' + FindText[0]);
exit;
end;
case LookInLastIntegerLines of
1: Ymod := 441;
2: Ymod := 428;
3: Ymod := 414;
4: Ymod := 400;
5: Ymod := 386;
6: Ymod := 372;
7: Ymod := 358;
8: Ymod := 344;
end;
For R := 0 To (GetArrayLength(findtext)-1) Do
begin
if IsTextInAreaEx(8, Ymod, 291, 461, textx, texty, FindText[R], 12, smallchars, False, True, 0, 1, 16711680) then
begin
Coordspace := Texty;
//writeLn(IntToStr(Coordspace));
PlayerName := '';
Repeat
PlayerName := GetTextAtEx(12, (Coordspace), 0, SmallChars, False, False, 0, 5, 0, 40, False, tr_AllChars)
If Not (playerName = '') then Break;
GetNameTrys := GetNameTrys + 1;
Until not (PlayerName = '') or (GetNameTrys > 5)
Wait(2000);
if (Pos(Players[CurrentPlayer].Nick, PlayerName) > 0) then exit;
Result := True;
SRT := Random(GetArrayLength(SayText));
TypeSend(SayText[SRT]);
TextSayd := SayText[SRT];
TextFound := FindText[R];
responds := responds + 1;
WriteLn(' -Auto Respond');
If (Trim(PlayerName) = '') then
begin
PlayerName := 'Anonymous:';
WriteLn(' not found player name');
end;
WriteLn(' ' + Trim(PlayerName) +' ' + TextFound);
WriteLn(' ' + Players[CurrentPlayer].Name + ': '+ TextSayd);
WriteLn(' -Auto Respond');
If (PlayerName = 'Anonymous:') then
begin
Case Random(3) Of
0: PlayerName := 'dude'
1: PlayerName := 'sir'
2: PlayerName := 'noob'
end;
end;
end;
If (Result = True) then exit;
end;
end;

GetNameAtAx; idk, but i can't do it, it never finds the first/second char.

<—————————————————–>

NumberOfActive(…): Integer;

{*******************************************************************************
Function NumberOfActive(UseWriteLn: boolean): Integer;
By: MasterKill
Description: Result := number of players active.
*******************************************************************************}
Function NumberOfActive(UseWriteLn: boolean): Integer;
var
PActive, R: integer;
begin
for R := 0 To HowManyPlayers - 1 do
begin
if (Players[i].active = True) then PActive := PActive + 1;
end;
If UseWriteLn then WriteLn('we still got ' + IntToStr(PActive) + ' player[s] active.');
Result := PActive;
end;

simple one but usefull

Until(NumberOfActive = 0)
If (NumberOfActive = 0) then exit;

<—————————————————–>

FindEnemyOutAttack(…): Boolean;

{*******************************************************************************
function FindEnemyOutAttack(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; AnemyHight, Tolerance: Integer): Boolean;
By: Stupid3ooo and Starblaster100 and MasterKill
Description: Finds enemy with custom amount of colors and custom amount of Uptext
If the beast is in attack then look again for other.
Use: FindEnemyOutAttack(x, y, ['att', 'ack'], [123456, 345678], 40, 5)
AnemyHight: the size of the anemy in coörds! find the red/green hp balk in a aria of ... coörds
*******************************************************************************}
Function FindEnemyOutAttack(var cx, cy: Integer; Text: TStringArray; Color: TIntegerArray; AnemyHight, Tolerance: Integer): Boolean;
var
a, b, c, i, x1, y1, x2, y2, x3, y3: Integer;
Start: Boolean;
begin
For b := 0 to (GetArrayLength(Color)-1) do
Begin
if (FindColorSpiralTolerance(cx, cy, color[b], MSX1, MSY1, MSX2, MSY2, Tolerance)) then
Begin
Start := True;
Break;
end;
end;
If(Start)then
Begin
x1 := 245;
y1 := 165;
x2 := 277;
y2 := 185;
repeat
If not(LoggedIn)then
break;
a := a + 1;
If (a = 1) then
c := c + 1
else If (a = 3) then
c := c + 1;
For i := 1 to c do
Begin
If (a = 1) then
Begin
x1 := x1 + 30;
x2 := x2 + 30;
end else
If (a = 2) then
Begin
y1 := y1 - 20;
y2 := y2 - 20;
end else
If (a = 3) then
Begin
x1 := x1 - 30;
x2 := x2 - 30;
end else
If (a = 4) then
Begin
y1 := y1 + 20;
y2 := y2 + 20;
end;
If (x1 = 485) and (x2 = 517) then
x2 := x2 - 2;
If (y1 = 325) and (y2 = 345) then
y2 := y2 - 7;
If (x2 > 515) then
Break;
For b := 0 to (GetArrayLength(Color)-1) do
Begin
If (FindColorTolerance(cx, cy, Color[b], x1, y1, x2, y2, tolerance)) then
Begin
if (not FindColor(x3, y3, 65280, (cx - AnemyHight), (cy - AnemyHight), (cx + AnemyHight), (cy + AnemyHight))) or
(not FindColor(x3, y3, 255, (cx - AnemyHight), (cy - AnemyHight), (cx + AnemyHight), (cy + AnemyHight))) then
begin
MMouse(cx, cy, 0, 0)
Wait(random(50));
if (IsUpTextMultiCustom(Text)) then
Begin
Result := True;
Exit;
end;
end;
end;
end;
end;
if (a = 4) then
a := 0;
until (x2 > 515) or (Result = True);
end;
end;

<—————————————————–>

PickItem(…): Boolean;

{*******************************************************************************
Function PickItem(UpTexts: TStringArray; Colors: TIntegerArray; RChooseOption: String; Tolerance: Integer): Boolean;
By: MasterKill
Description: Pick's an item of the ground by rightclicking on it. then choose the selected option.
Use: PickItem(['Dragon','egs'], [23234, 2345432], 'pick', 5)
Result: true if one or more items are picked.
*******************************************************************************}
Function PickItem(UpTexts: TStringArray; Colors: TIntegerArray; RChooseOption: String; Tolerance: Integer): Boolean;
var
AllPicked: boolean;
begin
repeat
If FindObjCustom(x, y, UpTexts, Colors, Tolerance) then
begin
Mouse(x, y, 0, 0, False);
Wait(50);
if ChooseOption(RChooseOption) then
begin
Result := True;
Wait(100);
Flag;
Wait(500 + random(500));
AllPicked := False;
end;
end else AllPicked := True;
until AllPicked
end;

<—————————————————–>


more might come later

King of Knives

2007-10-30 12:50:03

Looks nice :D The "Autoresponder" looks fine. There is a spelling mistake, though. It's called "Anonymous" :D

-Knives

n3ss3s

2007-10-30 13:19:56

Bwuahaha, I made a thread for my functions too ;)

Meh, saves me posting everytime I create something.


Yes, the autoresponder indeed looks nice.

I wonder whats the idea of Tolerance in GetTextAtEx…

MasterKill

2007-10-30 13:20:17

From: King of Knives
Looks nice :D The "Autoresponder" looks fine. There is a spelling mistake, though. It's called "Anonymous" :D

-Knives


thanks :D

Anonymous: i'm a dysslect huh :rolleyes: rofl

From: n3ss3s
Bwuahaha, I made a thread for my functions too ;)

Meh, saves me posting everytime I create something.


Yes, the autoresponder indeed looks nice.

I wonder whats the idea of Tolerance in GetTextAtEx…


lawl thanks :)

does the Tolerance matter? :p

King of Knives

2007-10-30 13:26:58

I usually just use 150. Doesn't find anything wrong, so it can only be good to have.

-Knives

MasterKill

2007-10-30 14:39:00

oki, but i just want to find the color wich is needed ;)

added 2 Functions :)

The Claw

2007-11-01 07:59:52

From: n3ss3s
I wonder whats the idea of Tolerance in GetTextAtEx…


I think its for if the text is different colours, on different parts of it..like if you have the letter B, which is yellow at the top and red at the bottom. This sort of thing never happens in RS though, that I know of. Can someone confirm?

MasterKill

2007-11-01 10:26:57

I just added for in case of.

i guess the colors are not chane'ing.

If this will/won't be in srl you guys let me know?

JuKKa

2007-11-01 11:02:59

i doubt it will. People should just use add it them self, People wouldnt use it anyways (no offence)

mastaraymond

2007-11-01 11:09:32

All the average functions will not be in SRL. Only functions that are either, hard to make or are used a lot.

The Claw

2007-11-02 06:18:27

Yea, it is very rare for a non-dev to get a function into SRL. Mainly because all of the stuff that is either really good or really used is in SRL already, sorry. The only names i've seen in SRL that arent devs are Town and Iloveit8, i think

Santa_Clause

2007-11-02 06:44:48

Dark_Sniper too :)

Good job MasterKill…although the PickItem could be…a bit better…

MasterKill

2007-11-02 07:38:36

From: Santa_Clause
Good job MasterKill…although the PickItem could be…a bit better…


thanks. i know about the pickitem. i just made it and thought why shouldn't i post it ;)

the claw: the auto responder map is empty. maybe place mine there? :)

mastaraymond

2007-11-02 10:55:49

From: The Claw
Yea, it is very rare for a non-dev to get a function into SRL. Mainly because all of the stuff that is either really good or really used is in SRL already, sorry. The only names i've seen in SRL that arent devs are Town and Iloveit8, i think

IM IN IT TO! ^^

nielsie95

2007-11-02 11:09:18


SRT := Random(GetArrayLength(SayText)-1);

Now it'll never choose the last from the SayText array. Remove the -1 to let it work properly ;)

MasterKill

2007-11-02 11:11:37

From: nielsie95

SRT := Random(GetArrayLength(SayText)-1);

Now it'll never choose the last from the SayText array. Remove the -1 to let it work properly ;)


oh rofl nice found.

i thought it should be the same line players - 1 ect ect.

eddited now :)

but do you like it? or not?

Wizzup?

2007-11-02 11:20:01

From: MasterKill
I just added for in case of.

i guess the colors are not chane'ing.

If this will/won't be in srl you guys let me know?


Nope it won't be in SRL.
There's aren't functions that fit in SRL.

n3ss3s

2007-11-02 11:24:21

There's aren't functions that fit in SRL.


Grammar ;)

You ment 'These aren't functions that fit in SRL. ' ?

Anyways, yeah, I think SRL is for the general stuff which of you create functions for other things in your script.

The Claw

2007-11-02 20:29:12

From: n3ss3s
Grammar ;)

You ment 'These aren't functions that fit in SRL. ' ?


Grammar ;)

I think you meant "You meant "These aren't functions that fit in SRL."?"?

n3ss3s

2007-11-03 03:39:37

Okay okay Claw pwns lol…

Is it really meant? =/ Im used to ment xD no-one has noted anything before.. thx anyways.