SRL Archive - SRL Archives

OMG! Fixed box solver on slow comps!!!


dontpanic

2006-11-12 21:47:51

My comp could not run the box solver, it would always just freeze up. Eventually I tried just adding one lil wait… and BOOM IT WORKED LIKE A CHARM!!!

{*******************************************************************************
function GetBoxSide: Integer;
by: pups
Description: Gets Box side and returns Bitmap
*******************************************************************************}
function GetBoxSide: Integer;
var
Side, x, y: integer;
begin
Side := BitmapFromString(181, 181, '');
repeat
wait(100); //<--- The wait that needed to be added
if findcolortolerance(x, y, 16579837, 182, 45, 182, 225, 5) then continue;
if findcolortolerance(x, y, 16579837, 342, 45, 342, 225, 5) then continue;
if findcolortolerance(x, y, 16579837, 172, 55, 352, 55, 5) then continue;
if findcolortolerance(x, y, 16579837, 172, 215, 352, 215, 5) then continue;
if findcolortolerance(x, y, 12764106, 182, 45, 182, 225, 5) then continue;
if findcolortolerance(x, y, 12764106, 342, 45, 342, 225, 5) then continue;
if findcolortolerance(x, y, 12764106, 172, 55, 352, 55, 5) then continue;
if findcolortolerance(x, y, 12764106, 172, 215, 352, 215, 5) then continue;
break;
until false;
CopyClientToBitmap(Side, 172, 45, 352, 225);
Result := Side;
end;

Boreas

2006-11-12 21:55:23

Good job. Post your computers specs so that people with similiar can use this version.

Infantry001

2006-11-12 22:53:14

cool i just put it into my SRL. i will see if it solves boxes now :D

dontpanic

2006-11-12 22:58:05

My comp has celeron d 3ghz processer, 1gp ram. But couldn't this just be added into srl because it wont affect people with good computers, but it will fix the problem for people with slow computers?

Boreas

2006-11-12 23:01:56

Up to the devs, but for now, its an individual basis.

YoHoJo

2006-11-12 23:06:08

hah cool.
i bet waits between the in thens will make it even better
devs will probably consider it. Its just a wait cant do any harm
nice job =)
for now ill add the wait =) thanks

corrupt16

2006-11-12 23:13:31

From: dontpanic
My comp has celeron d 3ghz processer, 1gp ram. But couldn't this just be added into srl because it wont affect people with good computers


I find it funny that you have a problem with it with those specs do you have a slow internet connection like dialup?

YoHoJo

2006-11-12 23:40:08

actaully it lags even with good specs sometimes
whats REALLY funny is that your and SRL member with 11 posts and no scripts released =p

ruler

2006-11-13 00:22:06

gj,

ya i been working on a box breaker on and off for ibot and used a sleep 50 but see it takes about 1ms to complete the test but 15ms to refresh the arrays. so its more like 65ms for a complete cycle

Take about 500ms to get a valid frame, so thats about every 8 tests.


while (true) {
sleep(50);
getColorArray2d(0);// reresh color array
if (findRGBXYs(getColorArray2d(), new Rectangle(182, 45, 1, 180),
null, new RGB(16579837, RGB.COLOR_TYPE_SCAR), 1, 5, 5, 5).length > 0) {
continue;
}
if (findRGBXYs(getColorArray2d(), new Rectangle(342, 45, 1, 180),
null, new RGB(16579837, RGB.COLOR_TYPE_SCAR), 1, 5, 5, 5).length > 0) {
continue;
}
if (findRGBXYs(getColorArray2d(), new Rectangle(172, 55, 177, 1),
null, new RGB(16579837, RGB.COLOR_TYPE_SCAR), 1, 5, 5, 5).length > 0) {
continue;
}
if (findRGBXYs(getColorArray2d(), new Rectangle(172, 215, 177, 1),
null, new RGB(16579837, RGB.COLOR_TYPE_SCAR), 1, 5, 5, 5).length > 0) {
continue;
}
if (findRGBXYs(getColorArray2d(), new Rectangle(182, 45, 1, 180),
null, new RGB(12764106, RGB.COLOR_TYPE_SCAR), 1, 5, 5, 5).length > 0) {
continue;
}
if (findRGBXYs(getColorArray2d(), new Rectangle(342, 45, 1, 180),
null, new RGB(12764106, RGB.COLOR_TYPE_SCAR), 1, 5, 5, 5).length > 0) {
continue;
}
if (findRGBXYs(getColorArray2d(), new Rectangle(172, 55, 177, 1),
null, new RGB(12764106, RGB.COLOR_TYPE_SCAR), 1, 5, 5, 5).length > 0) {
continue;
}
if (findRGBXYs(getColorArray2d(), new Rectangle(172, 215, 1, 180),
null, new RGB(12764106, RGB.COLOR_TYPE_SCAR), 1, 5, 5, 5).length > 0) {
continue;
}
break;
}

Wizzup?

2006-11-13 03:01:11

I think there was a reason pups didn't add any waits..

Are you sure this works on slower computers?

Because all that matters is the time that ProcessPicture; takes. There has actually been a big thread about the box. I don't think adding one wait will help…

Confirm this please..

Also, make sure the function you edited isn't in some sort of repeat look, because if it is, you have a problem, it might just be a alot slower. ;)

Added a wait(1) to processpicture (in the loop) would already make processpicture take 18 minutes.

From: dontpanic
My comp has celeron d 3ghz processer, 1gp ram. But couldn't this just be added into srl because it wont affect people with good computers, but it will fix the problem for people with slow computers?


Calling this slow? :confused: It's alot faster than my comp. And mine does solve the box without any problems.

ruler

2006-11-13 04:06:13

Added a wait(1) to processpicture (in the loop) would already make processpicture take 18 minutes. ???????????????????????????????????????/////

How long does it take to solve the box generally?

first i think it not valid srl to have unbreaking loops
their is no fail safe.

second having no sleeps in a loop is bad when the loop last longer than 100ms.

Wizzup?

2006-11-13 06:25:08

Pups made an estimation a long time ago about how long a the processpicture would take if you'd add some waits to it. I don't know about this one though.. I'd still like to get it varified from other users that this one works if the normal doesn't work.

bibi26

2006-11-13 06:50:53

From: dontpanic
My comp has celeron d 3ghz processer, 1gp ram. But couldn't this just be added into srl because it wont affect people with good computers, but it will fix the problem for people with slow computers?

You call that slow ? :confused:

dontpanic

2006-11-13 09:16:40

Maybe not slow, but celerons arent very good processers. And the box solver didn't used to work for me.

YoHoJo

2006-11-13 10:15:12

GUYS IT WORKS! CONFIRMED!
/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
| SRL Randoms Report |
| www.villu-reborn.com |
|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
| Logged in : 17 |
| Trade Made : 8 |
| Talking Random : 7 |
| Rick Solved : 1 |
| OldMen Solved : 3 |
| Lamp Solved : 4 |
| Capn Hand Solved : 1 |
| New Box Solved : 3 |
| Axes Attached : 2 |
\~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~/

iv only solved a box like once before. and i think it was gamble box =)
Sweet yay

2.8GHz And only 512 RAM Pentium 4 processor
(i ordered 1G of ram comming in tomoro so happy!)

HISTORY

2006-11-13 13:06:18

Sure, they solve the box for every one when i quit scripting:P Just my luck:P

bibi26

2006-11-13 15:31:43

From: dontpanic
Maybe not slow,but celerons arent very good processers. And the box solver didn't used to work for me.

+1 :D

dontpanic

2006-11-13 21:43:20

Yay! someone confermed! btw soon I'm getting a better comp (better processer) probably a pentium d or something.

Ron

2006-11-14 19:21:25

Yeah celerons are known to be shitty.

Great job man! This worked for me too. I tried on a noob account and used a small script I made just to do a little routine. I used coordinate clicking cause its a noob account and I got a few boxes and it solved them! Definitely add this. I don't know why there was a loop without any waits in it. That's just… retarded!

No wonder SRL lags RS so much lol, this makes so much sense. Maybe add a wait in every loop? Do we dare!?!? :) :P

dontpanic

2006-11-14 19:46:53

I think we have a wait in most loops, its just that pups comp is too leet so his works well even without them :P but that kinda messes the rest of us without leet computers up lol

Infantry001

2006-11-14 20:59:07

It sorta works. at least it doenst lag my comp completely crazy. but it takes like 2 minutes to solve the box… maybe ill make a smaller wait.

dontpanic

2006-11-14 21:18:57

:\ how fast is your comp? Cause this still doesnt really make it go faster, it just makes it actually work on comps that need waits.

Infantry001

2006-11-14 22:18:08

does it usually take a while for it to be solved? cuase the only time it ever managed to solve on my comp, it took like 2 secs

dontpanic

2006-11-14 22:39:43

Same for me, I guess it depends on the speed of the computer.

Rencuz

2006-11-15 08:29:34

Thx it solevs my box like in 2 secs :P

lardmaster

2006-11-16 16:10:44

yes, every time i seem to get a box, it lags so much i log out.

thnx so much, i will use it.

dontpanic

2006-11-16 17:51:05

Actualy thats not lag its just that it didnt give the browser any time to refresh before, so it keeps checking colors without it refrshing, so the colors will never be the way they should, thus infinite loop. This just allows your browser to refresh so it can detect when the side of the box is up.

weibs

2006-11-16 21:21:40

The box solver has always worked for me :\

Junior

2006-11-16 22:16:15

From: weibs
The box solver has always worked for me :\


Really? It hasn't started working for me until I downloaded SRL 3.5…

dontpanic

2006-11-16 23:02:16

It always worked for some people because some people have good computers or something and their client can refresh without any waits for some reason. Others such as me need waits in loops to be able to refresh the client.

lardmaster

2006-11-19 11:27:00

yes exactly, my client freezes, and it just waits and waits, until it logs out. then it gets unfrozen

dontpanic

2006-11-19 12:55:27

Wow, mine didnt even wait untiil it logged out :\ i would just come back to my comp and the box image would be frozen on my screen (when i stopped scar it would be logged out)

Flyboy

2006-11-20 12:33:27

Would someone please try this on a computer that is known to NOT solve the box normally. This in theory should be faster and smother than the above suggested single wait.
{*******************************************************************************
function GetBoxSide: Integer;
by: pups
Description: Gets Box side and returns Bitmap
*******************************************************************************}
function GetBoxSide: Integer;
var
Side, x, y: integer;
begin
Side := BitmapFromString(181, 181, '');
repeat
wait(1); //<--- The wait that needed to be added
if findcolortolerance(x, y, 16579837, 182, 45, 182, 225, 5) then continue;
wait(1); //<--- The wait that needed to be added
if findcolortolerance(x, y, 16579837, 342, 45, 342, 225, 5) then continue;
wait(1); //<--- The wait that needed to be added
if findcolortolerance(x, y, 16579837, 172, 55, 352, 55, 5) then continue;
wait(1); //<--- The wait that needed to be added
if findcolortolerance(x, y, 16579837, 172, 215, 352, 215, 5) then continue;
wait(1); //<--- The wait that needed to be added
if findcolortolerance(x, y, 12764106, 182, 45, 182, 225, 5) then continue;
wait(1); //<--- The wait that needed to be added
if findcolortolerance(x, y, 12764106, 342, 45, 342, 225, 5) then continue;
wait(1); //<--- The wait that needed to be added
if findcolortolerance(x, y, 12764106, 172, 55, 352, 55, 5) then continue;
wait(1); //<--- The wait that needed to be added
if findcolortolerance(x, y, 12764106, 172, 215, 352, 215, 5) then continue;
break;
until false;
CopyClientToBitmap(Side, 172, 45, 352, 225);
Result := Side;
end;

Edit:
Nope the above does not work… if your computer is too slow to draw the box, a wait(1) will not be enough. I have had some initially good results from one wait(100). I will test on my laptop (which if it passes, EVERY computer out there will be able to run it).

Pyro

2006-11-20 15:40:16

From: dontpanic
It always worked for some people because some people have good computers or something and their client can refresh without any waits for some reason. Others such as me need waits in loops to be able to refresh the client.


How can you say bad computers. I mean you have a half decent one there. You should have easily solved the box. I know people with people less specs then you that can.

Boreas

2006-11-20 15:45:19

Could it be another factor? Like refresh hertz or something?

Flyboy

2006-11-20 20:29:24

ok I tested on two computers which both could not solve boxes. I suspect the real problem is in video cards not processor speed as my one computer is plenty fast, the added wait made it possible to render the box thus making it solvable. I solved 23 boxes if a very fast time period, so feel this should not be a problem for anyone.
I also tested on a slow computer (800 mhz laptop) and realized that no amount of wait will ever cure that :)

So… I just updated srl with this fix. Well done dontpanic!!! You get 2 thumbs up there. You should see this fix in the next SRL Update :)
The above fix helps

Boreas

2006-11-20 22:23:25

How did you get so many boxes? I haven't even been able to test this.

Flyboy

2006-11-21 01:55:39

From: Boreas
How did you get so many boxes? I haven't even been able to test this.

run setupsrl.scar and set: 'solve box' to false. then run your army on a mining script (a guild miner would do nicely). take one of your army who got a box and play legit with him with a box in his inventory… it will multiply on its own… Then you thank ALL SRL developers and don'tpanic cause you can now use srl to clean up your inventory.

JuKKa

2006-11-30 01:01:49

omg this really works! good work!

Mr. Freeweed

2006-12-23 21:10:56

Thank you DontPanic. This really does work. Who knew a wait would fix the box solver.

Works on all of my crap comps and now my two super comps work as well. I vote for a medal made just for this act of kindness DontPanic has shown =).

Sincerely,
Mr. Freeweed

lardmaster

2006-12-24 18:54:14

yes

Ron

2007-01-07 20:15:33

so the waits have finally been added? :)

Yakman

2007-01-08 13:46:10

yep, SRL 3.6