Log in

View Full Version : Dtm issues!!!



Crash Override
06-09-2012, 02:24 PM
I am working on a script and i am a beginner.

So far the script works great.

However, When i use a REPEAT statement in a FUNCTION the script stops once it finds the Object at UNTIL.

begin
repeat
MakeCompass('w');
SetAngle(SRL_ANGLE_HIGH);
Wait(100);
if FindObj(x, y, 'pen Door', 2646912, 10) then
Mouse(x, y, 0, 0, true);
Writeln('Opened Door');
until FindObj(x, y, 'lose Door', 3689555, 5);
end;

How do you tell SIMBA go to the next FUNCTION?

Thanks

-Crash

riwu
06-09-2012, 02:31 PM
Mind showing ur mainloop? U simply put the next function in the mainloop (after ur this function)

Gucci
06-09-2012, 02:48 PM
Like riwu said either the next function is missing from your mainloop. But really if the finding is accurate enough you don't even need a repeat loop. Also it's not a DTM issue

Crash Override
06-09-2012, 03:09 PM
that is the first repeat i have done?

like i said i am new.

Is this what you meant by mainloop riwu?Procedure OpenDoor;
var x, y: Integer;
begin
MakeCompass('w');
SetAngle(SRL_ANGLE_HIGH);
Wait(100);
repeat
if FindObj(x, y, 'pen Door', 2646912, 10) then
Mouse(x, y, 0, 0, true);
Writeln('Opened Door');
until FindObj(x, y, 'lose Door', 3689555, 5);
end;

i changed it from function to a procedure it still fails...

CephaXz
06-09-2012, 03:13 PM
that is the first repeat i have done?

like i said i am new.

Is this what you meant by mainloop riwu?Procedure OpenDoor;
var x, y: Integer;
begin
MakeCompass('w');
SetAngle(SRL_ANGLE_HIGH);
Wait(100);
repeat
if FindObj(x, y, 'pen Door', 2646912, 10) then
Mouse(x, y, 0, 0, true);
Writeln('Opened Door');
until FindObj(x, y, 'lose Door', 3689555, 5);
end;

i changed it from function to a procedure it still fails...

You might as well just post the whole script here so we can spot errors and help more efficiently. And tell us what are you actually doing in that procedure.

I don't think you need a repeat... until there in your procedure since you will most likely just open the door once.

Crash Override
06-09-2012, 03:39 PM
if you don't repeat that function then if the door is open and shuts before you walk through it wont it fail?

CephaXz
06-09-2012, 04:02 PM
if you don't repeat that function then if the door is open and shuts before you walk through it wont it fail?

That would happen too if you repeat the function. Only if you're very very unlucky. So actually you just need to check if the door is opened or closed. If its closed, then open the door. If its opened already, then do nothing. So no need for a repeat..until

putonajonny
06-09-2012, 04:40 PM
Didn't read through that much, so don't know if this was already fixed
begin
repeat
MakeCompass('w');
SetAngle(SRL_ANGLE_HIGH);
Wait(100+Random(100)); //Don't use static waits
if FindObj(x, y, 'pen Door', 2646912, 10) then
begin //You have to use begin and end if you want it to do several things
Mouse(x, y, 0, 0, true);
Writeln('Opened Door');
break; //this breaks out of the repeat loops
end;
until(False);
end;

But don't you want it to move on if the door is open?
begin
repeat
MakeCompass('w');
SetAngle(SRL_ANGLE_HIGH);
Wait(100+Random(100));
if FindObj(x, y, 'oor', 2646912, 10) then
begin
if(IsUpText('pen'))then
ClickMouse2(mouse_Left);//This clicks the mouse where it currently is, changing left to right would make it right click
Writeln('Opened Door or it was already open');
break;
end;
until(False);
end;

Crash Override
06-10-2012, 07:35 AM
Hah!

I got it! Thanks. Didnt need the repeat after all.. Sorry mate.

Thanks Putonajonny. Unfortunately CephaXz Beat us to it LOL.

Damn Now my Memberships up! Typical.... Finally half done my script and now cant test it UGH!

Oh well i might make a ftp script instead XD.