SRL Archive - MSI Bugs

SPS tries to walk over water


Harry

2011-11-12 09:31:32

[0:00:06]: [ ] – SPS Info.: Surface: 1, Areas: ['10_9']
[0:00:06]: [ ] – MSI_SetupPlayer
[0:00:06]: [ ] —— Players Found: 3
[0:00:06]: [ ] —— Scanning for randoms…
[0:00:08]: [ ] —- MSI_SetPlayerLoc
[0:00:08]: [ ] —— MSI_AtLocation
[0:00:08]: [ ] ———- MSI_GetMyPos(): (4050, 3815)
[0:00:08]: [ ] ——– Checking sub-location: Draynor Village Bank
[0:00:08]: [ ] ——– Player not at Draynor Village Bank
[0:00:08]: [ ] —— MSI_AtLocation: False
[0:00:08]: [ ] —— MSI_AtLocation
[0:00:09]: [ ] ———- MSI_GetMyPos(): (4050, 3815)
[0:00:09]: [ ] ——– Checking sub-location: Draynor Village Fishing Spots
[0:00:09]: [ ] ——– Player not at Draynor Village Fishing Spots
[0:00:09]: [ ] —— MSI_AtLocation: False
[0:00:09]: [ ] —— MSI_WalkPath: To Location (LOC_DB_BANK to LOC_DB_FISH)
[0:00:09]: [ ] ——– Walking attempts: 1
[0:00:09]: [ ] ——– SPS Info.: Surface: 1, Areas: ['10_9']
[0:00:09]: [ ] ——– MSI_WalkTPA
[0:00:09]: [ ] ———- Path: [(4191, 3661), (4167, 3725)]
[0:00:09]: [ ] ———— MSI_PointOnPath: Index = 4
[0:00:09]: [ ] ———— MSI_GetMyPos(): (4050, 3815)
[0:00:09]: [ ] ———— MSI_PointOnPath: Index = 4



Not sure if this is MSI problem or SPS problem. But as you can see, it tries to walk from the Karmja dock to Draynor netting spot, over water. It shouldn't be trying to do this for obvious reasons, and it has been keep clicking this spot for at least several minutes now.

NCDS

2011-11-12 09:32:45

From: Harry

Not sure if this is MSI problem or SPS problem. But as you can see, it tries to walk from the Karmja dock to Draynor netting spot, over water. It shouldn't be trying to do this for obvious reasons, and it has been keep clicking this spot for at least several minutes now.


So the char was on Karamja, but you set it to use a draynor script? Regardless, it should teleport to lumby if it can't find the path..

Harry

2011-11-12 09:33:00

Yes.

It could have ended up there by a random or such. It's just an issue that it doesn't break out of the loop nor try home teleport.

Oh, another issue is that it tries to walk there, despite my MaxLevel being less than my current level.

bevardis

2011-11-12 09:40:45

Sps doesn't really detect obstacles.

NCDS

2011-11-12 09:46:29

I'll talk to Coh3n and resolve the maxLvl thing as I don't think that's even used in the code right now.

The walking may be a bit harder to fix. It says the point was found on sps_Area 10_9, which is in Draynor. I'm honestly not sure how we're supposed to distinguish between water in certain areas via SPS or if it's even possible.

I'm assuming the reason is just that the script was trying to walk you back to the proper location and thought that the points in the water matched. I haven't done much work on SPS but from what I can tell, that seems to be the problem.

If you don't mind, place your character in a different spot on the island, and see if it teleports then.

Coh3n

2011-11-12 20:15:05

MaxLevel works fine, it's just not checked for until after your done the first load. As for the walking, SPS compares the minimap to the SPS Areas and it makes sense that two areas near water would be similar. How to fix this, though, I really have no idea. :unsure:

Lowering the tolerance in sps.simba may help, I'm not sure.

marpis

2011-11-13 06:08:17

Please note that SPS cannot answer the question "am I here", it only answers the question "I am somewhere in this area, where exactly am I?"

Meaning, if you set it to run a Draynor script in Karamja, SPS will not be able to tell if you're in Draynor or Karamja. The system just doesn't work that way.

Harry

2011-11-13 06:24:05

Ok, but what about it constantly clicking when it's unable to move? That's a problem, isn't it?

marpis

2011-11-13 07:08:23

From: Harry
Ok, but what about it constantly clicking when it's unable to move? That's a problem, isn't it?


Well yeah, one could write a failsafe to SPS_WalkPath

if TimeFromMark(LastTimeWeMoved) > 20000 then
begin
WriteLn('We''ve been stuck for 20 seconds, stopping WalkPath...');
Exit;
end;

And reset LastTimeWeMoved after every successfull walk.

MouseFlag(blah blah);
CurrentPos := SPS_GetMyPos;
if Distance(CurrentPos.X, CurrentPos.Y, LastPos.X, LastPos.Y) >= 5) then
LastPos := CurrentPos;

Something like this..

mastaraymond

2011-11-13 07:21:01

lolwat, SPS thinks it's moses?

No, the ocean won't split, idiot!

weequ

2011-11-13 08:40:21

From: mastaraymond
lolwat, SPS thinks it's moses?

No, the ocean won't split, idiot!
Maybe it will if you try long enough. And you must keep the faith all the time.

NCDS

2011-11-13 11:11:40

From: marpis
Well yeah, one could write a failsafe to SPS_WalkPath

if TimeFromMark(LastTimeWeMoved) > 20000 then
begin
WriteLn('We''ve been stuck for 20 seconds, stopping WalkPath...');
Exit;
end;

And reset LastTimeWeMoved after every successfull walk.

MouseFlag(blah blah);
CurrentPos := SPS_GetMyPos;
if Distance(CurrentPos.X, CurrentPos.Y, LastPos.X, LastPos.Y) >= 5) then
LastPos := CurrentPos;

Something like this..

We could do the same distance check with Flag(); which I would imagine is most likely quicker?

Coh3n

2011-11-13 12:56:27

From: marpis
Please note that SPS cannot answer the question "am I here", it only answers the question "I am somewhere in this area, where exactly am I?"

Meaning, if you set it to run a Draynor script in Karamja, SPS will not be able to tell if you're in Draynor or Karamja. The system just doesn't work that way.
You sure? MSI's AtLocation works just like that, and it works quite well for the most part.

The only big issue I've seen with SPS is that it will still walk a path even if the player is no where near the path (like in the first post). I've had this happen in other locations as well, and honestly there's not much that can be done. I mean, there are a lot of areas on the map that look really, really similar.

I think a failsafe like above is a must. I can't think of another way to resolve it.

marpis

2011-11-13 14:45:36

From: Coh3n
You sure? MSI's AtLocation works just like that, and it works quite well for the most part.


MSI's AtLocation checks if we are in a certain box. if we are somehow teleported to a random place, but use the original place as the area, it will just check the point that resembles most our place in that area. No matter if that's only one or two 5x5 pixel boxes that have similar colors really, it just returns the best one.

Practically SPS never returns false. It blindly believes that you actually are in the area you have in SPS_Areas.

Coh3n

2011-11-13 15:00:02

From: marpis
MSI's AtLocation checks if we are in a certain box. if we are somehow teleported to a random place, but use the original place as the area, it will just check the point that resembles most our place in that area. No matter if that's only one or two 5x5 pixel boxes that have similar colors really, it just returns the best one.

Practically SPS never returns false. It blindly believes that you actually are in the area you have in SPS_Areas.
That explains the error in the first post.

The path maker Wolygon made has an algorithm that gets the SPS areas based on a given path. So theoretically, we could set it up so areas don't need to be set, but generated during runtime. We could then maybe look at the minimap, and find the area it matches. If that area matches the path area, we know we're in the right area, otherwise, call MSI_DeathWalk.

I have a feeling that made no sense at all. >.<

marpis

2011-11-14 00:09:08

From: Coh3n
That explains the error in the first post.

The path maker Wolygon made has an algorithm that gets the SPS areas based on a given path. So theoretically, we could set it up so areas don't need to be set, but generated during runtime. We could then maybe look at the minimap, and find the area it matches. If that area matches the path area, we know we're in the right area, otherwise, call MSI_DeathWalk.

I have a feeling that made no sense at all. >.<


We could do that, but the problem is to determine how many matching pixels is enough to say that we in fact are where we are. Matches greatly vary between unpopulated woods and GE.

If you want to try this, you can easily edit sps.dll FindMapInMapExx by adding a parameter var MatchesFound.

Coh3n

2011-11-14 18:09:39

From: marpis
We could do that, but the problem is to determine how many matching pixels is enough to say that we in fact are where we are. Matches greatly vary between unpopulated woods and GE.

If you want to try this, you can easily edit sps.dll FindMapInMapExx by adding a parameter var MatchesFound.
Yeah I remember you saying that in an earlier post. I'll definitely look into that if I can ever get my SPS working again, or if I can ever get the plugin to compile. Two slightly important issues I've been having. >.<

Harry

2011-11-16 21:24:42

It also tries to walk through other walls, and other such stuff. I understand that SPS isn't all-knowing, but it's really a pain in the ass to see one of my good characters clicking the minimap while they are stuck inside the maze for a few hours… :\ It really just needs more failsafes please.

Coh3n

2011-11-17 14:56:42

It's been a community project for a while, you're allowed to do some of the work.

I've noticed it clicking some black parts on the minimap over and over again as well. I have no idea why that would happen though.

Harry

2011-11-17 15:15:59

I could, but I'm not comfortable doing so. I'm not sure how my changes would effect MSI / other scripts. What's going to happen if I make it exit if it clicks >20 times and doesn't reach destination? How are scripts going to handle that? I don't know much about the "inner flow" of the SPS include and how it should behave.

Coh3n

2011-11-18 18:25:02

From: Harry
I could, but I'm not comfortable doing so. I'm not sure how my changes would effect MSI / other scripts. What's going to happen if I make it exit if it clicks >20 times and doesn't reach destination? How are scripts going to handle that? I don't know much about the "inner flow" of the SPS include and how it should behave.


From: marpis
Well yeah, one could write a failsafe to SPS_WalkPath

if TimeFromMark(LastTimeWeMoved) > 20000 then
begin
WriteLn('We''ve been stuck for 20 seconds, stopping WalkPath...');
Exit;
end;

And reset LastTimeWeMoved after every successfull walk.

MouseFlag(blah blah);
CurrentPos := SPS_GetMyPos;
if Distance(CurrentPos.X, CurrentPos.Y, LastPos.X, LastPos.Y) >= 5) then
LastPos := CurrentPos;

Something like this..
That may be worth trying out. Not ideal because it's still failing for some reason, but at least your player isn't standing there clicking for hours.

E: Since I don't really have the time to fix this, and SPS2 is being worked on, I'm marking this as resolved and warning users to start their players in the bank of the script they want to use.