SRL Archive - OSR Help

FindObj gets stuck sometimes


maigel

2012-01-12 20:59:01

Hi,

Today I was working on my first simba script. (A fire runecrafter with ring of duelling teleports)
Now, once I'm positioned inside the mysterious ruins in front of the actual altar I use FindObj to find the altar. I works good MOST of the time, but sometimes when there's another player around with similar colors (for example, a pickaxe that has the same color). It gets stuck on the pickaxe. Now, is there a way to make sure that if FindObj finds something with the wrong uptext, that it skips the object with the wrong uptext and continues to find other objects with the given color?

klit rs

2012-01-12 21:07:22

I would say use an if statement after the FindObj that checks that if GetUpText contains alter or whatever then do it, else try again? That might work… But Im sure someone more advanced in their programming skills can verify or suggest something better…

cause

2012-01-12 21:07:40

Are you using FindObj or FindObjCustom? One thing you could try is to put it in a loop and then try finding it, up to 10 times lets say, before failing and then terminating or whatever.

Press Play

2012-01-12 22:47:49

The most effective way of finding objects is usually with making your own custom object finding function using TPAs.. but they might take a while to learn. If you use this method, it will usually be able to flow into your script better.

Otherwise, you could do as above:
From: cause
Are you using FindObj or FindObjCustom? One thing you could try is to put it in a loop and then try finding it, up to 10 times lets say, before failing and then terminating or whatever.

Maybe something like:
for i:=1 to 10 do
begin
if FindObj(x, y, 'altar', AltarColor, AltarTol) then
Break;
Wait(100+Random(200))
end;

maigel

2012-01-13 08:16:13

I already had it in a loop before but it still failed.
I looked into one of yohojo's video tutorials on FindObjTPA and that seems like the stuff I need! Thanks for the help :)