Some stuff :)
Firstly, in your declaring of your variables, try to clean it up.
You have:
var
//These are for my DTM's
DrinkStrPotDTM, CookedLobsterDTM, x,y, RScimmyDTM, R2HDTM, RBAxeDTM:integer;
//This is for my proggie
Kills : integer;//reports how many kills you got
DosesDrank : Integer;//Reports how many pot doses drank
Ate : Integer;//Reports how many lobs you ate
Target : Integer;//Reports how many you used BH Locate
Died : integer;//Reports how many times you died lol
Special, spam : Integer;//Reports how many spec attack you used
You don't need to tell everyone what each thing does! :D Honestly; most people don't care and less lines means smaller file which means happier people anyways. You could show it like this:
var
x,y: integer;
DrinkStrPotDTM, CookedLobsterDTM, RScimmyDTM, R2HDTM, RBAxeDTM:integer;
Kills, DosesDrank, Ate, Target, Died, Special, spam : Integer;
Notice how I shortened it ALOT and it still reads nicely. The comments were unneeded! :)
Standards, yours are wank haha. Well this is what you have:
procedure Waiting;
begin
wait(1000 + random(500));
MouseSpeed:=(MSpeed);
end;
Should be:
procedure Waiting;
begin
wait(1000 + random(500));
MouseSpeed := MSpeed;
end;
On a side note, is this really worth having a whole procedure? Unless you use it to check for randoms or something like that every second etc, is it really worth it? Also, whats with the MouseSpeed := MSpeed… it doesn't do anything haha. Oh and you don't need the brackets around MSpeed. Parenthesis are only used for math functions and declaring parameters.
Your DTM procedure:
//This loads the the cooked lobster DTM//
procedure LoadDTM;
begin
CookedLobsterDTM:= DTMFromString('78DA6314646060E06140013B9224182481342' +
'310FF07020021C70567');
DrinkStrPotDTM:= DTMFromString('78DA63E463606090644001572E8580851881F' +
'83F1000002E890639')
R2HDTM := DTMFromString('78DA63E4606060106640017E19C50C92409A1' +
'188FF0301002019055C');
RScimmyDTM := DTMFromString('78DA63E4626060E06340010E61F10C92409A1' +
'188FF0301001CBE0525');
RBAxeDTM := DTMFromString('78DA6364636060606540013601910C92409A1' +
'188FF0301233F90C185AAC62E38064C3342F900E0810610');
end;
Your DTM's seem small; or maybe mine are just big! But How many points are you using? You should be using one main point and three subpoints. All of the subpoints should be black and the main point should have a tolerance of about 10.
This is one of my DTM's compare the size:
'hammer': DTM := DTMFromString('78DA639464606078C08002C2ACB818B880342' +
'310FF0702462920E32A031A60442281B41A90B849408D28907843' +
'408D00116A40E63CC4AF060020E20A8C');
See what I mean, thats only for a hammer with 3 points… Yours should be the same size or maybe even bigger. :P
RunBack:
procedure RunBack;
begin
MakeCompass('n');
if(RadialRoadWalk(FindBhRoadColor,180 ,270 , 72, 5, 5))then
begin
RadialRoadWalk(FindBhRoadColor,180 ,270 , 72, 5, 5)
end;
end;
Standards boy, standards… ANYWAYS; you should have a global variable for the BH road color. So when you declare it in your vars you then assign the BH color to it! :)
For example:
var BHRoadColor : Integer;
procedure RunBack;
var z : integer;
begin
MakeCompass('n');
if BHRoadColor = 0 then
BHRoadColor := FindBHRoadColor;
MarkTime(z);
repeat
RadialRoadWalk(BhRoadColor,180 ,270 , 72, 5, 5)
until FindSymbol('bank', x, y) or (TimeFromMark(z) = 15000);
end;
Now, that procedure is very different. I removed the two RadialRoadWalks and made a Loop. The loop allows the script to keep walking until it finds the bank symbol, in which case it will stop walking. Or the loop has been running for 15s as a failsafe. That SHOULD get there from ANY of the caves. Also, if you want the script to walk to the bank from any compass angle, check out my Independant Compass Radial Walk… that way you don't have to use the MakeCompass('n') and it will walk from any angle.
Banking:
procedure Banking;
begin
MakeCompass('n');
wait(1000);
if(FindObjTPA(x, y, (Bcolor1),11,-1, 7, 7, 15, ['alk-to']))then
begin
Mouse(x,y,2,2,False);
Wait(300);
ChooseOption('ank');
Wait(3500);
DepositAll;
WithDraw((C1),(R1),(Lobbies));
CloseBank;
GameTab(4);
RunBack;
end else
if not(FindObjTPA(x, y, (Bcolor1),11,-1, 7, 7, 15, ['alk-to']))then
begin
MakeCompass('e');
wait(1000);
if(FindObjTPA(x, y, (Bcolor2),11,-1, 7, 7, 15, ['alk-to']))then
begin
Mouse(x,y,2,2,False);
Wait(300);
ChooseOption('ank');
wait(3500);
DepositAll;
WithDraw((C1),(R1),(Lobbies));
CloseBank;
GameTab(4);
RunBack;
end else
if not(FindObjTPA(x, y, (Bcolor2),11,-1, 7, 7, 15, ['alk-to']))then
begin
Banking;
end;
end;
end;
UGH STANDARDS!!!!!!! USE THEM! Either way; why do you have a MakeCompass North? The procedure shouldn't use that at all. You also have a wait right off the bat. You start waiting before the procedure starts… why? Anyways. You also bank EVERYTHING. That includes the 2h, and strength pots. Thats kinda useless eh? You need to make sure that you only deposit certain things. Randomness. You haven't got much. You have some in your Mouse but in your waits they are all exact. Thats just asking for a bank. Try:
Wait(200+random(150));
That would give you sufficient randomness. Also, you use if..then .. else wrong. The whole point of it is that if the function you call in the if statement is not what you want then it will run the else. So when you call:
if(FindObjTPA(x, y, (Bcolor1),11,-1, 7, 7, 15, ['alk-to']))then
begin
Mouse(x,y,2,2,False);
Wait(300);
ChooseOption('ank');
Wait(3500);
DepositAll;
WithDraw((C1),(R1),(Lobbies));
CloseBank;
GameTab(4);
RunBack;
end else
if not(FindObjTPA(x, y, (Bcolor1),11,-1, 7, 7, 15, ['alk-to']))then
begin
MakeCompass('e');
wait(1000);
end;
You are double calling, because the second one is not needed. The first calling will return a false, and hence the FindObjTPA is already going to return a false so the function is just repeating itself. Waste of some MS. Lastly, does this even work?
if not(FindObjTPA(x, y, (Bcolor2),11,-1, 7, 7, 15, ['alk-to']))then
begin
Banking;
end;
Can you call the current running procedure in the procedure you are running? It would create an infinite loop basically until the FindObjTPA returns true. Also, if you want to use two colors for a TPA function, maybe you should write your own :), just include two colors!
RunBank:
Read the RunBack, same things apply. Except you don't need to change GameTabs for SetRun. It automatically changes to tab 11, and back I think. Not sure on that one. Also remove your vars, you never use them.
EatLobster:
procedure EatLobster;
begin
GameTab(4);
if (FindDTM(CookedLobsterDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
Mouse(x,y,5,5,true);
writeln('Ate a cooked lobster!');
end else
writeln('You dont have a cooked lobster!');
exit;
end;
Firstly, standards. Thats getting pretty standard to say… Uhm your function has some useless lines. After an else, if you are having more than one line of code you need to include identifiers (begin, end). So, currently the procedure, if it doesn't find a lobster, it will just write the line and exit. Like it should I guess. Which leads to the exit doesn't need to be there. Also, why do you have the writeln's. The user cannot see the scar window, nor would they really care while pking! :D So, they aren't really needed. Also, you should almost make this a loop so it keeps clicking until the lobster disappears. My version of this might look like:
procedure EatLobster;
var z : integer;
color : string;
begin
GameTab(4);
if (FindDTM(CookedLobsterDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
Mouse(x,y,5,5,true);
Wait(300+random(200));
if ExistsItem(CoordsToItem(x, y)) then
begin
Mouse(x, y, 1, 1, true);
Wait(300+random(200));
end;
end;
end;
My version just checks that the lobster is eaten, and if its not then it retries once, if it is eaten it exits :). Also, the standards are now right.
DrinkPot:
Same as the latter explaination but why the MMouse?
JoinCC:
procedure JoinCC;
begin
GameTab(10)
Mouse(593,442,2,2,true);
wait(100)
TypeSend(ClanName); //This is for the clan chat
MMouse(285,182,5,5);
end;
Randomness in your waits; and what the MMouse for!? Also, you should make a MouseBox for the Join Chat button. Its a lot safer then using Coords.
BHLocate:
procedure BhLocate;
begin
GameTab(7);
Mouse(691,285,2,2,true);
MMouse(285,182,5,5);
end;
This is good, but why not try using a Bitmap and some If's for failsafes. Why not modify the CastSpell in Magic.scar for your needs. Remove the cases for it etc. WTH IS THE MMOUSE!?
StrPrayerOnOff, RangePrayerOnOff:
procedure StrPrayerOnOff;
begin
GameTab(6);
Mouse(718,305,2,2,true);
wait(50)
Mouse(569,339,2,2,true);
MMouse(285,182,5,5);
end;
//Turns eagle eye ON or OFF//
procedure RangePrayerOnOff;
begin
GameTab(6);
Mouse(568,377,2,2,true);
MMouse(285,182,5,5);
end;
Both of these functions could be combined into one. Also, you should have the option of turning on the Protect Item prayer, as well as piety and the other one haha. Both are used. You could combine these simply by using a case! Which you don't seem to use many of… Like so:
procedure PrayerOnOff(CombatType: string);
begin
GameTab(6);
case Lowercase(combatType) of
'melee' : begin
Mouse(718,305,2,2,true);
wait(100+random(100));
Mouse(569,339,2,2,true);
MMouse(285,182,5,5);
end;
'range' :
begin
GameTab(6);
Mouse(568,377,2,2,true);
MMouse(285,182,5,5);
end;
end;
end;
You should also look into checking if the prayers are on already and there is sufficient prayer points. You need to make sure the player defines the pking style in the constants if you want to use that case function I wrote. Here is a great procedure for F2p prayers by Mickalicious and Hy:
(*¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯\\
|| DoTehPrayer - Activates prayer 'emotes' ||
|| By: Mickaliscious / Edit by Hy71194 ||
\\_________________________________________________________________*)
procedure DoTehPrayer;
var Pray: integer;
begin
if not UsePrayer then
Exit;
if not LoggedIn then
Exit;
if Players[0].Strings[0] = '' then
begin
WriteLn('Please set a valid Fight String for '+Players[0].Name+'.');
WriteLn('Valid strings are: ''melee'', ''range'', or ''mage''.');
Exit;
end;
begin
Pray := Players[0].Level[5];
Wait(30 + Random(5000));
GameTab(6);
Wait(300 + Random(1000));
Inc(Anti);
Inc(ReportVars[9]);
case Players[0].Strings[0] of
'melee':
begin
if Pray > 33 then MouseBox(554,330,579,350,1) else // Incredible Reflexes
if Pray > 15 then MouseBox(633,258,653,275,1) else // Improved Reflexes
if Pray > 6 then MouseBox(632,222,651,238,1); // Clarity of Thought
if Pray > 30 then MouseBox(705,296,727,314,1) else // Ultimate Strength
if Pray > 12 then MouseBox(594,257,615,275,1) else // Superhuman Strength
if Pray > 3 then MouseBox(595,221,615,238,1); // Burst of Strength
end;
'range':
begin
if Pray > 43 then MouseBox(559,373,575,388,1) else // Eagle Eye
if Pray > 25 then MouseBox(596,298,614,313,1) else // Hawk Eye
if Pray > 7 then MouseBox(668,223,689,237,1); // Sharp Eye
end;
'mage':
begin
if Pray > 44 then MouseBox(594,369,616,387,1) else // Mystic Might
if Pray > 26 then MouseBox(631,297,653,314,1) else // Mystic Lore
if Pray > 8 then MouseBox(704,224,726,238,1); // Mystic Will
end;
end;
end;
end;
If you use this credit them!
SpecAttack:
procedure SpecAttack;
begin
GameTab(1);
Mouse(609,422,1,1,true);
MMouse(285,182,5,5);
end;
MMOUSE WTF!? and coord clicking is a nono. Make sure you use a MouseBox at least.
R2H:
procedure R2h;
begin
GameTab(4);
if (FindDTM(R2HDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
Mouse(x,y,5,5,true);
if not(FindDTM(R2HDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
end else
if (FindDTM(RScimmyDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
Mouse(x,y,5,5,true);
end else
if not(FindDTM(RScimmyDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
begin
if (FindDTM(RBAxeDTM, x, y, MIX1, MIY1, MIX2, MIY2)) then
Mouse(x,y,5,5,true);
end;
end;
Wow.. I'm confused. You have so many if statements I'm suprised the function compiles. Reread some of my earlier comments on if statements. and you have useless ones.. I'm not going to correct this one because I'm not sure I understand it.
Main:
procedure Main;
begin
//Ult str and incr reflex ON or OFF//
if(IsfKeyDown(Str)) then
begin
GameTab(6)
StrPrayerOnOff;
end else
//Walks bank deposits and witdraws//
if(IsfKeyDown(Banker))then
begin
RunBank;
end else
//Eagle eye ON or OFF//
if(IsfKeyDown(Range)) then
begin
RangePrayerOnOff;
end else
//Spec attack ON//
if(IsfKeyDown(SpecOn)) then
begin
SpecAttack;
Special :=Special + 1;//Adds a point to your spec'd
end else
//Bounty locate sepll//
if(IsfKeyDown(Locate)) then
begin
BhLocate;
Target :=Target + 1;//Adds a point to located
end else
//Join your ClanChat//
if(IsfKeyDown(CC)) then
begin
JoinCC;
end else
//Eat a lobster//
if(IsfKeyDown(Eat)) then
begin
EatLobster;
Ate :=Ate + 1;//Adds a point to lobs ate
end else
Waiting;
//Drink a str pot//
if(IsfKeyDown(Pot)) then
begin
DrinkPot;
DosesDrank :=DosesDrank + 1;//Adds a point to your potted
end else
//detects if you killed someone//
if(FindBlackChatMessage('You catch a lobster'))then
begin
Kills :=Kills + 1;//Adds a point to your kills
end else
//Detects if you got owned lol//
if(FindBlackChatMessage('You have been defeated'))then
begin
Died :=Died + 1;//Adds a point to death's
end else
//Switch to r2h adn back//
if(IsfKeyDown(Use2h))then
begin
R2h;
end;
end;
You made this much more complicated then it needed to be. You have all sorts of end elses for no reason.. and you have a wierd thing for seeing if you killed someone :rolleyes:. Here, I removed a lot…
procedure Main;
begin
if(IsfKeyDown(Str)) then // Combine these...
StrPrayerOnOff;
if(IsfKeyDown(Range)) then
RangePrayerOnOff;
if(IsfKeyDown(Banker))then
RunBank;
if(IsfKeyDown(SpecOn)) then
begin
SpecAttack;
Inc(Special);//Adds a point to your spec'd
end;
if(IsfKeyDown(Locate)) then
begin
BhLocate;
Inc(Target);//Adds a point to located
end;
if(IsfKeyDown(CC)) then
JoinCC;
if(IsfKeyDown(Eat)) then
begin
EatLobster;
Inc(Ate);//Adds a point to lobs ate
end;
//Waiting; <- USELESS! :( First time its called.. its not useful here at ALL.
if(IsfKeyDown(Pot)) then
begin
DrinkPot;
Inc(DosesDrank);//Adds a point to your potted
end;
if(FindBlackChatMessage('You catch a lobster'))then
Inc(Kills);//Adds a point to your kills
//Detects if you got owned lol//
if(FindBlackChatMessage('You have been defeated'))then
Inc(Died);//Adds a point to death's
if(IsfKeyDown(Use2h))then
R2h;
end;
Well, I changed a lot and found more errors. I left in a funny one, but you will have to find that. ANYWAYS. The command Inc(var) is a much faster way of doing:
var := var + 1;
It speeds up running time. Now, you had so many end elses that the script would most likely lag. Simple if's are suffice, if the key isn't down, the script continues down! :) also, after an if statement if there is only one line of code, no identifiers are needed. Also, the waiting procedure really is useless.. haha only place it is called.
Prog:
procedure Prog;
begin
Writeln('[]-------------------------------------------[]');
Writeln('Killed : ' + IntToStr(Kills) + ' Noobs');
Writeln('Drank : ' + IntToStr(DosesDrank) + ' str doses');
Writeln('Ate : ' + IntToStr(Ate) + ' lobs');
Writeln('Target : ' + IntToStr(Target));
Writeln('Special : ' + IntToStr(Special));
Writeln('You Died : ' + IntToStr(Died) + ' Times owned lol');
Writeln('[]--------------------------------------------[]');
end;
This looks fine, but if you want a nice fenced proggy, try using the Padr('') command. Its makes nice ones! :)
Program:
begin
LoadDTM;
activateclient;
repeat
main;
spam := spam + 1;
if spam = 5 then
begin
ClearDebug;
prog;
spam:= 0;
end;
until(false)
end.
Hmm, there are some subtle changes that can be made, like the Inc and things like that. Also, your progress report will come up EXTREMILY often. Maybe every half second? Its try making the number bigger. Also, you never setup SRL. You NEED to call it first. Well here is my edit:
begin
SetupSRL; // You forgot this.
LoadDTM;
activateclient;
repeat
main;
Inc(spam); // <- Inc(var x);
if spam = 20 then // test that, change it to what ever! :)
begin
ClearDebug;
prog;
spam := 0;
end;
until(Not LoggedIn) // This is a better finish, because if the player isn't logged in, its really not useful is it? So it might as well finish ;)
end.
Also you need to free your DTMs.
Okay, well this is your first script, and although you have a LOT to work on, gratz. You have come up with an original idea and I hope to see it come to fruition. Make sure that you learn… STANDARDS. Its obnoxious to read with out them.
If you need any help feel free to ask me for my msn.
Also, if you use any of my procedures, please credit.
Nava2.
P.S. That took like almost two hours… :(