SRL Archive - First Scripts

Smurg's LesserDemonSlayer [SIMBA]


smurg

2010-10-29 00:24:57

Version 2.00
Smurg's LesserDemonSlayer


Change History
Version 1.00: Just released.
Version 1.01: Fixed global variables, DeclarePlayers, rwait, InFight, NpcOnScreen. (Thanks WT-Fakawi and Bonfield)
Version 1.10: Overhaul on fight-detection, and re-organized procedures. Added anti-randoms, better anti-ban. YOU MUST HAVE YOUR XP BAR OUT. It's used for fight detection.

Background
A little background. I used to script for SCAR back in the day, before farming, in the time of ScarScape.

Wrote a natty crafter and went by 'zestyroper'. I had since stopped playing runescape moved on.

Started 'playing' again for nostalgia and fell into scripting. A lot has changed, so I'm still getting the hang of it all, the new includes, standards, etc.

So any feedback is VERY appreciated, my feelings won't be hurt.

I know the script is lacking several things, so any scripting advice is also very helpful.

I want to get back into the community and script more, even though school takes up a lot of time.



Moved to main forum: http://villavu.com/forum/showthread.php?t=59922

TomTuff

2010-10-29 00:49:12

You don't have SRL stats setup properly.

smurg

2010-10-29 03:27:57

From: TomTuff
You don't have SRL stats setup properly.


Doh, i kind of thought that after i ran it and it only showed <1minute used.

I must've followed an old thread perhaps? Because I had a thread showing how to set it up.

Could you direct me to a tut or thread? thanks.

Bonfield

2010-10-29 03:52:08

im not sure about stats, i will try to find a current tutorial

could you please repost your script? there is no reason to take it down just because you didnt implement the stats right

smurg

2010-10-29 04:03:53

From: Bonfield
im not sure about stats, i will try to find a current tutorial

could you please repost your script? there is no reason to take it down just because you didnt implement the stats right


I was using:

http://villavu.com/forum/showthread.php?t=53844

But i didn't put in any custom stats for the script when 'releasing' it on the stats site. Is that a problem?

Bonfield

2010-10-29 04:17:27

that should work, i havent really used used the current stat system

im pretty sure you need to write a name for each stat variable, if not im pretty sure no name will show in the total script stats

eg
  
Inc(Stats_CustomVars[STATS_HIGH_ALCHES]);
IncEx(Stats_CustomVars[STATS_XP_GAINED], 65);

that should increase how many high alches and also the total xp gained, i think i could be wrong

STATS_HIGH_ALCHES and STATS_XP_GAINED are constants that are 1 and 3 for this6, i never actually released that script so the stats were never increased

WT-Fakawi

2010-10-29 05:38:04

Hey smurg,

nice work and nice nick! Browsing through your script I noticed you have declared x and y as Globals. You should really avoid the use of such big vars as globals. You use them both for colorfinding and mouse clicking. The minute they are 0, your mouse will start moving towards the upperleft corner. Also when x and y contain the wrong global values, your script wont be reliable anymore because of random misclick.

Love the way you use SRL :) Nice work!

Bonfield

2010-10-29 06:44:58

you might want to declare your players like this

procedure DeclarePlayers;
begin
HowManyPlayers := 1; // How many players declared?
CurrentPlayer := 0; // Number of player to start with.
NumberOfPlayers(HowManyPlayers);

with Players[0] do
begin
Name := 'name'; // Characters full RS username.
Pass := 'pass'; // Characters RS password.
Nick := 'hi'; // 3 non-caps letters of char's RS username
Pin := 5; // Characters pin

Active := True;
end;
end;

as you can easily add more players and use multiplayer in your script


procedure rwait(time: Integer; ran: Integer); // i would probably just use wait(20 + random(5));
begin // as using static values is bannable in my opinion
wait(time + ran);
end;


function InFight: Boolean;
begin
if(FindColorSpiral(x, y, 49779, MSX1, MSY1, MSX2, MSY2)
or FindColorSpiral(x, y, 269019, MSX1, MSY1, MSX2, MSY2)
)then
Result := True
else
Result := False;
end;
can be

function InFight: Boolean;
begin
Result := (FindColorSpiral(x, y, 49779, MSX1, MSY1, MSX2, MSY2) or
FindColorSpiral(x, y, 269019, MSX1, MSY1, MSX2, MSY2)
end;

NpcOnScreen can be done using arrays, they look pretty confusing but i showed you an example and tried to explain it


function NpcOnScreen: Boolean;
var
i, x, y: Integer; // notice i used x, y here, that saves declaring it globally
Monster_Colours: Array of Integer;
begin
SetArrayLength(Monster_Colours, 3); // set the length of the array
Monster_Colours := [MCOLORS0, MCOLORS1, MCOLORS2]; // stores all the monster colours you have as consts
// in to a array, it sorts it into an arragement

for i:=0 to 2 do // this uses integers 0, 1, 2 of the colour array
if(FindColorSpiralTolerance(x, y, Monster_Colours[i], MSX1, MSY1, MSX2, MSY2, NPC_TOLERANCE)) then
begin
Result := True;
Exit;
end else
writeln('Can not find NPC on screen.');
end;

overall its a good start and look like you have a grasped the concepts, good job

i will comment on more later hopefully i will get time, but i have to go sorry

smurg

2010-10-29 14:27:17

Awesome, will implement some of the changes and re-upload within a few days.

AHAHHA. Gosh I'm stupid sometimes lol.


procedure rwait(time: Integer; ran: Integer); // i would probably just use wait(20 + random(5));
begin // as using static values is bannable in my opinion
wait(time + ran);
end;

I didn't realize i just added them haha. Should have the wait(time + random(ran)); haha will change. Outside eyes always catch stuff that I don't notice. :p

edit: Can anyone know how to change the viewing angle to straight up? Or is this done in SetUpSRL ? I have the compass one but I need the angle.

And i read up on the custom stats, but just wanted to log how much time is spent using it for the moment before moving on to specific stats.

Thanks.

Bonfield

2010-10-29 18:06:28

do you want the camera set to the highest it con get? if so you can just use
 SetAngle(True);
to change the compass you can use
MakeCompass('W');
that would change the compass to west

smurg

2010-11-01 16:49:32

Updated to 1.10.

You need the XP bar near your minimap sticking out. It's used for fight detection.

Overall, think it's a lot sturdier, not much of a need to babysit it, but no logout breaks for now. It will logout after a set amount of time however.

i luffs yeww

2010-11-01 18:24:53

You should set the XP bar. :) Do a simple GetColor or FindColor (if the color is dynamic) and see if it's open or not. If not, open it.

smurg

2010-11-01 20:09:13

From: i luffs yeww
You should set the XP bar. :) Do a simple GetColor or FindColor (if the color is dynamic) and see if it's open or not. If not, open it.


Ya i should. I remember way back when, you had to give people 800 directions before they could run it because there was limited include functions. Like stand facing north, camera up, etc haha.

But good idea, thanks.

Bonfield

2010-11-01 20:56:25

You can se the xp bar, iirc narcle made a few functions for it and also a character set for it, I think the font may be outdated though