PDA

View Full Version : First script (Monster killer + looting) questions



stijnbogaert
04-22-2017, 06:56 AM
Hello everyone,

I am trying to make a simple script that will kill a monster and loot the money it drops.

Game: OS-Scape PvP
Monster: Abbysal demon
Drop: Blood Money

Here is what my code looks like


program DemonKiller

{$I SRL-6/SRL.simba}
//srl-6 override function
function waitClientReady(): boolean;override;begin result:= true;end
var
x, y, demonClick: integer;


procedure ClickDemon;
var
x, y : integer;
begin
if FindColorTolerance(x, y, 1973824, 156, 165, 469, 264, 3) then
begin
MoveMouse(x, y);
wait(250);
ClickMouse(x, y, MOUSE_LEFT);
end;
end;

procedure lootMoney;
var
x, y : integer;
begin
if FindColorTolerance(x, y, 1781723, 206, 319, 228, 323, 50) then
begin
MoveMouse(x, y);
wait(250);
ClickMouse(x, y, MOUSE_LEFT);
end;
end;

begin
setupSRL();
repeat
lootMoney;
ClickDemon;
until (false)
end.


The procedure ClickDemon works, but it just spam clicks the abbysal demons even if I'm in combat.
How can I make a fuction that waits till I'm done fighting the monster before it starts clicking another?

The Procedure lootMoney doesn't work at all... I commented out the ClickDemon and dropped the money and it doesn't click it at all. Even though I did the same steps as with clicking the demon..

Any help is much appreciated!!

Tiyed
04-22-2017, 01:08 PM
I would look into PixelShift for the combat. There might be a better way, but I find PixelShift to be great to learn since it can be applied in many ways for various scripts.

I'm not sure about the looting tho, maybe try opening a fresh tab/script and playing around with it to see if you can get it working, then copy/paste it over? My best guess since it's an "if" statement is that it's not finding the color.

goodgamescript
04-23-2017, 02:25 AM
Hello everyone,

I am trying to make a simple script that will kill a monster and loot the money it drops.

Game: OS-Scape PvP
Monster: Abbysal demon
Drop: Blood Money

Here is what my code looks like


program DemonKiller

{$I SRL-6/SRL.simba}
//srl-6 override function
function waitClientReady(): boolean;override;begin result:= true;end
var
x, y, demonClick: integer;


procedure ClickDemon;
var
x, y : integer;
begin
if FindColorTolerance(x, y, 1973824, 156, 165, 469, 264, 3) then
begin
MoveMouse(x, y);
wait(250);
ClickMouse(x, y, MOUSE_LEFT);
end;
end;

procedure lootMoney;
var
x, y : integer;
begin
if FindColorTolerance(x, y, 1781723, 206, 319, 228, 323, 50) then
begin
MoveMouse(x, y);
wait(250);
ClickMouse(x, y, MOUSE_LEFT);
end;
end;

begin
setupSRL();
repeat
lootMoney;
ClickDemon;
until (false)
end.


The procedure ClickDemon works, but it just spam clicks the abbysal demons even if I'm in combat.
How can I make a fuction that waits till I'm done fighting the monster before it starts clicking another?

The Procedure lootMoney doesn't work at all... I commented out the ClickDemon and dropped the money and it doesn't click it at all. Even though I did the same steps as with clicking the demon..

Any help is much appreciated!!

For looting items you can check out this thread.
https://villavu.com/forum/showthread.php?t=116975

Add as for it just spam clicking the demon.
check out whats happening in your main loop.

repeat
lootMoney;
ClickDemon;
until (false)

if it finds the money for it to loot it.
Then if it finds the demon then click it.

So if it doesnt fint the money it will just click the demon.

So you will have to change it a bit. Like so.

repeat
ClickDemon;
IsDemonDead; //a function to see if the demon is dead, so it can loot ,you will have to create this.
lootMoney;

until (false)

As i dont play that server, i dont really know the code to check to see if the demon is dead,But here are some ideas.

Check for hit points bars, check for hit splat near your char,your char pixel shift,and xp gain if you have an xp tracker.

Check out the srl-6 documentation (http://docs.villavu.com/srl-6/) on pixel shift (http://docs.villavu.com/srl-6/pixelshift.html).