Troll
2010-10-20 16:15:29
Ok well i would like it if you comment on my reflection scirpt ive been making. Its my first so be ready for a pretty bad one with a lot of code of tuts but this is just for my learning :) Also it compiles but dose not seem to run right, it does not alway click cows and sometimes misses them.
Thanks
Thanks
Program ReflectionBasic;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}
Const
{---SMART Setup Constants---}
WORLD = 16;
MEMBERS = false;
SIGNED = true;
{---------------------------}
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
With Players[0] Do
Begin
Name := '';
Pass := '';
Nick := 'joy';
Active := True;
Pin := '';
End;
End;
Function AttackCow(calf:Boolean) :Boolean;
Var NPCs : TNPCArray;
I,x,y : Integer;
CowTile : TPoint;
Begin
If Not LoggedIn Then Exit;
result := false;
If calf Then
NPCs := GetNPCsBy('Cow')
else
NPCs := GetNPCsBy('Cow calf');
If high(NPCs) > -1 Then // Should be -1, because a high of 0 means that one NPC was found, -1 means nothing was found
Begin
For i:= 0 To high(NPCs) Do
Begin
If (NPCs[i].Name = 'Cow') Then
Begin
writeln ('Found cow');
If TileOnMS (NPCs[i].Tile, 0) Then
Begin
If Not NPCs[I].Fighting Then
Begin
CowTile := TileToMS(NPCs[i].Tile,0);
MMouse(CowTile.x,CowTile.y,3,3);
If R_IsUpText('Cow') Then
Begin
GetMousePos(x,y);
If Random(15) = 5 Then // This means you have a 1 in 16 chance of clicking true
Begin
Mouse(x,y,0,0,true);
End Else
Begin
Mouse(x,y,0,0,False);
R_ChooseOption('ttac');
End;
Result := True;
End else Begin
writeln ('Did not find cow uptext!');
Wait(750);
End;
End Else writeln('cow in fight');
end else writeln ('Cow #'+inttostr(i)+' not on mainscreen [dont worry too much about this msg]');
End;
End;
End; writeln ('Warning, array has nothing in it');
End;
Procedure FindCowHide;
Begin
End;
Procedure Start;
Begin
Smart_Members := MEMBERS;
Smart_Server := WORLD;
Smart_Signed := SIGNED;
SetupSRL;
SetUpReflectionEx(true);
DeclarePlayers;
LoginPlayer;
Wait(1500+Random(1500));
End;
Function CheckInArea:Boolean;
Var Loc :TTile;
Begin
Result := False
If MeInBox(IntToBox(3153, 3354, 3205, 3153)) Then
Begin
Result := True
writeln('In Area');
End;
End;
{ // dont worry about this i need to add interfaces
Procedure BillTime;
Var NPCs : TNPCArray;
I,x,y : Integer;
BillTile,InvSlot : TPoint;
Begin
If Not LoggedIn Then Exit;
If Not InvFull Then Exit;
Repeat
i := 0
Inc(I);
If i >= 29 Then
Exit;
Until(GetItemNameAt(I) = 'Hide')
NPCs := GetNPCsBy('Bill');
If High(NPCs) > -1 Then
For i:= 0 To high(NPCs) Do
Begin
If (NPCs[i].Name = 'Bill') Then
Begin
writeln ('Found Bill');
If TileOnMS (NPCs[i].Tile, 0) Then
Begin
BillTile := TileToMS(NPCs[i].Tile,0);
MMouse(BillTile.x,BillTile.y,3,3);
If R_IsUpText('Bill') Then
Begin
GetMousePos(x,y);
Mouse(x,y,0,0,True);
if GetInterfaceText (236, 1) = '' then
If InvFull Then
writeln('porblem happened and not banked');
End;
End;
End;
End; }
Procedure MoveSomeWhere;
Var BL,TR,BR:TTileArray; //BL = Bottom left start TR = top right start
Begin
If Not LoggedIn Then Exit;
BL := [Tile(3936,2686), Tile(3943,2693)];
TR := [Tile(3950,2687)];
BR := [Tile(3940,2681), Tile(3931,2685)];
If MeInBox(IntToBox(3920,2682,3939,2697)) Then
Begin
WalkPath(BL);
Exit;
End Else If MeInBox(IntToBox(3945,2697,3969,2709)) Then
Begin
WalkPath(TR);
Exit;
End Else If MeInBox(IntToBox(3947,2683,3971,2873)) Then
Begin
WalkPath(BR);
Exit;
End Else writeln('MoveSomeWhere not working :(');
End;
Procedure MainLoop;
Var a,f,Fail:Integer;
ImMe :TMe;
Begin
If Not CheckInArea Then
Exit;
Fail := 0
Repeat
ImMe := GetMe
If Not ImMe.InFight Then
Begin
A := 0
Repeat
Wait(RandomRange(500,1000));
Inc(A);
Until(AttackCow(True) Or AttackCow(False) Or (A >= 5));
If (A >= 3) Then
Inc(F);
End;
If (F >= 3) Then
Begin
MoveSomeWhere;
Inc(Fail);
F := 0
End;
If (Fail >= 3) Then
Begin
writeln('Problem not finding cows');
Break;
End;
Until(InvFull)
If InvFull Then
//BillTime;
End;
Begin
Start;
MainLoop;
End.
Thanks for any help