SRL Archive - SRL Suggestions

Use IsTargetValid


Wizzup?

2011-02-20 09:38:13

Simba has a function called ``IsTargetValid'', which will tell you if the current target for Simba is valid. I propose we put this in setupsrl - before any find() calls. For all I care it is the very first function:


if not IsTargetValid then
begin
writeln('Could not locate your client. Please target a client');
TerminateScript;
end;

For SRL 4 you'll probably want to wrap it in Simba define tags.

E: I'd like someone to confirm if this works with SMART, though. ;)

Flight

2011-02-20 09:56:08

What would happen before if you tried running a script before defining the client?

Wizzup?

2011-02-20 10:00:02

It would just run SRL; default target is the desktop.

MylesMadness

2011-02-20 10:14:19

It seems like it worked with smart, I put it before and after smart is loaded, and neither errored out.

Wizzup?

2011-03-05 06:12:01

Still waiting on any input from other developers.

lordsaturn

2011-03-05 12:37:39

IMO it's not really necessary, but it can't hurt either.

Nava2

2011-03-05 12:42:59

For something *very* quick to check, it can not hurt. I'm with saturn on that one. :)

Coh3n

2011-03-05 12:45:42

I don't see any reason not to.

Wizzup?

2011-03-05 13:00:53

From: lordsaturn
IMO it's not really necessary, but it can't hurt either.


Well, I think it is necessary because you could get "Out of range" errors otherwise. At least, in my experience this is what happens when the client doesn't exist anymore. (Using WINE anyway)

This is a lot more user friendly.

lordsaturn

2011-03-05 22:53:02

From: Wizzup?
Well, I think it is necessary because you could get "Out of range" errors otherwise. At least, in my experience this is what happens when the client doesn't exist anymore. (Using WINE anyway)

This is a lot more user friendly.


Yeah but someone who doesn't know how to set the target window shouldn't be using simba anyways.

Any ultra-noob would just use smart, and probably wouldn't try to use simba with rs in a browser.

Wizzup?

2011-03-06 04:06:59

From: lordsaturn
Yeah but someone who doesn't know how to set the target window shouldn't be using simba anyways.

Any ultra-noob would just use smart, and probably wouldn't try to use simba with rs in a browser.


Like I said somewhere else, Firefox/Runescape like to change the handle every now and then. On tab switch, etc. It's kinda useful in those cases.

EvilChicken!

2011-03-06 19:27:38

I've seen several threads with people getting really confused over loosing their client handles and receiving error messages, as the mentioned errors do not clearly state that client handle loss is the cause.

So, I'm strongly with Wizzup on this one.
And for the record, it takes virtually no time at all to run this check, for those of you who are worried about that.

I'll add this myself tomorrow if no one beats me to it.

Wizzup?

2011-03-08 10:59:41

Sounds good.