SRL Archive - First Scripts

My First Script - Power Miner


shadowrec0n

2008-02-11 18:58:37

This script does not have alot, but its my first script, and its geting better.
if you have any good Tut's that could help me, post them and ill have alook at them, or if you ahve any idea's on what i could do to make it better.

Thank You.
-ShadowRecon

New features:
* S.M.A.R.T ADDED
* added anti-ban
* added anti-random

There not of the greatest quality, but its geting better.

The script worked fine on Scar 3.14, Rev 13.

Sir R. M8gic1an

2008-02-12 02:59:28

here's something i did for you: i added standards and suggestions. you're on the right way, but you still have some way to go. you'll need to learn about failsafes, antiban, antirandoms, multiplayer, etc.


{///.-Shady-Shadows Power Miner-. //
By
ShadowRecon
Edited By
Matlott
Credits
Thanks To Malott For Help
TuT Iland

What it does
* power mines any ore you set to mine

What it does not do
* Does not have anti-randoms (sorry, ill try to add this later)

My First Script!

}
program ShadowPwrMnr;
{.include SRL/SRL.scar}

var
i,x,y,m: Integer;

const
RockColor = 000000;//Change to the color of the rock you wish to mine.
//the color cannot between ' ' orthise scar will think it's a word
begin
if (not(LoggedIn)) then Exit;
i:= 0;
repeat
if invfull then //here you could use DropAll; //but be carefull because the pickaxe
begin //might be in your hand, so you could use
for m := 1 to 28 do //DropTo(2, 28); (starts at spot 2, stops at spot 28)
DropItem(m);
end;
if (FindColor(x,y,RockColor,4,4,514,337)) then //go learn about: FindColorTolerance,
begin // Findbj, FindObjCustom
mmouse(x,y,1,1)
Wait(100); //here would be usefull to check for uptext, to be sure it's a rock
{
if IsUpTextMulti('ine rock', 'Mine', 'rock') then
}
mouse(x,y,0,0,true); //
Break; //this will actually break the repeat, not the if
i:=0; //this shouldn't be here, this will mine until InvFull and then Drop it all, forever
// so there's no use for this " i "
wait(2000+random(500))
end else
i:=i+1;//this shouldn't be here, this will mine until InvFull and then Drop it all, forever
// so there's no use for this " i ",
wait(1000);
until(i=28);
end.

~RM

shadowrec0n

2008-02-12 17:06:58

thanks. do you have any good tut on how to use anti-randoms on scripts?

punkd

2008-02-12 17:37:01

its a great script for the first mate, once u learn how to get anti-randoms and anti-ban in there ull be a great scripter. Good luck!!

Mr.SRL

2008-02-12 22:17:13

This is a great script, you have talent, May I ask how much time you put into this?

Sir R. M8gic1an

2008-02-13 01:58:04

JAD's tut

~RM

shadowrec0n

2008-02-13 22:07:47

umm well i just started about a week ago. i put alot more time into Tut. than anything else. only took about an hour or so to write this script. its really pretty basic. lol. thanks.

Richard

2008-02-14 17:13:33

What was the original SCAR and SRL that you used.

Btw, its not a good idea to double post, it could get your post count back down to 0, use the edit button.

EDIT: I just realised you did a triple post, ahhh!!!!

mikevskater

2008-02-14 19:59:31

ok… i uhh know why your script doesnt work…. (YOU HAVE NO MAIN LOOP xD) i would fix for you but idk how you want your loop set up…
but ill fix your droping procedure to drop all if there isnt a axe or drop all but the axe
Edit: idk if im allowed to do this but i fixed pretty much your entire script for you, its not 100% fool proof becuase i only spent bout 30 minuets looking it over, but its decent. (to a mod or member, if i wasnt suppost to do that im sorry :( ) but yeah heres you "working" script, gj on your first script btw :)

{///.-Shady-Shadows Power Miner-. //
By-
ShadowRecon
Edited By-
Matlott, Rasta Magician, and Mikevskater
Credits-
Thanks To Malott For Help
TuT Iland

What it does
* power mines any ore you set to mine

What it needs work on
* Anti-Ban isnt the greatest, but its better than none.
* Anti-Random isnt the greatest either, but better than none.

My First Script!

INSTRUCTIONS:
Use the eye droper to pick color of rock, then if pick is weilded change
line 127 to (1 to 28) or the autoer will drop pick-axe. HAVE FUN!

}

program ShadowPwrMnr;
{.include SRL/SRL.scar}

var
i,x,y,m,Axe: Integer;
axetype: String;

const
RockColor = 5077158;//Change to the Color of the Rock
TypeOfPick = 'Bronze';//Bronze, Iron, Steel, Mithril, Adamant, and Rune are valid types



//////////////////////////////DONT NOT EDIT BELOW!/////////////////////////////
procedure DeclarePlayers;
begin
SRLID := ''; //enter or script will terminate
SRLPassword := ''; //register at srl please if dont have one of these!
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := '';//Enter username
Players[0].Pass := '';//Enter password
Players[0].Nick := ''; //Enter nickname
Players[0].Active := True;
end;
///////////////////////////////////////////////////////////////////////////////
procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
case Random(12) of
0: begin
HoverSkill('Mining', false);
wait(2000+random(1000));
GameTab(4);
end;


4: PickUpMouse;

6: begin
GameTab(1 + Random(12));
wait(1000+random(1000));
GameTab(4);
end;

8: begin
case random(6) of
0: TypeSend('mining lvls?');
2: TypeSend('combat levels');
4: TypeSend('range levels');
end;
end;

10: MouseBox(MSX1,MMY1,MMX2,MMY2,3);
end;
end;

///////////////////////////////////////////////////////////////////////////

procedure FindRandoms;
begin
FindNormalRandoms;
If findfight then
RunAway('N', True, 1, 9000+random(1000));
end;


///////////////////////////////////////////////////////////////////////////

procedure SetupAxeDtm;
begin
Axe := DTMFromString('78DA63B463626078C280020C15D9C0342394C' +
'F680354F398010D30A2AA3107AA7947408D1550CD47026A5C806A' +
'EE1150130054F390801A67A09A6B04D49802D5DCC2AF060011CB0' +
'98C');

end;
///////////////////////////////////////////////////////////////////////////
procedure AutoMining; //By Mikevskater
var
ItemPoint: TPoint;
begin
if invfull then
begin
SetupAxeDtm;
if FindDTM(Axe, x, y, MIX1, MIY1, MIX2, MIX2) then //This will look for pick
begin //then drop rest
for m := 1 to 28 do
ItemPoint := ItemCoords(m);
MMouse(ItemPoint.x, ItemPoint.y, 5, 5);
wait(500 + random(250))
if not(IsUpText(AxeType)) then
DropItem(m);
end else
DropAll;
FreeDTM(Axe);
end;
if (FindColor(x,y,RockColor,4,4,514,337)) then
begin
FindRandoms;
mmouse(x,y,1,1)
Wait(100);
if IsUpTextMulti('ine rock', 'Mine', 'rock') then
mouse(x,y,1,1,true);
wait(3000+random(500))
end else
wait(2000);
end;
/////////////////////////////////////////////////////////////////
procedure setupAxe;
begin
case Lowercase(TypeOfPick) of
'bronze': begin
axetype := 'ronze pickaxe'
end;
'iron': begin
axetype := 'ron pickaxe'
end;
'steel': begin
axetype := 'teel pickaxe'
end;
'mithril': begin
axetype := 'ithril pickaxe'
end;
'adamant': begin
axetype := 'damant pickaxe'
end;
'rune': begin
axetype := 'une pickaxe'
end;
end;
end;
/////////////////////////////////////////////////////////////////
begin
setupsrl;
DeclarePlayers;
SetupAxe;
ActivateClient;
wait(1000);
if (not(LoggedIn)) then Loginplayer;
setangle(True);
MakeCompass('N');
repeat
automining;
antiban
until(false);
end.
If you dont get anything or find something wrong, post or me me and ill be glad to explain, or fix.

metalmax

2008-02-15 10:15:22

Pretty good one

shadowrec0n

2008-02-18 22:08:07

ok thanks. but could someone help me put a main loop on it?

mikevskater

2008-02-18 22:23:32

From: shadowrec0n
ok thanks. but could someone help me put a main loop on it?

if you look i added one in there for you…

Richard

2008-02-19 11:54:29

Putting in a mainloop is quite simple, but if you are having trouble then use this tut: http://www.villavu.com/forum/showthread.php?t=18736

mikevskater

2008-02-19 13:50:25

From: dude_richard
Putting in a mainloop is quite simple, but if you are having trouble then use this tut: http://www.villavu.com/forum/showthread.php?t=18736

thanks richard. i couldnt find a link to a loop tut
(is what i did wrong? like should i have only fixed one procedure?)

Richard

2008-02-19 15:51:41

I hae no idea, I haven't look I was helping him so he could do it on his on, although I found it easier just to loo at other scripts, I just thought it might help if ever needed

upalot

2008-02-19 20:33:39

please try and get the anti banning and randoms in
as fast as possible thankyou

shadowrec0n

2008-02-19 22:26:49

ok thanks guys, ive been having alot of computer trouble and avent quite got it all fixed but as soon as i get everything up and running ill be back to scripting.

off topic-
I got 3 computers and guess what.. all 3 catch the same virus! im running a small home server i aquired from a friend, and 2 other desktop comp. all the hard drives were completely scewed up so i had to reinstall all th OS's and try to et some files back. its almost complete. =)

mikevskater

2008-02-19 23:20:09

Hey sorry, i realised something that I screwd up on in the setup axe procedure….

procedure setupAxe;
begin
case Lowercase(TypeOfPick) of
'bronze': begin
axetype := 'ronze pickaxe'
end;
'iron': begin
axetype := 'ron pickaxe'
end;
'steel': begin
axetype := 'teel pickaxe'
end;
'mithril': begin
axetype := 'ithril pickaxe'
end;
'adamant': begin
axetype := 'damant pickaxe'
end;
'rune': begin
axetype := 'une pickaxe'
end;
end;
end;
should be:

procedure setupAxe;
begin
case Lowercase(TypeOfPick) of
'bronze': axetype := 'ronze pickaxe';
'iron': axetype := 'ron pickaxe';
'steel': axetype := 'teel pickaxe';
'mithril': axetype := 'ithril pickaxe';
'adamant': axetype := 'damant pickaxe';
'rune': axetype := 'une pickaxe';
end;
end;
Just making it look better in case you plan on using to apply for membership.
And also remove the "i" integer because its not used and it just gets annoying.

shadowrec0n

2008-02-24 22:49:12

kk, i updated it. i also added smart to it. =)
thanks alot. ive learned alot form this simple script. im wokring on a draynor woodcutter atm, i have been testing a few different ones, and i noticed that if thep erson died, it couldnt cut any more. so why not make it so if the person dies, it walks back to drynor from lummy.. or if it can not find the trees it tele's to lummy (usen home) and walk back? radial walking isnt easy tho… if anyone has any good tut that arnt on the forum about radial walking post them.

Iron Man

2008-02-29 03:31:55

stop double/tripple posting. Use the edit button like said before.

Also i'm pretty sure theres a tut on radialwalk in intermediate(sp?) tut section. I think its stickied. (i know you said on a diff site but i'm not going to search sites…also google would help you here)

Btw using search button and looking around the tut section would solve your need-a-tut problem.

taytot

2008-07-05 02:22:54

What does this mean ::

Line 129: [Error] (12857:4): Unknown identifier 'IsUpTextMulti' in script E:\Documents and Settings\Jesse\Desktop\ShadowPowerMiner(SMART).scar

insanomano7

2008-07-05 07:49:03

SMART, working your way up there..