SRL Archive - Senior Scripts and Snippets

SmartSetupEx


Smartzkid

2007-10-01 20:31:04

Runs smart with a worldnumber

Best version
procedure SmartSetupEx(worldnum: integer; hiDetail, signed: boolean);
var
prefix: string;
begin
case worldnum of
1: prefix := 'ul7';
2: prefix := 'ul8';
3: prefix := 'sl1';
4: prefix := 'po4';
5: prefix := 'po5';
6: prefix := 'sl10';
7: prefix := 'above2';
8: prefix := 'above3';
9: prefix := 'above4';
10: prefix := 'me5';
11: prefix := 'jolt8';
12: prefix := 'jolt9';
13: prefix := 'nl3';
14: prefix := 'nl4';
15: prefix := 'mn2';
16: prefix := 'mn3';
17: prefix := 'nav1';
18: prefix := 'nav2';
19: prefix := 'nl7';
20: prefix := 'nl8';
21: prefix := 'nl11';
22: prefix := 'nl1';
23: prefix := 'mn4';
24: prefix := 'mn5';
25: prefix := 'me6';
26: prefix := 'ul5';
27: prefix := 'nl5';
28: prefix := 'nl6';
29: prefix := 'ul6';
30: prefix := 'po7';
31: prefix := 'po8';
32: prefix := 'ul1';
33: prefix := 'at1';
34: prefix := 'at2';
35: prefix := 'at3';
36: prefix := 'at4';
37: prefix := 'nav3';
38: prefix := 'ny9';
39: prefix := 'ny10';
40: prefix := 'ny11';
41: prefix := 'ny12';
42: prefix := 'po2';
43: prefix := 'sl11';
44: prefix := 'at6';
45: prefix := 'ny13';
46: prefix := 'ny14';
47: prefix := 'above5';
48: prefix := 'above6';
50: prefix := 'ams2';
51: prefix := 'ams3';
52: prefix := 'ams4';
53: prefix := 'ams5';
54: prefix := 'me10';
55: prefix := 'ch1';
56: prefix := 'nl10';
57: prefix := 'ch3';
58: prefix := 'ch4';
59: prefix := 'ch5';
61: prefix := 'se1';
62: prefix := 'se2';
63: prefix := 'se3';
64: prefix := 'se4';
65: prefix := 'se5';
66: prefix := 'se6';
67: prefix := 'jolt10';
68: prefix := 'jolt11';
69: prefix := 'jolt12';
70: prefix := 'po6';
71: prefix := 'mn7';
72: prefix := 'nav9';
74: prefix := 'sl3';
75: prefix := 'sl4';
76: prefix := 'sl5';
77: prefix := 'sl6';
78: prefix := 'sl7';
79: prefix := 'sl8';
80: prefix := 'jolt1';
81: prefix := 'jolt2';
82: prefix := 'jolt3';
83: prefix := 'jolt4';
84: prefix := 'jolt5';
85: prefix := 'ny1';
86: prefix := 'ny2';
87: prefix := 'ny4';
88: prefix := 'ny5';
89: prefix := 'ny6';
90: prefix := 'ny7';
91: prefix := 'ny8';
92: prefix := 'nl9';
93: prefix := 'mi1';
94: prefix := 'mi2';
95: prefix := 'mi3';
96: prefix := 'mi4';
97: prefix := 'mi5';
98: prefix := 'mi6';
99: prefix := 'mi7';
100: prefix := 'ul3';
101: prefix := 'at7';
102: prefix := 'at8';
103: prefix := 'at9';
104: prefix := 'at10';
105: prefix := 'mn8';
106: prefix := 'mn9';
107: prefix := 'au1';
108: prefix := 'au2';
109: prefix := 'au3';
110: prefix := 'au4';
111: prefix := 'au5';
112: prefix := 'au6';
113: prefix := 'nav4';
114: prefix := 'nav5';
115: prefix := 'nav6';
116: prefix := 'nav8';
117: prefix := 'swe1';
118: prefix := 'swe2';
119: prefix := 'swe3';
120: prefix := 'swe4';
121: prefix := 'swe5';
124: prefix := 'swe8';
125: prefix := 'jlv9';
126: prefix := 'jlv2';
127: prefix := 'jlv3';
128: prefix := 'jlv4';
129: prefix := 'jlv5';
130: prefix := 'jlv6';
131: prefix := 'jlv7';
132: prefix := 'jlv8';
133: prefix := 'hel1';
134: prefix := 'hel2';
135: prefix := 'hel3';
136: prefix := 'hel4';
137: prefix := 'hel5';
138: prefix := 'hel6';
141: prefix := 'me1';
142: prefix := 'me2';
143: prefix := 'me3';
144: prefix := 'me4';
else
begin
prefix := 'ERROR';
writeln('Invalid world number');
TerminateScript;
end;
end;
SmartSetup(prefix, hiDetail, signed);
end; //~SK~\\

Shorter version, won't work if SCSS is messed up or out of date.

procedure SmartSetupEx(worldnumber: integer; hiDetail, signed: boolean);
var
prefix: string;
begin
prefix := ReadINI('World' + IntToStr(worldnumber), 'Prefix', AppPath + 'includes\SRL\SCSS\worlds.ini');
if(prefix = '')then
begin
writeln('Invalid world number or corrupted world list. Please review your settings');
TerminateScript;
end;
SmartSetup(prefix, hiDetail, signed);
end; //~SK~\\


Happy SMARTing :p

pwnaz0r

2007-10-01 20:37:15

Hah, I thought of making one of these, got to world 4 and said fck it. Thank you :D

Hobbit

2007-10-01 23:51:23

Very nice :)

test

Lorax

2007-10-02 09:03:43

I was just thinking of the shorter version when I read through the big one.. good job :) now you just need to implement - members/free and randomworld..

nielsie95

2007-10-02 09:41:43

Nice, though I like the second idea more :)
This might be useful:


function IsWorldMembers(World: Integer): Boolean;
begin
Result := InIntArray(
[54, 53, 143, 138, 24, 26, 27, 28, 31, 36, 39, 42, 44,
45, 46, 48, 56, 58, 59, 64, 65, 66, 144, 69, 70, 71,
76, 77, 78, 79, 82, 83, 84, 88, 89, 91, 92, 97, 98, 99,
100, 103, 104, 110, 111, 112, 114, 115, 116, 120, 121,
124, 129, 130, 131, 132, 137, 2, 6, 9, 12, 18, 22, 23],
World);
end;

function RandomWorld(Members, NoBusyWorlds: Boolean): Integer;
var
Ar: TIntegerArray;
begin
if Members then
Ar :=
[54, 53, 143, 138, 24, 26, 27, 28, 31, 36, 39, 42, 44,
45, 46, 48, 56, 58, 59, 64, 65, 66, 144, 69, 70, 71,
76, 77, 78, 79, 82, 83, 84, 88, 89, 91, 92, 97, 98, 99,
100, 103, 104, 110, 111, 112, 114, 115, 116, 120, 121,
124, 129, 130, 131, 132, 137, 2, 6, 9, 12, 18, 22, 23]
else
Ar :=
[1, 3, 4, 5, 7, 8, 10, 11, 13, 14, 15, 16, 17, 19, 20,
21, 25, 29, 30, 32, 33, 34, 35, 37, 38, 40, 41, 43, 47,
50, 51, 52, 55, 57, 61, 62, 63, 67, 68, 72, 74, 75, 80,
81, 85, 86, 87, 90, 93, 94, 95, 96, 101, 102, 105, 106,
107, 108, 109, 113, 117, 118, 119, 125, 126, 127, 128,
133, 134, 135, 136, 141, 142];
if NoBusyWorlds then
begin
if Members then
Result := Ar[RandomRange(15, 30)]
else
if (Random(2) = 0) then
Result := Ar[RandomRange(15, 30)]
else
Result := Ar[RandomRange(50, 70)];
end else
Result := Ar[Random(Length(Ar))];
end;


mastaraymond

2007-10-02 09:44:39

Ok this is mine:
Checks if other smarts are on the same world, checks the world with the least players and can do randomworlds and some other stuff.

~Raymond
{.include smart.scar}
var
Worlds,Temp : String;
Function FindWorlds(Members : Boolean): TIntegerArray;
var
I,j,K,T: integer;
WorldListArray : TStringArray;
WorldList : String;
begin;
WorldList := Between('d.write("</tr>");'#10'} ',#10'</script>',GetPage('http://www.runescape.com/slj.ws?lores.x=1&plugin=2&order=MPWLA'));
J := pos(';', WorldList);
repeat
SetArrayLength(WorldListArray, i + 2);
WorldListArray[i] := copy(WorldList, 1, J-1);
delete(WorldList, 1, pos(WorldListArray[i], WorldList)+Length(WorldListArray[i]));
i := i + 1;
J := pos(';', WorldList);
until(J = 0)
SetLength(WorldListArray,I);
SetLength(Result,100);
For I := 0 to Length(WorldListArray) -1 do
begin;
J := LastPos(',',WorldListArray[I]);
K := LastPosEx(',',WorldListArray[I],J);
if GetNumbers(Copy(WorldListArray[i],K+1,J-K-1)) <> '0' then
begin;
if members then if WorldListArray[I][Pos(',',WorldListArray[I])+1] = '1' then
begin;
Result[T] := StrToInt(Copy(WorldListArray[i],3,Pos(',',WorldListArray[I])-3));
inc(T);
end;
if not Members then if WorldListArray[I][Pos(',',WorldListArray[I])+1] = '0' then
begin;
Result[T] := StrToInt(Copy(WorldListArray[i],3,Pos(',',WorldListArray[I])-3));
inc(T);
end;
end;
end;
SetLength(Result,T);
end;

procedure SmartSetupEx(Worlds : TIntegerArray; SearchLessCrowded, Member, RandomizeArray, HighDetail, Signed: boolean);
var
Prefix : string;
Used : String;
I,L, II : Integer;
Randomized : TIntegerArray;
begin
SetLength(Randomized,L);
if SearchLessCrowded then
Randomized := FindWorlds(member)
else if RandomizeArray then
begin;
L := Length(Worlds);
For I:= 0 to L - 1 do
Repeat
II := Random(L);
if Randomized[II] = 0 then
Randomized[II] := Worlds[I];
until (Randomized[II] = Worlds[I]);
end else
Randomized := Worlds;
L := Length(Randomized);
Try
Used := ReadInterSCARMessage('SMART_Worlds');
For I:= 0 to L - 1 do
begin;
if pos('-'+inttostr(Randomized[I])+'-',Used) < 1 then
begin;
Prefix := ReadINI('World' + inttostr(Randomized[I]), 'Prefix', AppPath + 'includes\SRL\SCSS\worlds.ini');
if Prefix = '' then begin;
Writeln('Your world number is invalid! You used number: '+inttostr(Randomized[I]));
TerminateScript;
end;
SendInterSCARMessage('SMART___'+ Inttostr(GetSelf.Handle),IntTostr(Randomized[I]));
SendInterSCARMessage('SMART__'+ Inttostr(GetSelf.Handle),Prefix);
SendInterSCARMessage('SMART_'+ Inttostr(GetSelf.Handle),inttostr(Randomized[I]));
SendInterSCARMessage('SMART_Worlds',Used+'-'+inttostr(Randomized[I])+'-');
Writeln('Loading world '+inttostr(Randomized[I])+'_ '+prefix+' _'+Used);
SmartSetup(Prefix, HighDetail, Signed);
Exit;
end;
end;
except
end;
Writeln('Error or something like that, closing!');
TerminateScript;
end;

begin

Worlds := ReadInterSCARMessage('SMART_Worlds');
Temp := '-'+ReadInterSCARMessage('SMART_'+ Inttostr(GetSelf.Handle))+'-';
if Length(Temp) > 2 then
Delete(Worlds,Pos(Temp,Worlds),Length(Temp));
SendInterSCARMessage('SMART_Worlds',Worlds);
if LowerCase(Readln('Erase previous worlds: '+ ReadInterSCARMessage('SMART_Worlds'))) <> 'no' then
SendInterSCARMessage('SMART_Worlds','');

SmartSetupEx([], true,false,false,false, false);
// SmartSetup('ny4',false,false);
// SmartSetTarget;
SetTargetDc( SmartGetDC);
wait(5000 + random(5000));
repeat
wait(1000);
until(Smartgetcolor(231, 233)<>1118604);
//SmartClickMouse(741,480,true);
end.

Oh and here a small SetupSRL edit:

Procedure SetupSRL;
begin
{$ifdef smart}
if ReadInterSCARMessage('SMART__'+ Inttostr(GetSelf.Handle)) <> '' then
begin;
SmartSetup(ReadInterSCARMessage('SMART__'+ Inttostr(GetSelf.Handle)),false,false);
SetTargetDc(SmartGetDC);
end;
Disguise('SMART_'+ReadInterSCARMessage('SMART___'+ Inttostr(GetSelf.Handle))+' is running!');
{$endif}

The Claw

2007-10-02 09:54:36

From: mastaraymond
Ok this is mine:
Checks if other smarts are on the same world, checks the world with the least players and can do randomworlds en some stuff

~Raymond
{.include smart.scar}
var
Worlds,Temp : String;
Function FindWorlds(Members : Boolean): TIntegerArray;
var
I,j,K,T: integer;
WorldListArray : TStringArray;
WorldList : String;
begin;
WorldList := Between('d.write("</tr>");'#10'} ',#10'</script>',GetPage('http://www.runescape.com/slj.ws?lores.x=1&plugin=2&order=MPWLA'));
J := pos(';', WorldList);
repeat
SetArrayLength(WorldListArray, i + 2);
WorldListArray[i] := copy(WorldList, 1, J-1);
delete(WorldList, 1, pos(WorldListArray[i], WorldList)+Length(WorldListArray[i]));
i := i + 1;
J := pos(';', WorldList);
until(J = 0)
SetLength(WorldListArray,I);
SetLength(Result,100);
For I := 0 to Length(WorldListArray) -1 do
begin;
J := LastPos(',',WorldListArray[I]);
K := LastPosEx(',',WorldListArray[I],J);
if GetNumbers(Copy(WorldListArray[i],K+1,J-K-1)) <> '0' then
begin;
if members then if WorldListArray[I][Pos(',',WorldListArray[I])+1] = '1' then
begin;
Result[T] := StrToInt(Copy(WorldListArray[i],3,Pos(',',WorldListArray[I])-3));
inc(T);
end;
if not Members then if WorldListArray[I][Pos(',',WorldListArray[I])+1] = '0' then
begin;
Result[T] := StrToInt(Copy(WorldListArray[i],3,Pos(',',WorldListArray[I])-3));
inc(T);
end;
end;
end;
SetLength(Result,T);
end;

procedure SmartSetupEx(Worlds : TIntegerArray; SearchLessCrowded, Member, RandomizeArray, HighDetail, Signed: boolean);
var
Prefix : string;
Used : String;
I,L, II : Integer;
Randomized : TIntegerArray;
begin
SetLength(Randomized,L);
if SearchLessCrowded then
Randomized := FindWorlds(member)
else if RandomizeArray then
begin;
L := Length(Worlds);
For I:= 0 to L - 1 do
Repeat
II := Random(L);
if Randomized[II] = 0 then
Randomized[II] := Worlds[I];
until (Randomized[II] = Worlds[I]);
end else
Randomized := Worlds;
L := Length(Randomized);
Try
Used := ReadInterSCARMessage('SMART_Worlds');
For I:= 0 to L - 1 do
begin;
if pos('-'+inttostr(Randomized[I])+'-',Used) < 1 then
begin;
Prefix := ReadINI('World' + inttostr(Randomized[I]), 'Prefix', AppPath + 'includes\SRL\SCSS\worlds.ini');
if Prefix = '' then begin;
Writeln('Your world number is invalid! You used number: '+inttostr(Randomized[I]));
TerminateScript;
end;
SendInterSCARMessage('SMART___'+ Inttostr(GetSelf.Handle),IntTostr(Randomized[I]));
SendInterSCARMessage('SMART__'+ Inttostr(GetSelf.Handle),Prefix);
SendInterSCARMessage('SMART_'+ Inttostr(GetSelf.Handle),inttostr(Randomized[I]));
SendInterSCARMessage('SMART_Worlds',Used+'-'+inttostr(Randomized[I])+'-');
Writeln('Loading world '+inttostr(Randomized[I])+'_ '+prefix+' _'+Used);
SmartSetup(Prefix, HighDetail, Signed);
Exit;
end;
end;
except
end;
Writeln('Error or something like that, closing!');
TerminateScript;
end;

begin

Worlds := ReadInterSCARMessage('SMART_Worlds');
Temp := '-'+ReadInterSCARMessage('SMART_'+ Inttostr(GetSelf.Handle))+'-';
if Length(Temp) > 2 then
Delete(Worlds,Pos(Temp,Worlds),Length(Temp));
SendInterSCARMessage('SMART_Worlds',Worlds);
if LowerCase(Readln('Erase previous worlds: '+ ReadInterSCARMessage('SMART_Worlds'))) <> 'no' then
SendInterSCARMessage('SMART_Worlds','');

SmartSetupEx([], true,false,false,false, false);
// SmartSetup('ny4',false,false);
// SmartSetTarget;
SetTargetDc( SmartGetDC);
wait(5000 + random(5000));
repeat
wait(1000);
until(Smartgetcolor(231, 233)<>1118604);
//SmartClickMouse(741,480,true);
end.

Oh and here a small SetupSRL edit:

Procedure SetupSRL;
begin
{$ifdef smart}
if ReadInterSCARMessage('SMART__'+ Inttostr(GetSelf.Handle)) <> '' then
begin;
SmartSetup(ReadInterSCARMessage('SMART__'+ Inttostr(GetSelf.Handle)),false,false);
SetTargetDc(SmartGetDC);
end;
Disguise('SMART_'+ReadInterSCARMessage('SMART___'+ Inttostr(GetSelf.Handle))+' is running!');
{$endif}


Epic win :sasmokin:

Freddy1990

2007-10-02 10:45:54

/me wonders how SmartKidz made that nice function…

Something like this? :) :
=> FAWG Plugin: SmartSetupEx File Parser
=> Date: 02/10/2007
=> Author:
=> Options:
=> Output: SmartSetupEx.scar
[Add]procedure SmartSetupEx(worldnum: Integer; hiDetail, signed: Boolean);
[Add]var
[Add] prefix: string;
[Add]begin
[Add] case worldnum of
[Gen] %World%: prefix := '%Prefix%';
[Add] else
[Add] begin
[Add] prefix := 'ERROR';
[Add] writeln('Invalid world number');
[Add] TerminateScript;
[Add] end;
[Add] end;
[Add] SmartSetup(prefix, hiDetail, signed);
[Add]end;

Smartzkid

2007-10-02 15:44:28

:)

Actually, it was closer to this, but thanks, now I don't have to edit it every time I update:
=> FAWG Plugin: SCAR Array Parser
=> Date: 9/27/2007
=> Author: Smartzkid
=> Options:
=> Output: worlds.scar

[add]function GetWorldPrefix(worldnum: integer): string;
[add]begin
[add] case worldnum of
[gen] %World%: result := '%Prefix%';
[add] else
[add] begin
[add] result := 'ERROR';
[add] writeln('Invalid world number');
[add] end;
[add] end;
[add]end;