what i want to do is to mak is do 0,1,2,3 in order. to what do i write?
ex:
case random(3) of -> execute randomly 0 to 3
case (3) of -> execute 3
what do i write there to make it do 0,1,2,3 in order?
(sorry for the noob question)
what i want to do is to mak is do 0,1,2,3 in order. to what do i write?
ex:
case random(3) of -> execute randomly 0 to 3
case (3) of -> execute 3
what do i write there to make it do 0,1,2,3 in order?
(sorry for the noob question)
hmm okay, ill try. lets take this procedure :
Simba Code:Procedure BankMap;
Var
x,y,InBank: integer;
aFound:extended;
Begin
if (LoggedIn) then
begin
writeln('Dont see bank, trying again');
case random(3) of //what should i write there to make the script do 0,1,2,3 in order instead of random
0: begin
writeln('try1');
ToPot := [Point(2300, 3323)];
SPS_WalkPath(ToPot);
Wait(RandomRange(2000,3000));
end;
1: begin
writeln('try2');
ToPot := [Point(2313, 3323)];
SPS_WalkPath(ToPot);
Wait(RandomRange(2000,3000));
end;
2: begin
writeln('try3');
ToPot := [Point(2290, 3322)];
SPS_WalkPath(ToPot);
Wait(RandomRange(2000,3000));
end;
3: begin
writeln('try4');
InBank := DTMFromString('mQwAAAHicY2ZgYHgIxJ+B+DwQWzAyMCQDcRIQtzWWMCQK8zLMkhdlMALK8UMxIxIGAgA1mQbE');
if FindDTMRotated(InBank, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
mouse(5,5,x,y,Mouse_left);
wait(randomrange(1000,2000));
end;
FreeDtm(InBank);
end;
end;
end;
end;
Last edited by ogustuce; 12-10-2012 at 07:32 PM.
use a for loop
Simba Code:procedure BankMap;
var
x,y,InBank: integer;
aFound: extended;
begin
if (LoggedIn) then
begin
writeln('Dont see bank, trying again');
for i := 0 to 3 do
begin
case i of //what should i write there to make the script do 0,1,2,3 in order instead of random
0: begin
writeln('try1');
ToPot := [Point(2300, 3323)];
SPS_WalkPath(ToPot);
Wait(RandomRange(2000,3000));
end;
1: begin
writeln('try2');
ToPot := [Point(2313, 3323)];
SPS_WalkPath(ToPot);
Wait(RandomRange(2000,3000));
end;
2: begin
writeln('try3');
ToPot := [Point(2290, 3322)];
SPS_WalkPath(ToPot);
Wait(RandomRange(2000,3000));
end;
3: begin
writeln('try4');
InBank := DTMFromString('mQwAAAHicY2ZgYHgIxJ+B+DwQWzAyMCQDcRIQtzWWMCQK8zLMkhdlMALK8UMxIxIGAgA1mQbE');
if FindDTMRotated(InBank, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
mouse(5,5,x,y,Mouse_left);
wait(randomrange(1000,2000));
end;
FreeDtm(InBank);
end;
end;
end;
end;
end;
it'd be even better to create an array of points and then loop through the array to walk to them. However the above uses the logic you requested![]()
Last edited by footballjds; 12-10-2012 at 07:39 PM.
kk thanks!
As what footballjds said you could also do something like this
Simba Code:procedure this;
var
Points: TPointArray;
i: integer;
begin
Points := [Point(150,150), Point(200,200), Point(350,350)];
For i := 0 to high(Points) do
begin
writeln('Attempting to SPS walk to bank attempt number '+tostr(i));
sps_walktopos(points[i]);
while ismoving do
wait(100 + Random(100));
end;
end;
doesnt really fit in my script but thanks =)
I'm not use what your procedure is about. Are you trying to walk to bank and the script is coded to try to go from different locations? If so, I would add a Break; to the loop to avoid any possible issue/save memory.
I would write something like:
Simba Code:procedure BankMap;
var
i, x, y, InBank: integer;
aFound: extended;
TPA : TPointArray;
begin
if not (LoggedIn) then
Exit;
TPA := [Point(2300, 3323), Point(2313, 3323), Point(2290, 3322)];
writeln('Can''t see the bank, trying again');
for i := 0 to high(TPA) do
begin
writeln('Attempt ' + IntToStr(i + 1));
ToPot := TPA[i];
SPS_WalkPath(ToPot);
Wait(RandomRange(2000,3000));
InBank := DTMFromString('mQwAAAHicY2ZgYHgIxJ+B+DwQWzAyMCQDcRIQtzWWMCQK8zLMkhdlMALK8UMxIxIGAgA1mQbE');
if FindDTMRotated(InBank, x, y, MSX1, MSY1, MSX2, MSY2, -Pi/4, Pi/4, Pi/60, aFound) then
begin
mouse(5, 5, x, y, Mouse_left);
wait(randomrange(1000,2000)); //Is this waiting for the bank to bank? You might prefer something like WaitFunc(@BankScreen, 10, 3000);
FreeDTM(InBank);
Break;
end;
end;
end;
I'll repeat a tip that I read on another thread that helped me a great deal. Don't just copy the procedure (anyway I probably made it typo somewhere). Try to understand it.
Last edited by Wardancer; 12-10-2012 at 08:37 PM.
its a failsafe actually. the SPS(point) at the bank is inaccurate. sometimes it clicks right and lead inside the bank but sometimes its off and click outside the bank. my idea was: if cant find bankbooth dtm then begin the failsafe procedure to lead inside the bank.
the dtm 'inbank' was DTM to find on the mainscreen that is inside the bank in case that the sps failsafes fails
There are currently 1 users browsing this thread. (0 members and 1 guests)