SRL Archive - OSR Help

FFlag picking up on symbols


bbri06

2010-05-10 21:23:23

I'm working on a script and it walks by the dungeon symbol and it keeps thinking that the flag is still there because it sees the dungeon symbol or the arrow that is right next to it. Any solutions you guys can come up with for this?

NCDS

2010-05-10 22:21:52

I thought about this the other day actually, that it could happen with how the current function is written.

Perhaps a length check would fix it?

I may have some time to look at it later.

Blumblebee

2010-05-10 23:34:04

for a rare occurrence like that why not use isMoving or something?

bbri06

2010-05-11 00:22:57

I was thinking about doing that Blumblebee, but then the script would wait for the character to stop moving entirely before continuing along the path. I always thought that was rather bottish, I suppose it will do for now though.

Blumblebee

2010-05-11 01:43:18

From: bbri06
I was thinking about doing that Blumblebee, but then the script would wait for the character to stop moving entirely before continuing along the path. I always thought that was rather bottish, I suppose it will do for now though.


I suppose your right. You could do a while not isMoving do wait(x); and then a basic flag with a timeout of X seconds (if the walking is consistent with a time)

bbri06

2010-05-11 19:43:21

So I worked off of that idea and I came up with this. Seems to work pretty well. It also checks to see if the flag went off the map and acts accordingly—that was another problem I was having.


{Credits to the creaters/updaters of FlagEx
(Wizzup? / WT-Fakawi / ZephyrsFury modified by N1ke!)

Used some of FlagEx}
Procedure BBFlag(Dist: integer);
var
TimeFS1, TimeFS2, Distance1, a, b: integer;
begin
Wait(500 + random(250));
MarkTime(TimeFS1);
While IsMoving do
begin
if(FindColor(a, b, 3026478, mmx1, mmy1, mmx2, mmy2))then
begin
Wait(50);
Distance1 := Distance(a, b + 14, MMCX, MMCY);
if(Distance1 <= Dist)then
Exit;
end else
if(not(IsMoving))then
Exit
else
if(not(OffMapFlag))then
Exit;
Wait(200);
MarkTime(TimeFS2);
if((TimeFS2 - TimeFS1) > 6000)then
if(Distance1 = Distance(a, b + 14, MMCX, MMCY))then
Exit;
if (Random(20) = 0)then
IdleTime(500, 1000, 0.01);
end;
end;

Blumblebee

2010-05-11 23:17:09

looks good :) nice work