SRL Archive - Help

i got an problem with my mouse


remember me

2012-10-17 15:49:37

ok so i want to make a script for an rsps but when i do this code
program new;
{$i SRL/SRL.simba}
procedure ClickMonster;
var x, y: Integer;
begin
if
FindColor(x, y, 722181, msx1, msy1, msx2, msy2) then
MoveMouse(x, y);
Wait(500);
Mouse(x, y, 0, 0, true);
end;
begin
setupsrl;
ClickMonster;
end.

my mouse teleports to the monster but i want to make it move smoothly
how can i do that

Olly

2012-10-17 15:52:56

Take away moveMouse, Mouse will move the mouse and click for you.

Footy

2012-10-17 15:53:43

It doesn't "Teleport", it simply moves at the speed of light. To prevent it from doing that, use MMouse instead of Movemouse. To change the mousespeed of MMouse, type Mousespeed := 15 in the beginning of your main loop.

Mouse does the same thing as MMouse, except it also clicks if told to. In the future, try to improve your standards, it makes us helping you easier. :)

Edit: Don't worry about tagging your threads, it only makes them easier to find in a search.

tehq

2012-10-17 15:58:41

From: Footy
To prevent it from doing that, use MMouse instead of Movemouse. To change the mousespeed of MMouse, type Mousespeed := 15 in the beginning of your main loop.

Mouse does the same thing as MMouse, except it also clicks if told to. In the future, try to improve your standards, it makes us helping you easier. :)



Here is an example that sums up his explanation:

program new;
{$i SRL/SRL.simba}

procedure ClickMonster;
var
x, y: Integer;
begin
if FindColor(x, y, 722181, MSX1, MSY1, MSX2, MSY2) then
begin
MMouse(x, y, 10, 10); // Moves the mouse to point (x, y) with a randomness of 10 in the x and y directions
Wait(Random(500)); // waits a random amount of time.. up to 499 ms
ClickMouse2(True); // left clicks where the mouse lands
end;
end;

begin
SetupSRL;
ClickMonster;
end.

Footy

2012-10-17 16:01:25

From: tehq
Here is an example that sums up his explanation:

program new;
{$i SRL/SRL.simba}

procedure ClickMonster;
var
x, y: Integer;
begin
if FindColor(x, y, 722181, MSX1, MSY1, MSX2, MSY2) then
begin
MMouse(x, y, 10, 10); // Moves the mouse to point (x, y) with a randomness of 10 in the x and y directions
Wait(Random(500)); // waits a random amount of time.. up to 499 ms
ClickMouse2(True); // left clicks where the mouse lands
end;
end;

begin
SetupSRL;
ClickMonster;
end.


Thank ya very much. Also, ignore my mousespeed comment, I didn't realise you were using SetupSRL, as it sets the mousespeed itself.

remember me

2012-10-17 16:42:53

omg thanks for the fast reply's i only got 2 quetions more:
what does the 2 means in ClickMouse2
and how can i make that he attacks that colour(monster)
and when it dies it attacks another one
i got this code now:
program new;
{$i SRL/SRL.simba}
procedure ClickMonster;
var x, y: Integer;
begin
if
FindColor(x, y, 5268580, msx1, msy1, msx2, msy2) then
begin
MMouse(x, y, 10, 10);
Wait(Random(500));
ClickMouse2(True);
end;
end;
begin
setupsrl;
ClickMonster;
end.

Ian

2012-10-17 16:45:58

ClickMouse2 is like ClickMouse but version 2 I think.
For the fighting thing, look in the fighting include for a function called InFight.
It should be here:

C:/Simba/Includes/SRL/SRL/Skill/fighting.simba

Footy

2012-10-17 16:48:27

Give me 2 minutes, I'll write you something.

remember me

2012-10-17 16:54:11

From: BMWxi
ClickMouse2 is like ClickMouse but version 2 I think.
For the fighting thing, look in the fighting include for a function called InFight.
It should be here:

C:/Simba/Includes/SRL/SRL/Skill/fighting.simba

ow thanks

remember me

2012-10-17 17:00:54

ok now i got one problem more i am in an private server but when i do that colour picking on an rock crab then he takes almost everytime the ground instead of the crab how to fix this?

Footy

2012-10-17 17:03:50

This script might be a little complex, but the task you are trying to do requires a little more then simple code to execute efficenty. I tried to explain everything, if you don't understand something, just ask.






program new;
{$i srl/srl.simba} //SRL INCLUDE

procedure AttackMonster;
var
x, y, attempts:integer; //Variable Declarations
begin
repeat //Finds color with a bit of tolerance, it will mean if the color is a little bit off, it will still return true. Always use tolerance, colors in RS change frequently.
if findcolortolerance(x, y, 5268580, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(x, y, 5, 5); //Moves mouse to color with 5 pixel's randomness
wait(randomrange(200, 500)); //Waits a random number between 200 and 500
end;

inc(attempts); //This will increase the variable "Attempts" by one.

if attempts > 10 then //If we've tried more then 10 times
begin
writeln('We attempted more then 10 times to find the monster!');
Terminatescript; //then we stop the script.
end;
until(isuptext('Monsters uptext here'); //Isuptext will search for the uptext in the top left corner of the screen
//This will keep looping until it finds the uptext
//The Failsafe just above will stop the script if
//It tries more then 10 times.
//Code from this point on only happens if the uptext is found
clickmouse2(mouse_left);
if didredclick then //Checks for the red cursor animation when you click on an interactable item.
writeln('We found a monster!') else
Writeln('We didnt find a monster!');

end;

begin
SetupSRL
AttackMonster;
end.

Edit: Sorry, I din't see your other question. Try something like this to wait until you are out of a fight.
Sorry, I didn't see your other fighting question, just have a waiting procedure that looks something like this.



procedure WaitForFightEnd;
var
counter:integer;
begin
marktime(counter);
repeat
if SRL_InFight then
continue else
break
wait(randomrange(200, 400));
until(timefrommark(counter) > 25000);

end;

Edit2: At your color question, you would need to use CTS2 or ACA. Look up Yohojo's ACA tutorial, or you can try using a monster with more unique colors.

remember me

2012-10-17 17:10:37

From: Footy
This script might be a little complex, but the task you are trying to do requires a little more then simple code to execute efficenty. I tried to explain everything, if you don't understand something, just ask.






program new;
{$i srl/srl.simba} //SRL INCLUDE

procedure AttackMonster;
var
x, y, attempts:integer; //Variable Declarations
begin
repeat //Finds color with a bit of tolerance, it will mean if the color is a little bit off, it will still return true. Always use tolerance, colors in RS change frequently.
if findcolortolerance(x, y, 5268580, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(x, y, 5, 5); //Moves mouse to color with 5 pixel's randomness
wait(randomrange(200, 500)); //Waits a random number between 200 and 500
end;

inc(attempts); //This will increase the variable "Attempts" by one.

if attempts > 10 then //If we've tried more then 10 times
begin
writeln('We attempted more then 10 times to find the monster!');
Terminatescript; //then we stop the script.
end;
until(isuptext('Monsters uptext here'); //Isuptext will search for the uptext in the top left corner of the screen
//This will keep looping until it finds the uptext
//The Failsafe just above will stop the script if
//It tries more then 10 times.
//Code from this point on only happens if the uptext is found
clickmouse2(mouse_left);
if didredclick then //Checks for the red cursor animation when you click on an interactable item.
writeln('We found a monster!') else
Writeln('We didnt find a monster!');

end;

begin
SetupSRL
AttackMonster;
end.

Edit: Sorry, I din't see your other question. Try something like this to wait until you are out of a fight.
Sorry, I didn't see your other fighting question, just have a waiting procedure that looks something like this.



procedure WaitForFightEnd;
var
counter:integer;
begin
marktime(counter);
repeat
if SRL_InFight then
continue else
break
wait(randomrange(200, 400));
until(timefrommark(counter) > 25000);

end;

Edit2: At your color question, you would need to use CTS2 or ACA. Look up Yohojo's ACA tutorial, or you can try using a monster with more unique colors.

that is what i mean but i got only one problem it goes over the head of the rock crab but then it says:
We attempted more then 10 times to find the monster!
Successfully executed.
and it don't find the monster

Footy

2012-10-17 17:11:13

Did you edit the uptext to the rock crab uptext?

remember me

2012-10-17 17:13:53

i am now trying to kill an skeleton warlock this is my code:
program new;
{$i srl/srl.simba} //SRL INCLUDE

procedure AttackMonster;
var
x, y, attempts:integer; //Variable Declarations
begin
repeat //Finds color with a bit of tolerance, it will mean if the color is a little bit off, it will still return true. Always use tolerance, colors in RS change frequently.
if findcolortolerance(x, y, 5191246, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(x, y, 5, 5); //Moves mouse to color with 5 pixel's randomness
wait(randomrange(200, 500)); //Waits a random number between 200 and 500
end;

inc(attempts); //This will increase the variable "Attempts" by one.

if attempts > 10 then //If we've tried more then 10 times
begin
writeln('We attempted more then 10 times to find the monster!');
Terminatescript; //then we stop the script.
end;
until(isuptext('Skeleton warlock')); //Isuptext will search for the uptext in the top left corner of the screen
//This will keep looping until it finds the uptext
//The Failsafe just above will stop the script if
//It tries more then 10 times.
//Code from this point on only happens if the uptext is found
clickmouse2(mouse_left);
if didredclick then //Checks for the red cursor animation when you click on an interactable item.
writeln('We found a monster!') else
Writeln('We didnt find a monster!');

end;

begin
SetupSRL
AttackMonster;
end.

Footy

2012-10-17 17:37:11

Gah, I'm stupid. This is for an RSPS, isn't it? The uptext check and didredclick check won't work on RSPS's, so you need to remove those.

remember me

2012-10-17 17:40:56

then it will work?

remember me

2012-10-17 17:45:29

now i got this code:
program new;
{$i srl/srl.simba} //SRL INCLUDE

procedure AttackMonster;
var
x, y, attempts:integer; //Variable Declarations
begin
repeat //Finds color with a bit of tolerance, it will mean if the color is a little bit off, it will still return true. Always use tolerance, colors in RS change frequently.
if findcolortolerance(x, y, 5268580, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(x, y, 5, 5); //Moves mouse to color with 5 pixel's randomness
wait(randomrange(200, 500)); //Waits a random number between 200 and 500
end;

inc(attempts); //This will increase the variable "Attempts" by one.

if attempts > 10 then //If we've tried more then 10 times
begin
writeln('We attempted more then 10 times to find the monster!');
Terminatescript; //then we stop the script.
end;
begin
SetupSRL
AttackMonster;
end.
and this error
[Error] C:\Program Files (x86)\Simba\Scripts\Mijn Script.simba(26:4): Identifier expected at line 25
Compiling failed.

Footy

2012-10-17 17:46:13

Well, it might, kind of. Read into the OCR and making custom fonts, then you can use uptext.

E: The begin after attempts >10 has no end;

remember me

2012-10-18 05:57:11

umm how can i do that i am just started with learning this but i don't get farther
and i need to make my own scripts for rsps because almost nobody got scripts for it

Daniel

2012-10-18 06:30:27

From: remember me
my mouse teleports to the monster but i want to make it move smoothly how can i do that

The reason as to why the mouse teleports when calling MoveMouse is because you're telling it to instantly point to a new location. SRL's MMouse (WindMouse) method calculates a path (of points) from the current mouse position, to the new one, and then simply continuously calls MoveMouse to achieve the simulated effect of "smooth movement".

From: Footy
It doesn't "Teleport", it simply moves at the speed of light.

Calling MoveMouse does "teleport" the mouse cursor. No movement at the speed of light.

From: tehq

Wait(Random(500)); // waits a random amount of time.. up to 499 ms

SRL's Mouse procedure already waits a random amount of time before clicking. No need to replicate this functionality and call MMouse then ClickMouse2.

From: remember me
what does the 2 means in ClickMouse2

It is simply named "ClickMouse2" because a procedure called "ClickMouse" already exists inside of Simba.

From: remember me
and how can i make that he attacks that colour(monster)

Well, you could move the mouse, then just left-click on that colour (assuming the action is 'Attack' when you left-click on a monster).
From: remember me

and when it dies it attacks another one

You could find the health bar that is shown above the monster, and do a check to see if there is no green colour in it to check if it's dead or not. Then, if it is, repeat the colour-finding process above.

For example, the structure of your script could be like this (pseudocode):

begin
repeat
FindAndClickMonster;
while (GreenColourIsInHealthBar) do // Just a nice way to 'pause' the script while it attacks the monster.
Wait(100);
Until(False);
end.

From: remember me
umm how can i do that i am just started with learning this but i don't get farther

UpText is basically the text that is displayed in the top-left corner when you hover over an item in Runescape and Runescape-based games. Basically, a common way for the scripter to confirm if they have moved the mouse over the correct target is to read this uptext. For example, if I was making a mining script and I wanted to check if I have indeed moved the mouse over an ore, I could read the UpText and check if it contains the words 'Mine' and 'Ore' (or 'Rock', I forget what it is since I haven't played Runescape in such long time). Jagex use a unique font for its game, Runescape, to make it harder for us (otherwise we could just get a list of fonts like Microsoft Word, and load the right one) and thus we (developers) have to extract this font (create a new font, which is what Footy was referring to ) to properly read and match characters.

Since you're a beginner, you need not worry about this as it is relatively advanced. :p But, do note, that it is a proven way to confirm and verify things in-game. :)

Regards,
~ Daniel. :)

remember me

2012-10-18 07:10:23

does this work in an rsps that uptext doesn't work and that colour green thingy does that works?

riwu

2012-10-18 07:16:40

Daniel is just giving you the structure, you have to create that function yourself, something like
function GreenColourIsInHealthBar;
begin
result:=CountColor(blabla);
end;

And uptext probably doesn't work in rsps unless you create your own fonts or find the old fonts.
There is, however a creative method to check uptext. Check the length of the TPA of the uptext colors. (it's likely to vary significantly from when you are not hovering over the monster) But you probably won't know what i'm talking about unless you check out the advanced section of scripting tutorials. It all depends on how much you are willing to learn ;)

Daniel

2012-10-18 07:23:22

From: remember me
does this work in an rsps that uptext doesn't work

Well, it depends on the game. As I said, the Uptext which SRL/Simba currently use are for modern versions of the game. You may have to create your own (which is an advanced/really annoying thing to do).

From: remember me
and that colour green thingy does that works?


If the rsps you're coding for has a "health" bar up the top, I don't see why not :) Basically, what I was suggesting before is to check if there is any green, because if there is, then you know that the monster still has some health left. Whereas, if there was no green and just red, then there's no health left and most likely dead, or just about to die.

remember me

2012-10-18 07:52:05

ok but the red in the health bar has changed to like black and alittle higher i post colours
it has 3 phases:
Green+Black(it starts of course with full green)
Orange+Black
Red+Black

Daniel

2012-10-18 07:58:17

From: remember me
ok but the red in the health bar has changed to like black and alittle higher i post colours
it has 3 phases:
Green+Black(it starts of course with full green)
Orange+Black
Red+Black


Oh. Well, maybe you could try checking if any green, orange or red colours exist. And if they don't, then it is dead :)

Hehe, the last time I played the health bars (and damage, if that has changed?) looked like this :p

So, yeah, apologies for the confusion.

remember me

2012-10-18 08:52:46

ok so i changed the colours in the cache and now it looks like this:

remember me

2012-10-18 08:53:46

what should be the code now i got this but to what i need to change it
program new;
{$i srl/srl.simba} //SRL INCLUDE

procedure AttackMonster;
var
x, y, attempts:integer; //Variable Declarations
begin
repeat //Finds color with a bit of tolerance, it will mean if the color is a little bit off, it will still return true. Always use tolerance, colors in RS change frequently.
if findcolortolerance(x, y, 7430757, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(x, y, 5, 5); //Moves mouse to color with 5 pixel's randomness
wait(randomrange(200, 500)); //Waits a random number between 200 and 500
end;
begin
writeln('We attempted more then 10 times to find the monster!');
Terminatescript; //then we stop the script.
end;
begin
SetupSRL;
AttackMonster;
end.

and i get this error
[Error] C:\Program Files (x86)\Simba\Scripts\Mijn Script.simba(22:4): Identifier expected at line 21
Compiling failed.

riwu

2012-10-18 09:01:31

program new;
{$i srl/srl.simba} //SRL INCLUDE

procedure AttackMonster;
var
x, y, attempts:integer; //Variable Declarations
begin
repeat //Finds color with a bit of tolerance, it will mean if the color is a little bit off, it will still return true. Always use tolerance, colors in RS change frequently.
if findcolortolerance(x, y, 7430757, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(x, y, 5, 5); //Moves mouse to color with 5 pixel's randomness
wait(randomrange(200, 500)); //Waits a random number between 200 and 500
//not clicking or something?
end else (* you have to add else to tell it to do otherwise *)
begin
writeln('We attempted more then 10 times to find the monster!');
Terminatescript; //then we stop the script.
end;

(*possibly some procedure here to wait till it finish fighting so that it won't spam clicking?*)
until False;
end; (*if you begin something, you should end it. this is not only the principle of life but of scripting as well ;) *)

begin
SetupSRL;
AttackMonster;
end.

remember me

2012-10-18 09:06:29

ok so i changed the colours in the cache and now i have this:
and this is my code and how can i make it work now:
program new;
{$i srl/srl.simba} //SRL INCLUDE

procedure AttackMonster;
var
x, y, attempts:integer; //Variable Declarations
begin
repeat //Finds color with a bit of tolerance, it will mean if the color is a little bit off, it will still return true. Always use tolerance, colors in RS change frequently.
if findcolortolerance(x, y, 8021606, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(x, y, 5, 5); //Moves mouse to color with 5 pixel's randomness
wait(randomrange(200, 500)); //Waits a random number between 200 and 500
end;
begin
writeln('We attempted more then 10 times to find the monster!');
Terminatescript; //then we stop the script.
end;
begin
SetupSRL;
AttackMonster;
end.

and i get this error when i run this script:
[Error] C:\Program Files (x86)\Simba\Scripts\Mijn Script.simba(22:4): Identifier expected at line 21
Compiling failed.

remember me

2012-10-18 09:11:33

From: riwu
program new;
{$i srl/srl.simba} //SRL INCLUDE

procedure AttackMonster;
var
x, y, attempts:integer; //Variable Declarations
begin
repeat //Finds color with a bit of tolerance, it will mean if the color is a little bit off, it will still return true. Always use tolerance, colors in RS change frequently.
if findcolortolerance(x, y, 7430757, MSX1, MSY1, MSX2, MSY2, 10) then
begin
MMouse(x, y, 5, 5); //Moves mouse to color with 5 pixel's randomness
wait(randomrange(200, 500)); //Waits a random number between 200 and 500
//not clicking or something?
end else (* you have to add else to tell it to do otherwise *)
begin
writeln('We attempted more then 10 times to find the monster!');
Terminatescript; //then we stop the script.
end;

(*possibly some procedure here to wait till it finish fighting so that it won't spam clicking?*)
until False;
end; (*if you begin something, you should end it. this is not only the principle of life but of scripting as well ;) *)

begin
SetupSRL;
AttackMonster;
end.

with this code it doesn't click it will find the monster but it doesn't click maybe an solution don't look at the post from me above this that was an accident

riwu

2012-10-18 09:22:15

You even commented it yourself '//Moves mouse to color with 5 pixel's randomness', so yeah its going to move there but if you don't tell it to click it wont click.

I've even added comment asking why aren't you clicking but i didn't add in in case you are just testing or something.
Add a ClickMouse2(mouse_Left) after MMouse, or use Mouse(x, y, 5, 5, mouse_Left), which is the combination of the 2.

Daniel

2012-10-18 09:27:11

From: remember me
with this code it doesn't click it will find the monster but it doesn't click maybe an solution don't look at the post from me above this that was an accident


Hi remember me,

Please check out this tutorial, and following that, this tutorial.

Regards,
~ Daniel. :)

remember me

2012-10-18 10:31:36

From: riwu
You even commented it yourself '//Moves mouse to color with 5 pixel's randomness', so yeah its going to move there but if you don't tell it to click it wont click.

I've even added comment asking why aren't you clicking but i didn't add in in case you are just testing or something.
Add a ClickMouse2(mouse_Left) after MMouse, or use Mouse(x, y, 5, 5, mouse_Left), which is the combination of the 2.

omg i am noob sorry that i dindn't saw that but i got only one problem you type
as comment
(*possibly some procedure here to wait till it finish fighting so that it won't spam clicking?*)
but how can i add that?
people said some things but i don't know where to add

From: Daniel
Hi remember me,

Please check out this tutorial, and following that, this tutorial.

Regards,
~ Daniel. :)

thanks for the handy tutorials Daniel

Originally Posted by riwu
You even commented it yourself '//Moves mouse to color with 5 pixel's randomness', so yeah its going to move there but if you don't tell it to click it wont click.

I've even added comment asking why aren't you clicking but i didn't add in in case you are just testing or something.
Add a ClickMouse2(mouse_Left) after MMouse, or use Mouse(x, y, 5, 5, mouse_Left), which is the combination of the 2.

omg i am noob sorry that i dindn't saw that but i got only one problem you type
as comment
(*possibly some procedure here to wait till it finish fighting so that it won't spam clicking?*)
but how can i add that?
people said some things but i don't know where to add

riwu

2012-10-18 19:50:48

From: remember me
omg i am noob sorry that i dindn't saw that but i got only one problem you type
as comment
(*possibly some procedure here to wait till it finish fighting so that it won't spam clicking?*)
but how can i add that?
people said some things but i don't know where to add

Check out the tutorial links Daniel gave. We had given you a lot of ideas in previous posts, so you will just need to learn how to apply them after you learn the basics of scripting.

Also don't triple post in the future, edit your posts.

remember me

2012-10-19 06:41:02

i am now looking in the beginner's simba tutorial
but can i find there how i can make when it has killed the man or the monster
that it go search for another man or monster

Olly

2012-10-19 07:52:17

From: remember me
i am now looking in the beginner's simba tutorial
but can i find there how i can make when it has killed the man or the monster
that it go search for another man or monster


You will have to make some custom function man… there's no functions in srl that will do that in a private server.

Ashaman88

2012-10-19 08:45:11

Think about how you as a person would know that the npc is dead. I'm guessing it has something to do with the animation - and health bar (colors). Then try to apply that using the color finding functions

remember me

2012-10-19 16:30:32

something like
that i click on that colour then if it can't find the colour green that the scripts knows
"ah, it's dead so i need to click another npc"
something like that?

Footy

2012-10-19 16:33:24

Regardless of camera angle, the apperance of the health bar never changes, and some monsters that are powerful(have enough health) enough will still be fighting when the health bar appears to be fully depleted. You could take a DTM of the outline of the health bar, and check for that. Or, if its a weak monster, just look for green in the health bar.

remember me

2012-10-19 16:56:14

what do you mean with dtm?
and how should the code looks like then

Footy

2012-10-19 17:04:51

Watch Yohojo's DTM tutorial if the looking for green thing doesn't work.

remember me

2012-10-19 17:09:47

gonna look it later gtds(got to do something)

remember me

2012-10-21 14:56:21

i got now this code:
program GhostKilling;
{$i srl/srl.simba}
procedure AttackMonster;
var HealthBar, X, Y: Integer;
begin
repeat
HealthBar := DTMFromString('mwQAAAHic42RgYJBhgABzKBuEGaHYDIqZkTAIsCHRcPYEBgYhISG8mBjASASGAwCmnANt');
If FindDtm(HealthBar, X, Y, MSX1, MSY1, MSX2, MSY2)
Then Wait(300)
end else
begin
if findcolortolerance(x, y, 10786969, MSX1, MSY1, MSX2, MSY2, 10) then
MMouse(x, y, 5, 5);
wait(randomrange(200, 500));
ClickMouse2(mouse_Left)
end;
until False;
end;
begin
end.
and i get this error
[Error] C:\Program Files (x86)\Simba\Scripts\GhostKilling.simba(11:5): Identifier expected at line 10
Compiling failed.

ok and i want to add that if he finds more then one it then waits and if he finds one
he just click another monster because if you kill the monster then your bar stands there longer and i want that simba not wait for my bar to dissapear *sorry for my noobish english*

riwu

2012-10-21 20:33:13

Remove the 'end' beside the 'else', there is no begin (not needed since it's 1 command), hence there is no need for an 'end'.

remember me

2012-10-22 13:02:55

ok i removed but when i use the code it just spam clicks and i get this error when i stop the
script:
The following DTMs were not freed: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58]
and this is my simba code:
program GhostKilling;
{$i srl/srl.simba}
procedure AttackMonster;
var HealthBar, X, Y: Integer;
begin
repeat
HealthBar := DTMFromString('mwQAAAHic42RgYJBhgABzKBuEGaHYDIqZkTAIsCHRcPYEBgYhISG8mBjASASGAwCmnANt');
If FindDtm(HealthBar, X, Y, MSX1, MSY1, MSX2, MSY2)
Then Wait(300)
else
begin
if findcolortolerance(x, y, 10786969, MSX1, MSY1, MSX2, MSY2, 10) then
MMouse(x, y, 5, 5);
wait(randomrange(200, 500));
ClickMouse2(mouse_Left)
end;
until False;
end;
begin
setupsrl;
AttackMonster;
end.

Ian

2012-10-22 13:13:56

For freeing the DTM you need to have:

FreeDTM(HealthBar);

remember me

2012-10-22 17:16:36

now i got this code
program GhostKilling;
{$i srl/srl.simba}
procedure AttackMonster;
var HealthBar, X, Y: Integer;
begin
repeat
HealthBar := DTMFromString('mwQAAAHic42RgYJBhgABzKBuEGaHYDIqZkTAIsCHRcPYEBgYhISG8mBjASASGAwCmnANt');
FreeDTM(HealthBar)
If FindDtm(HealthBar, X, Y, MSX1, MSY1, MSX2, MSY2)
Then Wait(300)
else
begin
if findcolortolerance(x, y, 10786969, MSX1, MSY1, MSX2, MSY2, 10) then
MMouse(x, y, 5, 5);
wait(randomrange(200, 500));
ClickMouse2(mouse_Left)
end;
until False;
end;
begin
setupsrl;
AttackMonster;
end.
and this error:
[Hint] C:\Program Files (x86)\Simba\Includes\SRL/SRL/core/globals.simba(55:3): Variable 'WORLDSWITCHERENABLED' never used at line 54
Compiled successfully in 624 ms.
SRL Compiled in 15 msec
Error: Exception: The given DTM Index[2] doesn't exist at line 9
The following DTMs were not freed: [SRL - Lamp bitmap, 1]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap]
how to fix this?

Ian

2012-10-22 18:59:32

The
 FreeDTM(HealthBar)
has to be in the procedure, but after you're done using it.

Like this:
program GhostKilling;
{$i srl/srl.simba}
procedure AttackMonster;
var HealthBar, X, Y: Integer;
begin
repeat
HealthBar := DTMFromString('mwQAAAHic42RgYJBhgABzKBuEGaHYDIqZkTAIsCHRcPYEBgYhISG8mBjASASGAwCmnANt');
If FindDtm(HealthBar, X, Y, MSX1, MSY1, MSX2, MSY2)
Then Wait(300)
else
begin
if findcolortolerance(x, y, 10786969, MSX1, MSY1, MSX2, MSY2, 10) then
MMouse(x, y, 5, 5);
wait(randomrange(200, 500));
ClickMouse2(mouse_Left)
end;
until False;
FreeDTM(HealthBar)// Here
end;
begin
setupsrl;
AttackMonster;
end.

Enslaved

2012-10-22 19:13:38

Try this- note there were variouus issues with the code
program GhostKilling;
{$i srl/srl.simba}

Procedure AttackMonster;
Var
HealthBar, X, Y: Integer;
Begin
HealthBar := DTMFromString('mwQAAAHic42RgYJBhgABzKBuEGaHYDIqZkTAIsCHRcPYEBgYhISG8mBjASASGAwCmnANt'); //Dont constantly declare the dtm in the loop
Repeat
If FindDtm(HealthBar, X, Y, MSX1, MSY1, MSX2, MSY2) then
Begin
Wait(300);
End
Else
Begin
//Why did you free the DTM before using it?
If findcolortolerance(x, y, 10786969, MSX1, MSY1, MSX2, MSY2, 10) then
Begin
MMouse(x, y, 5, 5);
wait(randomrange(200, 500));
ClickMouse2(mouse_Left)
End;
End;
Until False;
FreeDTM(HealthBar); //Free it after the function
End;

begin
setupsrl;
AttackMonster;
end.

E: @BMXi there are also other issues i.e. this
begin
if findcolortolerance(x, y, 10786969, MSX1, MSY1, MSX2, MSY2, 10) then
MMouse(x, y, 5, 5);
wait(randomrange(200, 500));
ClickMouse2(mouse_Left)
end;
This basicly tells the mouse to wait and click regardless of whether colour was found or not
corrections in my code above

remember me

2012-10-23 14:08:18

ok now i got this code
program GhostKilling;
{$i srl/srl.simba}
procedure AttackMonster;
var
HealthBar, X, Y: Integer;
begin
HealthBar := DTMFromString('mrAAAAHic42BABaZQLAPFZkDMDMRsSGrYkPhguQkMDEJCQjjxfwb8gJEAhgEAlDEEEA==');
repeat
If FindDtm(HealthBar, X, Y, MSX1, MSY1, MSX2, MSY2) then
Begin
Wait(300)
end
Else
begin
if findcolortolerance(x, y, 11119020, MSX1, MSY1, MSX2, MSY2, 10) then
Begin
MMouse(x, y, 5, 5);
wait(randomrange(200, 500));
ClickMouse2(mouse_Left)
end;
End;
until False;
FreeDTM(HealthBar);
end;

begin
setupsrl;
AttackMonster;
end.

but now i want that it not just keeps clicking i want that it click one time like that this lines:
MMouse(x, y, 5, 5);
wait(randomrange(200, 500));
ClickMouse2(mouse_Left)
just click once because if it clicks on an monster it keeps clicking and clicking and than
it clicks on other monsters and then my man is gonna walk away and… that takes houres


Can you help me?

remember me

2013-01-21 11:20:46

ok now i got this code
program GhostKilling;
{$i srl/srl.simba}
procedure AttackMonster;
var
HealthBar, X, Y: Integer;
begin
HealthBar := DTMFromString('mrAAAAHic42BABaZQLAPFZkDMDMRsSGrYkPhguQkMDEJCQjjxfwb8gJEAhgEAlDEEEA==');
repeat
If FindDtm(HealthBar, X, Y, MSX1, MSY1, MSX2, MSY2) then
Begin
Wait(300)
end
Else
begin
if findcolortolerance(x, y, 11119020, MSX1, MSY1, MSX2, MSY2, 10) then
Begin
MMouse(x, y, 5, 5);
wait(randomrange(200, 500));
ClickMouse2(mouse_Left)
end;
End;
until False;
FreeDTM(HealthBar);
end;

begin
setupsrl;
AttackMonster;
end.

but now i want that it not just keeps clicking i want that it click one time like that this lines:
MMouse(x, y, 5, 5);
wait(randomrange(200, 500));
ClickMouse2(mouse_Left)
just click once because if it clicks on an monster it keeps clicking and clicking and than
it clicks on other monsters and then my man is gonna walk away and… that takes houres


Can you help me?

DannyRS

2013-01-21 11:31:32

Wait after the click not before it, do it like,

MMouse();
ClickMouse();
Wait(4000);

Then you can check if in combat after that