Troll
2011-04-18 07:44:00
So i have done alot of my script, but my walking failed so im justing trying to get the fighting working (which it does), so my mainloop does not work, so i was hoping someone could help me finish this script. Also if you want to know where the script will work i could PM you my account which is there(Strong hold), thanks for any help :)
So fighting works the rest does not. But it does compile.
E:
If im not making it clear its the mainloop
{My first script}
{I wanted it to be all colour but i gave in for walking}
{Maybe in time walking will be colour}
{------------------DontTouch-------------------}
{----------------------|-----------------------}
{----------------------V-----------------------}
program new;
{$DEFINE SMART}
{$i SRL/SRL.scar}
{$i Reflection/Reflection.simba}
Var FightsFound,eats,BreakTime,TotalTime :Integer;
UsingFood :Boolean;
Type
Monster = Record
Colour,Toll :Integer;
Hue,Sat :Extended;
Uptext :String;
End;
Food = Record
UpText :String;
DTM :LongInt;
End;
{------------------EnterInfo-------------------}
{---------------------|------------------------}
{---------------------V------------------------}
Function FoodOrder:Array of String;
Begin
Result := ['FOOD DOES NOT WORK ATM']; // This are all the aviable foods, take out the ones your account will not use
//try to use only 2 or 3 or it will slow the script down, only use 1 food per account
UsingFood := False; //Are you using food?
BreakTime := 0*60*60; //TIme to break for if only using one person, only change the 1337 bit and it will be in mins
End;
Const
MembersWorld = False;//Load members world
Sever = 56;//sever no.
Procedure DeclarePlayers;
Begin
HowManyPlayers := 1; //How Many players?
CurrentPlayer := 0; //Player to start with?
NumberOfPlayers(HowManyPlayers); //Leave alone
{- To add more poeple Copy and past this bit, changine the number and change how many part
{-} With Players[0] Do
{-} Begin
{-} Name := ''; //If you dont know what to put here, ask on the forum as its too hard to explain here ;)
{-} Pass := ''; //same as above
{-} Nick := 'ill'; // A couple of letters of your user name
{-} Pin := ''; // Bank Pin, leave empty if you dont have one
{-} Member := False; //Are you a member
{-} Active := True; //Do you want to use this account
{-} Strings[1] := 'Flesh Crawlers'; //what to fight or be killed by
{-} Integers[1] := 1337*60*60; //CHange the 1337 to the amount of mins you want it to run until changing, will go
{-} End; //again but will do other accounts of break first
{- copy and past to here}
End;
{------------No need to go down here --------------------}
Function MonsterInfo(MonsterName:String):Monster;
Begin
Case Lowercase(MonsterName) Of
'flesh crawler':Begin
With Result Do
Begin
Colour := 1070453;
Toll := 4;
Hue := 0.05;
Sat := 0.32;
Uptext := 'Flesh Crawler';
End;
End;
'goblin':Begin
With Result Do
Begin
Colour := 1;
Toll := 1;
Hue := 1;
Sat := 1;
Uptext := '';
End;
End;
'cow' :Begin
With Result Do
Begin
Colour := 1;
Toll := 1;
Hue := 1;
Sat := 1;
Uptext := '';
End;
End;
End;
End;
Function GetLoc:String;
Var ToBankPath:TTileArray;
Begin
ToBankPath := [PointToTile(Point(3081,3421)),PointToTile(Point(3088,3433)),PointToTile(Point(3086,3447)),PointToTile(Point(3079,3460)),
PointToTile(Point(3079,3473)),PointToTile(Point(3086,3485)),PointToTile(Point(3093,3491))];
If MeInBox(IntToBox(1986,5244,1998,5230)) Then //Top left bottom right
Begin
Result := 'flesh crawler room';
Exit;
End;
If MeInBox(IntToBox(3090,3287,3099,3487)) Then //Top left bottom right
Begin
Result := 'bank';
Exit;
End;
Logout;
NextPlayer(False);//no know loc = never good
End;
Function OpenDoor(TileX,TileY,Xmove,Ymove,Height:Integer):Boolean;
Var DoorTile :TTile;
TileA,PointA :TPoint;
x,y :Integer;
Begin
TileA.x := TileX; TileA.y := TileY;
PointA := TileToMSEx(TileA,Xmove,Ymove,Height)
MMouse(PointA.x,PointA.y,2,2);
If Not WaitUptext('door',3000) Then
Exit;
GetMousePos(x,y);
Mouse(x,y,0,0,True);
Result := True;
End;
Procedure WalkTile(x,y:Integer);
Var tileA :TTile;
pointA:TPoint;
Begin
PointA.x := x; PointA.y := y;
TileA := PointToTile(PointA);
WalkToTile(tileA,2,0);
End;
Function WalkTo(Where:String):Boolean; //Monster will use current monster or bank
Var ToBankPath:TTileArray;
I :Integer;
Begin
If (Where = Lowercase('bank')) Then
Begin
Case GetLoc Of //to get outside
'flesh crawler room':Begin
WalkTile(1997,5245);
WalkTIle(2013,5244);
OpenDoor(2013,5242,0,1,1);
OpenDoor(2013,5239,0,2,1);
WalkTile(2019,5239);
OpenDoor(2019,5239,0,2,1);
OpenDoor(2019,5241,0,3,1);
End;
End;
WalkPath(ToBankPath);
If GetLoc = 'bank' Then
Result := True
End;
If (Where = Lowercase('monsters')) Then
Case MonsterInfo(Players[CurrentPlayer].Strings[1]) Of
'flesh crawlers':
Begin
For I:=High(ToBankPath) DownTo 0 Do
Begin
WalkToTile(TobankPath[I],2,0);
End;
//Some down lader stuff
//Some portal suff
//Some Down Lader stuff
//Some walk/door/door/walk/door/door/walk
If GetLoc = 'flesh crawler room' Then
Result := true
End;
End;
End;
Function FoodInfo(FoodName:String):Food;
Begin
Case Lowercase(FoodName) Of
'Lobster':Begin
With Result Do
Begin
DTM := DTMFromString('mLgAAAHicY2JgYNjIyMBgCcROQPwLyP///z8YwwAjFDMwAADWDwgo');
UpText := 'Lobster';
End;
End;
End;
End;
Function GetOutFood:Boolean;
Begin
Result := False;
End;
Function Eat:Boolean;
Var FoodArray :Array of String;
FoodDetails :Food;
I,x,y :Integer;
Begin
If Not UsingFood Then
If (HPPercent<10) Then
Begin
NextPlayer(False);
Logout;
End;
If Not LoggedIn Then Exit;
If (40>HPPercent) Then
If (HPPercent<0) Then
Begin
FoodArray := FoodOrder;
For I:= 0 To High(FoodArray) Do
Begin
FoodDetails := FoodInfo(FoodArray[I]);
GameTab(25);
If FindDTM(FoodDetails.DTM,x,y,MIX1,MIY1,MIX2,MIY2) Then
Begin
MMouse(x,y,RandomRange(-3,3),RandomRange(-3,3));
If WaitUptext(FoodDetails.UpText,3000) Then
Begin
GetMousePos(x,y);
If (Random(50)=17) Then
Begin
Mouse(x,y,0,0,False);
If WaitOption('Eat',2000) Then
Result := True
End Else Begin
Mouse(x,y,0,0,True);
Result := True
End;
If Result Then
Begin
Inc(eats);
Exit;
End;
End;
End;
End;
If WalkTo('Bank') Then
If GetOutFood Then
If WalkTo('Monster') Then
Begin
Result := True
Exit;
End;
//Now you should of exited if you have eaten, or gone to bank and came back, or not using food, if you are still here you have mucked up
Logout;
NextPlayer(False);
LogInPlayer;
End;
End;
{What i posted in the msi AntiBan thread = not stealing
http://villavu.com/forum/showthread.php?t=63219&page=2}
procedure MSI_ShakeMouse(Time: Integer);
var
x, y, timer, BottomX, BottomY, TopX, TopY: Integer;
begin
GetMousePos(x, y);
BottomX := X - RandomRange(10, 60);
BottomY := Y - RandomRange(10, 60)
TopX := X + RandomRange(10, 60);
TopY := Y + RandomRange(10, 60);
MarkTime(Timer);
while (TimeFromMark(Timer) < Time) Do
begin
MMouse(RandomRange(BottomX, TopX), RandomRange(BottomX, BottomY), 0, 0);
Wait(RandomRange(50, 100));
end;
end;
Procedure AntiBan;
Begin
FindNormalRandoms;
LevelUp;
If (Random(13)>9) Then
Case Random(15000) Of
1:RandomRClick;
2:HoverSkill('hitpoints',False);
3:PickUpMouse;
4:RandomMovement;
5:BoredHuman;
6:ExamineInv;
7:RandomAngle('up');
8:MSI_ShakeMouse(RandomRange(500,3000));
End;
End;
Procedure EatRandoms;
Begin
FindNormalRandoms;
Eat;
End;
Procedure MyWait(Time:Integer);
Var Marker:Integer;
Begin
MarkTime(Marker);
If (Time < 1000) Then //No Point in antiban if under a secound
Repeat
EatRandoms;
If (TimeFromMark(Marker)>Time) Then
Exit;
Until(False);
Repeat
AntiBan;
EatRandoms;
Until(TimeFromMark(Marker)>Time)
End;
Function FindFight(MonsterName:String):Boolean;
Var Info :Monster;
X,Y,I :Integer;
MonsterTPA :TPointArray;
MonsterT2D :T2DPointArray;
MonsterPoint :TPoint;
Begin
Info := MonsterInfo(MonsterName)
SetColorToleranceSpeed(2);
SetColorspeed2Modifiers(Info.Hue,Info.Sat);
If FindColorsSpiralTolerance(x,y,MonsterTPA,Info.Colour,MSX1,MSY1,MSX2,MSY2,Info.Toll) Then
If Length(MonsterTPA) > 1 Then
Begin
MonsterT2D := SplitTPAEx(MonsterTPA,3,3)
For I := 0 To High(MonsterT2D) Do
Begin
MonsterPoint := MiddleTPA(MonsterT2D[I])
MMouse(MonsterPoint.X,MonsterPoint.y,RandomRange(-3,3),RandomRange(-3,3));
If WaitUptext(Info.Uptext,2000) Then
Begin
MyWait(250);
GetMousePos(X,Y);
If Random(20) = 5 Then
Begin
Mouse(X,Y,0,0,False);
If WaitOption('Attack',5000) Then
Result := True
End Else Begin
Mouse(X,Y,0,0,True);
If WaitUptext(Info.Uptext,500) Then //SHould still be there
Result := True
End;
If Result Then
Begin
Inc(FightsFound);
MyWait(1001);
Exit;
End;
End;
End;
End;
End;
Function AreWeInFight:Boolean;
Begin
Result := (GetAnimation>0);
End;
Procedure WhileFighting;
Var Marker:Integer;
Begin
MarkTime(Marker);
While Not AreWeInFight Do
Begin
MyWait(1500);
If (TimeFromMark(Marker)>(1000*60*60*5)) Then
Exit;
End;
End;
Procedure StartUp;
Begin
Smart_Server := Sever;
Smart_Signed := True;
Smart_Members := MembersWorld;
Smart_SuperDetail := False;
SetupSRL;
DeclarePlayers;
MarkTime(TotalTime);
End;
Procedure Proggy;
Var TotalTime2:Extended;
Begin
writeln('Using '+IntToStr(HowManyPlayers)+' accounts');
writeln('You worked for '+ TimeRunning);
writeln('You find a fight '+IntToStr(FightsFound)+ ' -Does not mean killed');
writeln('You ate '+IntToStr(Eats)+' Times');
writeln('Thanks For using my first script');
End;
Procedure onTerminate;
Begin
Proggy;
End;
Procedure MainLoop;
Var Fails,Marker:Integer;
Begin
Repeat
If Not LoggedIn Then LogInPlayer;
Marker := 0;
MarkTime(Marker);
Repeat
//Need to be able to change what to attack and train later
If Not FindFight(Players[CurrentPlayer].Strings[1]) Then
Begin
Inc(Fails);
End Else
Fails := 0;
//Looting?
WhileFighting;
Eat;
//Now to check if we want to stop
If (Fails>=100) Then
Begin
writeln('Account '+IntToStr(CurrentPlayer)+' has logged out due to failing to find '+Players[CurrentPlayer].Strings[1] +' Now player is false');
NextPlayer(False);
Logout;
Break;
End;
If (TimeFromMark(Marker)>=Players[CurrentPlayer].Integers[1]) Then
Begin
writeln('Account '+IntToStr(CurrentPlayer)+' has logged out due to reaching time, now changing account or breaking');
NextPlayer(True);
Logout;
If (PlayersActive=1) Then
Begin
writeln('Breaking as only one player is active');
wait(BreakTime+Random(5*60*60));
End;
End;
If Not LoggedIn Then
Break;
Until(False)
NextPlayer(True);
Until(AllPlayersInactive)
End;
Begin {
StartUp;
MainLoop;}
SetupSRL;
FindFight('flesh crawler');
End.
So fighting works the rest does not. But it does compile.
E:
If im not making it clear its the mainloop