Your LoadImages procedure takes up more lines in this case because you only have one image, and you only call LoadImages in the main loop. It would be easier to just put it in the main loop (the bitmap).
You never free the bitmap RubyRing. It is bad practice to do this as this causes a memory leak each time you run the script. That bitmap will take up memory on your machine every time you run this script if you don't free it.
FindNormalRandoms will find all of the randoms and solve the ones it can. Therefore, calling FindLamp and SolveBox afterwards would be pointless because FindNormalRandoms would have already solved both of those if it found. If you want it to do the specific lamp skill, call it before FindNormalRandoms.
In FindNormalNats and FindNats, you should free the bitmap at the end of the function.
I am confused by your buyrings function. If it finds the gem stall symbol, then you look for the NPC and move the mouse there. Then, without talking to the NPC, you then click the gem stall symbol, then find the NPC.
Then in the else (if it didn't find the NPC), you have it click there like it did find him. I think what you meant to do was:
SCAR Code:
if (FindSymbolIn(x, y, 'gem stall', MMX1, MMY1, MMX2, MMY2) = true) then
begin
WriteLn ('Found gem stall.');
if (FindObjCustom(x, y, ['Talk-to Irk'], [2965826], 4) = false) then
begin
WriteLn ('Found Irksol.');
Wait(50 + random(10));
Mouse(x, y, 2, 2, false);
Wait(100 + random(50));
if (ChooseOption('rade') = true) then
begin
WriteLn ('In the shop menu.');
Wait (1000 + random (500));
MouseBox(73, 100, 84, 112, 3);
Wait (1000 + random (500));
if (IsUpText('uby')) then
begin
GetMousePos(x, y);
Mouse(x, y, 0, 0, false);
Wait (500 + random (100));
if (ChooseOption('Buy X')) then
begin
Wait(1100 + random(500));
TypeSend(IntToStr(RandomRange(26, 785)));
Wait(900 + random(500));
CloseWindow;
WriteLn ('Rings bought!');
Result:= true
end else
WriteLn ('We couldnt buy the rings!');
end;
end;
end else
begin
FindSymbolIn(x, y, 'gem stall', MMX1, MMY1, MMX2, MMY2)
Mouse(x + 12, y, 0, 0, true);
Wait(2500 + random (500));
if (FindObjCustom(x, y, ['Talk-to Irk'], [2965826], 4) = false) then
begin
WriteLn ('Couldnt find Irksol...');
LogOut;
TerminateScript;
end;
end;
When clicking the gem symbol, you should take advantage of SRL's function FFlag. You can wait until the mini map red flag is gone instead of using a wait:
SCAR Code:
FFlag(0); // waits until flag = gone
The parameter there is the distance from the flag to wait for.
If you are going to walk based off of symbols (which your next step should probably be to use a DDTM for more reliability), then you need to add a fair amount of randomness to your mouse, or else it can become detectable and bannable. You have the randomness parameters set to 0,0, which is a bad thing IMO.
In firstalch, you have:
SCAR Code:
procedure FirstAlch;
begin
begin
GameTab(tab_Magic)
if not FindColor(x, y, 1020586, 663, 371, 677, 381) then
Mouse(705, 452, 2, 2, true);
end;
Why have the begin/end there? They are not after an if/then or anything like that, they are just there for no reason.
SCAR Code:
procedure FirstAlch;
begin
GameTab(tab_Magic)
if not FindColor(x, y, 1020586, 663, 371, 677, 381) then
Mouse(705, 452, 2, 2, true);
In FirstAlch, add much more randomness to where you first click the spell. You hardly do any at all, it is almost the exact same coordinate every time.
In SecondAlch, this is not very random:
I would make it at least like random 400.
In Rest, add some randomness to how long the user said to rest.
Things like
Could simply be:
If you want.
SCAR Code:
until False;
begin
Terminate;
end;
Will never execute (in the main loop) because it goes until false and you never break out of the loop. If you want to do things when the script is terminated, add a procedure called OnTerminate. This procedure is automatically called when every script is stopped:
SCAR Code:
procedure OnTerminate;
begin
Terminate;
end;
Your main loop is a mess. I don't have the time to try to find all the problems with your logic in there, but consider trying to shorten it.
This is a great first script, and with some improvements and learning a few more advanced techniques I believe it could get you members real soon. Good job and good luck!
~JAD