SRL Archive - OSR Help

[HELP]Can Some One have a look at this


Mark

2011-08-13 16:38:58

HI well im back from uni for awhile and back scripting for my fav games
had an idea to write a auto sleeper for a game called AnoutherWorld.

But for some reason my code doesn't output anything it finds the word but doesn't output the string to the debug screen

program AW_Sleeper;
{$I SRL/SRL.scar}
var
x,y,i,GlassBmp,AbilityDTM,AirDTM,AlikeDTM,BundieDTM:integer;
bb:string;

procedure FindSleepType;
var
a: array [1..5] of integer;
b: array [1..5] of string;
begin

a[1] := AbilityDTM; a[2] := AirDTM; a[3] := AlikeDTM;
a[4] := GlassBmp; a[5] := BundieDTM;

b[1] := 'Ability'; b[2] := 'Air'; b[3] := 'Alike';
b[4] := 'Glass'; b[5] := 'Bundie';

GlassBmp := DTMFromString('mwQAAAHic42RgYOAGYhEglgZiPiAWA2IXIHYHYlsg9gRidiBmBmIeqBp+IGYEYi4gFoTy////jxf/+vmTgRjASASGAwCmfhy0');

for i := 1 to 5 do
FindDTM(a[i],x,y,1,1,664,456);
Mouse(x,y,5,5,true);
i:=i;
if(i = 4)then
bb:= b[4];
Writeln('win');
Writeln(bb);
for i := 1 to 5 do
if not(FindDTM(a[i],x,y,1,1,664,456))then
Writeln('fail');
FreeDTM(0);
end;

begin
ActivateClient;
MouseSpeed:=(30);
FindSleepType;
end.

I also want to know am i going about this the right way should i use DTM's or Bitmaps. Can i load Bitmaps from a Url?. If so Do you have a particular one you use.

Troll

2011-08-13 16:43:54

Not sure if you know this but


for i := 1 to 5 do // this loop
FindDTM(a[i],x,y,1,1,664,456); // will only do this line
Mouse(x,y,5,5,true); // and not this line as you need to put begin under the for to do line
i:=i; // what does this do your saying, hey i want to set I to the value of its self

Just a quick look, hope i helped :)

Floor66

2011-08-13 16:54:21

Your logic is a bit messed up due to missing begin…ends

Is this it?

program AW_Sleeper;
{$I SRL/SRL.scar}

var
x, y, i, GlassBmp, AbilityDTM, AirDTM, AlikeDTM, BundieDTM: integer;
bb: string;

procedure FindSleepType;
var
a: array [1..5] of integer;
b: array [1..5] of string;
begin
a[1] := AbilityDTM;
a[2] := AirDTM;
a[3] := AlikeDTM;
a[4] := GlassBmp;
a[5] := BundieDTM;

b[1] := 'Ability';
b[2] := 'Air';
b[3] := 'Alike';
b[4] := 'Glass';
b[5] := 'Bundie';

GlassBmp := DTMFromString('mwQAAAHic42RgYOAGYhEglgZiPiAWA2IXIHYHYlsg9gRidiBmBmIeqBp+IGYEYi4gFoTy////jxf/+vmTgRjASASGAwCmfhy0');

for i := 1 to 5 do
begin
if FindDTM(a[i], x, y, 1, 1, 664, 456) then
begin
Mouse(x, y, 5, 5, true);
if (i == 4) then
begin
bb := b[4];
WriteLn('Win');
WriteLn(bb);
end else
WriteLn('Fail');
end;
end;

begin
ActivateClient;
MouseSpeed:= 30;
FindSleepType;
//Free your DTMs here
end.

Also why are you using "GlassBmp" but still loading a DTM in it? You could better call it GlassDTM then.

Mark

2011-08-13 17:20:29

:( Thanks guys but Still no work
ill explain what im trying to do
i Want the Specific array used from array a to be used in array b so if FindDTM used array a[4] then array b would match it


for i := 1 to 5 do
if FindDTM(a[i],x,y,1,1,664,456) then
Mouse(x,y,5,5,true);
bb:= b[i];
Writeln('win');
SendKeys(bb);
Writeln(bb);
else
Writeln('fail');
end;

Troll

2011-08-13 17:23:17

Your forgeting your begins and ends and other then that i not sure,

for i := 1 to 5 do
Begin
if FindDTM(a[i],x,y,1,1,664,456) then
BEgin
Mouse(x,y,5,5,true);
bb:= b[i];
Writeln('win');
SendKeys(bb);
Writeln(bb);
End else
Writeln('fail');
end;

Mark

2011-08-13 17:37:47

Ive tried with Begin's end;'s ect dont think that makes any odds in this case its puzzling me why its not printing out my string from the array used..:spongebob:

Floor66

2011-08-13 18:37:30

Try this:


program AW_Sleeper;
{$I SRL/SRL.scar}
var
x,y,i,GlassBmp,AbilityDTM,AirDTM,AlikeDTM,BundieDTM:integer;
bb:string;

procedure FindSleepType;
var
a: array [1..5] of integer;
b: array [1..5] of string;
begin

a[1] := AbilityDTM; a[2] := AirDTM; a[3] := AlikeDTM;
a[4] := GlassBmp; a[5] := BundieDTM;

b[1] := 'Ability'; b[2] := 'Air'; b[3] := 'Alike';
b[4] := 'Glass'; b[5] := 'Bundie';

GlassBmp := DTMFromString('mwQAAAHic42RgYOAGYhEglgZiPiAWA2IXIHYHYlsg9gRidiBmBmIeqBp+IGYEYi4gFoTy////jxf/+vmTgRjASASGAwCmfhy0');

for i := 1 to 5 do
begin
if FindDTM(a[i],x,y,1,1,664,456) then
begin
Mouse(x,y,5,5,true);
Writeln('win');
Writeln(b[i]);
end else
Writeln('fail');
end;
end;

begin
ActivateClient;
MouseSpeed:= 30;
FindSleepType;
//Free stuff here
end.

Mark

2011-08-13 19:37:53

Thanks Floor but ive already tried it like that also
i want my code to search through my DTM arrays to Find the DTM once found
it will use the same array number for my string array
at this time i only outputs the first array [1] ('Ability') but the DTM arraysvalue is [4] (GlassDTM)

repeat
i:=i+1;
begin
if FindDTM(a[i],x,y,1,1,664,456) then
begin
Mouse(x,y,5,5,true);//to make sure it finds the right word
Writeln('win');
SendKeys(b[i]);
Writeln(b[i]);
end else
Writeln('fail');
end;
until(FindDTM(a[i],x,y,1,1,664,456))
end;
end;

any other ideas im still stunned :/