View Full Version : i got an problem with my mouse
remember me
10-17-2012, 07:49 PM
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
Take away moveMouse, Mouse will move the mouse and click for you.
Footy
10-17-2012, 07:53 PM
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.
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
10-17-2012, 08:01 PM
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
10-17-2012, 08:42 PM
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.
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
10-17-2012, 08:48 PM
Give me 2 minutes, I'll write you something.
remember me
10-17-2012, 08:54 PM
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
10-17-2012, 09:00 PM
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
10-17-2012, 09:03 PM
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
10-17-2012, 09:10 PM
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
10-17-2012, 09:11 PM
Did you edit the uptext to the rock crab uptext?
remember me
10-17-2012, 09:13 PM
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
10-17-2012, 09:37 PM
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
10-17-2012, 09:40 PM
then it will work?
remember me
10-17-2012, 09:45 PM
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
10-17-2012, 09:46 PM
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
10-18-2012, 09:57 AM
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
10-18-2012, 10:30 AM
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".
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.
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.
what does the 2 means in ClickMouse2
It is simply named "ClickMouse2" because a procedure called "ClickMouse" already exists inside of Simba.
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).
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.
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 [I believe]) 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
10-18-2012, 11:10 AM
does this work in an rsps that uptext doesn't work and that colour green thingy does that works?
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
10-18-2012, 11:23 AM
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).
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
10-18-2012, 11:52 AM
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)
http://i1188.photobucket.com/albums/z408/ruud8/1-1.png
Orange+Black
http://i1188.photobucket.com/albums/z408/ruud8/2-1.png
Red+Black
http://i1188.photobucket.com/albums/z408/ruud8/3-1.png
Daniel
10-18-2012, 11:58 AM
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)
http://i1188.photobucket.com/albums/z408/ruud8/1-1.png
Orange+Black
http://i1188.photobucket.com/albums/z408/ruud8/2-1.png
Red+Black
http://i1188.photobucket.com/albums/z408/ruud8/3-1.png
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
http://2006scape.com/services/knowledge_base/img/kbase/misc_screenshots/takingdamage.gif
So, yeah, apologies for the confusion.
remember me
10-18-2012, 12:52 PM
ok so i changed the colours in the cache and now it looks like this:
http://i1188.photobucket.com/albums/z408/ruud8/1-2.png
remember me
10-18-2012, 12:53 PM
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.
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
10-18-2012, 01:06 PM
ok so i changed the colours in the cache and now i have this:
http://i1188.photobucket.com/albums/z408/ruud8/1-2.png
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
10-18-2012, 01:11 PM
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
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
10-18-2012, 01:27 PM
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 (http://villavu.com/forum/showthread.php?t=58935), and following that, this tutorial (http://villavu.com/forum/showthread.php?t=15240).
Regards,
~ Daniel. :)
remember me
10-18-2012, 02:31 PM
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
Hi remember me,
Please check out this tutorial (http://villavu.com/forum/showthread.php?t=58935), and following that, this tutorial (http://villavu.com/forum/showthread.php?t=15240).
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
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
10-19-2012, 10:41 AM
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
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
10-19-2012, 12:45 PM
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
10-19-2012, 08:30 PM
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
10-19-2012, 08:33 PM
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
10-19-2012, 08:56 PM
what do you mean with dtm?
and how should the code looks like then
Footy
10-19-2012, 09:04 PM
Watch Yohojo's DTM tutorial if the looking for green thing doesn't work.
remember me
10-19-2012, 09:09 PM
gonna look it later gtds(got to do something)
remember me
10-21-2012, 06:56 PM
i got now this code:
program GhostKilling;
{$i srl/srl.simba}
procedure AttackMonster;
var HealthBar, X, Y: Integer;
begin
repeat
HealthBar := DTMFromString('mwQAAAHic42RgYJBhgABzKBuEGaHYDIqZkT AIsCHRcPYEBgYhISG8mBjASASGAwCmnANt');
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*
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
10-22-2012, 05:02 PM
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('mwQAAAHic42RgYJBhgABzKBuEGaHYDIqZkT AIsCHRcPYEBgYhISG8mBjASASGAwCmnANt');
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.
For freeing the DTM you need to have:
FreeDTM(HealthBar);
remember me
10-22-2012, 09:16 PM
now i got this code
program GhostKilling;
{$i srl/srl.simba}
procedure AttackMonster;
var HealthBar, X, Y: Integer;
begin
repeat
HealthBar := DTMFromString('mwQAAAHic42RgYJBhgABzKBuEGaHYDIqZkT AIsCHRcPYEBgYhISG8mBjASASGAwCmnANt');
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?
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('mwQAAAHic42RgYJBhgABzKBuEGaHYDIqZkT AIsCHRcPYEBgYhISG8mBjASASGAwCmnANt');
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
10-22-2012, 11:13 PM
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('mwQAAAHic42RgYJBhgABzKBuEGaHYDIqZkT AIsCHRcPYEBgYhISG8mBjASASGAwCmnANt'); //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
10-23-2012, 06:08 PM
ok now i got this code
program GhostKilling;
{$i srl/srl.simba}
procedure AttackMonster;
var
HealthBar, X, Y: Integer;
begin
HealthBar := DTMFromString('mrAAAAHic42BABaZQLAPFZkDMDMRsSGrYkP hguQkMDEJCQjjxfwb8gJEAhgEAlDEEEA==');
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
01-21-2013, 04:20 PM
ok now i got this code
program GhostKilling;
{$i srl/srl.simba}
procedure AttackMonster;
var
HealthBar, X, Y: Integer;
begin
HealthBar := DTMFromString('mrAAAAHic42BABaZQLAPFZkDMDMRsSGrYkP hguQkMDEJCQjjxfwb8gJEAhgEAlDEEEA==');
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
01-21-2013, 04:31 PM
Wait after the click not before it, do it like,
MMouse();
ClickMouse();
Wait(4000);
Then you can check if in combat after that
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.