SRL Archive - First Scripts

HerbloreCleanerAIO


ForMyFutures

2013-02-05 04:45:52

Alright, So I've been working on this the past few (3?) days and it is officially the first script of mine.

All criticism is welcome. So far for me, no bugs. I've only used it in Edgeville, and Varrock West Bank.

It should clean any herb you place in your bank (Slot #10 ); First Row, all the way to the right.

I would like constructive criticism though :) Only started scripting for about a week.

xtrapsp

2013-02-05 06:19:02

It was all going great until the mainloop.

I would suggest making a procedure which loads all your DTM's then when the script end it releases them :)

ForMyFutures

2013-02-05 06:31:43

So would this work if I just called it once in the script?


procedure ScriptVars;
begin
BankDTM := DTMFromString('mFQEAAHicnczNCoMwEATgEbTV2DSGmGr9qRD0UOixd9'
+ '//rRzCFvRoFz6WHZjVAGqqqKQL5ZSRJS33nYpd/hKt9DvqyZMjI90rpfL3Pa8I4' +
'xfD84PWL3H/1HaC0Q1uysGaPmYPF6DYOyv5w2E2E3sGgA==');
InterfaceDTM := DTMFromString('m1gAAAHic42JgYOAGYg4gZgFiNijNDhX'
+ 'nB2I+IBYAYh6oGCcQswIxExAzQtkwPkjOAoijFBkYu'
+ 'rwYGJS4GRlWZzMwNAcyMDwCimsBDTnVzcCwuZCBgYuBOMxIJEYAAJtNCEY=');
AllDone := StrToInt(HerbAmount);
AddOnTerminate('FreeDTM(BankDTM)');
AddOnTerminate('FreeDTM(InterfaceDTM)');
AddOnTerminate('CleanedHerbs');
end;

Press Play

2013-02-06 15:33:34

The script look pretty good :) Only part I found a little "off" was:
FindDTM(BankDTM, a, b, MSX1, MSY1, MSX2, MSY2);
MMouse(a, b, 3, 3);
WaitUpText('anker', 600);
ClickMouse2(mouse_right);
ChooseOption('ank');

Are you using a DTM to look for a mainscreen item? It would be much more preferable to use a simple colour finding fuction like FindColorTolerance();. Mostly though, mainscreen objects are found using TPAs and ATPAs (a bit more advanced).

Alos have a look at what @xtrapsp said too; that procedure in the above post would work, yes :)

ForMyFutures

2013-02-07 19:47:51

From: -daazndagger-

Are you using a DTM to look for a mainscreen item? It would be much more preferable to use a simple colour finding fuction like FindColorTolerance();. Mostly though, mainscreen objects are found using TPAs and ATPAs (a bit more advanced).

Alos have a look at what @xtrapsp said too; that procedure in the above post would work, yes :)


Hey thanks, since then I've learned actually quite a bit and updated the procedures. It runs essentially flawless, however it is sort of a brute method where the script assumes you have the correct items, etc. I just don't think a lot of the UpText procedures are 100% accurate and I want to focus on longevity instead of complete accuracy. I'll look into implementing into the script a procedure where it must find the uptext before proceeding, sort of like a repeat…until kind of thing. However, this could cause a logical error where the script might get stuck for a number of seconds before continuing on.

Press Play

2013-02-07 20:13:19

From: ForMyFutures
Hey thanks, since then I've learned actually quite a bit and updated the procedures. It runs essentially flawless, however it is sort of a brute method where the script assumes you have the correct items, etc. I just don't think a lot of the UpText procedures are 100% accurate and I want to focus on longevity instead of complete accuracy. I'll look into implementing into the script a procedure where it must find the uptext before proceeding, sort of like a repeat…until kind of thing. However, this could cause a logical error where the script might get stuck for a number of seconds before continuing on.


Sounds good :) Just be careful with the "brute method", because it can cause problems if something goes wrong. Since randoms are gone though, it's probably a lot safer than it used to be.

For UpText, I recommend you look into IsUpTextMultiCustom. It allows more than one string input to look for.

ForMyFutures

2013-02-07 21:59:29

What about walking? I tried SPS, Obj_DTM, and they both are good, but not 100%. What do you recommend?