SRL Archive - First Scripts

My first script(Copper ore miner+banker)


Total

2012-03-24 04:34:56

TotalMiner V2.35


So here is my first script thus far. Kinda crazy looking at the first one, its so bad lol. Hopefully I can keep improving it because I know some things are still wrong with it and it has some bugs, but I think its decent now. I really need to work on my standards because I have stuff everywhere but hopefully it will come in time.

Features:
-Mines Tin/Copper from the mine south of lumbridge
-Option to bank or drop ores
-Option to use home teleport to bank or walk
-Option to keep or drop gems
-Option to mine only tin, only copper, or both
-Option to use left clicks while mining, right clicks while mining, or both
-Can set time interval between clicking rock again
-Failsafes on a lot of things. If you fail most things it will home teleport and try again.

Instructions:
-Enter the settings and start the script. The settings are next to their respective choices.

Currently working on:
-Make mining ores faster and more accurate. Sometimes it stands there until it times out.
-Proggy has wrong ore count, need to look at the loops and see whats going on
-Instead of logging out, will just home teleport as failsafe
-Improve color finding. Some of the procedures need to be redone because they cannot be found or are barely working.
-Add more failsafes
-Some DTMs not releasing, need to find out where
-Proggy exp sometimes displays crazy number

Proggies:
V2.2

//////TotalMiner V2.2//////
Copper mined: 53
Tin mined: 48
Inventories banked: 4
Running for: 28 minutes.
/////////////////////////////

//////TotalMiner V2.2//////
Copper mined: 37
Tin mined: 34
Inventories banked: 5
Running for: 00:31:55
///////////////////////////
^ With 40ish mining and bronze pick, ore counts are off.

V2.3

//////TotalMiner V2.3//////
Copper mined: 193
Tin mined: 170
Inventories banked: 13
Running for: 01:01:42
///////////////////////////

//////TotalMiner V2.3//////
Copper mined: 255
Tin mined: 213
Inventories banked: 17
Running for: 01:21:32
Exp gained: 8312
///////////////////////////

//////TotalMiner V2.3//////
Copper mined: 665
Tin mined: 632
Inventories banked: 48
Running for: 03:46:04
Exp gained: -113198842 <--- WTF?
///////////////////////////


Changelog:
v1.0 : Script released (3/22/2012)
v2.0 : Complete revamp of script. (3/24/2012)
v2.1 : Improve various methods. Added progress report. (3/25/2012)
v2.2 : IMPROVE MOAR METHODS. Also added some failsafes. (3/26/2012)
v2.3 : General stability increased. Fixed some standards issues. Refined some methods. Fixed progress report ore counts. Added antiban while mining. (3/27/2012)
v2.35 : Changed all failsafes to use home teleport. Should be pretty stable now. (3/27/2012)

If you happen to find any bugs it should spit out something in the debug box with what went wrong, come and let me know. Thanks and enjoy.

eska

2012-03-24 04:41:49

Ima review your script if you don't mind :D let me check it

First let me say this, what I'm about to say might seem harsh to you but really it's not. You are doing good for a first script.

Standards : I recommand learning those first so you don't learn to script the "bad" way. http://villavu.com/forum/showthread.php?t=60288
This include variable name, missing semicolon (;) and bad indentation. I'm surprised the code compiles though, I'm used to C++ so when theres a slight mistake nothing work, pascal is more forgiving.

FreeDTMs
: When you free your DTM, you use FreeDTM and free them one by one. Instead, you could free them all at once using FreeDTMs.

Global DTM : You should make your DTM global instead of creating/freeing new one everytime you need it. To free those DTM you should add a procedure that will free them all when the script terminate.
AddOnTerminate('TheNameOfTheProcedureThatFreeDTMHere');

procedure TheNameOfTheProcedureThatFreeDTMHere;
begin
try
// DTMs
FreeDTMs(q); // This free all DTMs in the array
FreeDTM(DTM_CopperOre1); // This free a single DTM

except
WriteLn('Some memory might have been leaked.');
end;

end;

Theres alot of small stuff that isn't right but it is understanable.
I suggest you look other script and try to understand what the scripter did simply because that's how I did and it worked for me. Thats how I managed to learn how to script for simba so quickly.
Basicaly I would take a script, look at it, UNDERSTAND it and modify it to my liking. If you can understand more advanced script, then it means you can make more basic stuff easily. And when you don't understand what is done in a script at some point, go to the tutorial section and try to learn it. Say there is a function that you do not understand called FindTPAObject, you would go search about TPA in the tutorial section. That way, in no time you'll have a good idea of how things work, what are the option do to stuff with simba, and then you can practice with making your own advanced script.

Total

2012-03-24 04:43:14

Go ahead. I'm heading to bed, hope to see some reviews/halp in the morning cuz I know its not very good lol.

eska

2012-03-24 05:14:45

I'm gonna go sleep too, you're on the right track.

Total

2012-03-24 11:59:25

Thanks for the constructive feedback. Really appreciate it. I guess I will go look at some other scripts and maybe modify some scripts before I start working on this one again.

Total

2012-03-26 04:16:11

Second version released and I think its considerably better. Still working on some stuff but looking good atm. If anyone looks at the code and has some tips I'd appreciate it.

EDIT: Sorry for double posting. Didn't realize I had previous post. :S

RightClick

2012-03-27 17:36:17

Your first script, v1.0 is very good for a begginer :)
Good work. v1.0 to 2.3, good progress :D

Total

2012-03-28 14:53:21

Thanks. Updated, changed all failsafes to just hometeleport and try again.

Raskolnikov

2012-03-28 18:36:52

Hi. Really great first script, it's pretty awesome ;).

I have just one thing that concerns me. Line 178-180 confuses me a little bit, I think you should take a look at what you are trying to do there. I don't know why you have an if then statement, then a function, then a random begin there. Be sure to check that out.

Other than that, I'll test it as soon as I install my VM.