SRL Archive - OSR Help

Failsafes


jordi1104

2012-01-30 08:10:49

Well i'm making a script but since it's my first script I have no idea how I can implement any failsafes i'm using tpa and dtm's for objects/npc's but since it sometimes misclicks I want it to try to click again but that's something I have no experience in and I coulden't find a dated guide about it.

Also with the tpa I am in a area where most colors are the same so it mistakes one color for another any idea how I could prevent that?

Er1k

2012-01-30 08:17:39

Not sure what script you're trying to implement, but the idea of failsafe has to do with how you are going to deal with something when it fails. For example, you might want to do a timeout if the script spends too much time and still cannot find the object/npc. There are just many things you can do.

For the colors, you might want to try ACA to get your colors and limit your tolerance to a relatively low amount. Are you using CTS1 or CTS2 for color finding? The latter is more accurate, and can be useful if many similar colors are on the screen.

jordi1104

2012-01-30 08:21:55

From: nosaj.421
Not sure what script you're trying to implement, but the idea of failsafe has to do with how you are going to deal with something when it fails. For example, you might want to do a timeout if the script spends too much time and still cannot find the object/npc. There are just many things you can do.

For the colors, you might want to try ACA to get your colors and limit your tolerance to a relatively low amount. Are you using CTS1 or CTS2 for color finding? The latter is more accurate, and can be useful if many similar colors are on the screen.


All colors of the npc are the same as the ground and walls of the shop it's standing in exept the hair that's the problem I also used ACA for colorfinding but at a lower tolerance it can't find it becouse when the npc walks the hair is in a different direction and a different color.

I would like the failsafe to repeat if it misclicks how could I do that (know it might sounds a bit bad but I really have no idea).

Was using cts 1 I think so I will try cts 2 but I will still need some kind of failsafe.

Er1k

2012-01-30 08:29:46

What is your click color? If it is red click then you want to try to detect this with DidRedClick. Maybe something like this.


MarkTime(t);
repeat
;//try clicking
if DidRedClick then break;
until (TimeFromMark(t) > whatevertimehere);
if not (TimeFromMark(t) > whatevertimehere) then //that means we're successful
;//do your next step here


jordi1104

2012-01-30 08:51:33

I will try that later thanks.
Also it was redclick I believe.
Whats the timemark anyway haven't seen it before.

Er1k

2012-01-30 09:32:37

MarkTime and TimeFromMark are functions that allow you to use a variable to determine the time elapsed. Very useful for timeout or any functions that involves time. If you're not familiar, it might be a good idea for you to read the Simba documentation.

jordi1104

2012-01-30 11:59:41

From: nosaj.421
MarkTime and TimeFromMark are functions that allow you to use a variable to determine the time elapsed. Very useful for timeout or any functions that involves time. If you're not familiar, it might be a good idea for you to read the Simba documentation.


Learned alot from you thanks :D and I will do what you sayd.
One more thing how can I make it wait till it sees color like if it can't find color then it waits for till it does.

Er1k

2012-01-30 22:08:32

Look up the WaitColor series functions in SRL include.