SRL Archive - First Scripts

AutoAlcher - By Wewt


Wewt

2009-10-14 14:42:26

Hey all :)
I'm releasing this as my first script. There are some errors in it, but I'm hoping that some people in this community will be able to help me with them. By the way, I have DEV SRL.

So, this is what the name implies: an AutoAlcher. It will alch any bank note that is in your inventory. Just make sure you can cast High Alchemy. I'm going to add an option for Low Alchemy later, even though it's not really worth it.

The one error I know about is after it alchs something, it will move the mouse to the minimap, and then to the high alchemy icon. Does anyone know why this happens?

Future additions include making working multiplayer, creating some kind of antiban(not sure what yet), and….that's about it. If you have any suggestions, please let me know!

The script is attached below :) Please tell me what you think.

Version 1.1
- Added Multiplayer
- Added breaking system, instead of notes to do

Dynamite

2009-10-14 14:44:59

Just downloaded.
Will look through and give you some stuff :)

Wewt

2009-10-14 15:00:49

From: The Man
Just downloaded.
Will look through and give you some stuff :)


Thank you :)

Awkwardsaw

2009-10-14 15:09:27

you left your details in there, i changed the pass real fast and pm'd you the details

script wise:

procedure GoToMageTab;
begin
Gametab(tab_magic);// the number 28 isnt even a valid tab, tab_magic is the correct way to use it :)
end;

looking at it more :)

in this procedure:
procedure SetUpSpellBook;
var
listInfo : TBooleanArray;
begin
// Switch to magic gametab
GoToMageTab;
listInfo := SpellsAvailable;
// Setup COMBAT TAB
if(listInfo[0] = true) then ClickSpellMode(0);
// Setup TELEPORT TAB
if(listInfo[1] = true) then ClickSpellMode(1);
// Setup MISC TAB (where alching is!)
if(listInfo[2] = false) then ClickSpellMode(2); //is that suposed to be false? if not, look at my example below
// Setup SKILLS TAB
if(listInfo[3] = true) then ClickSpellMode(3);
if(SpellAvailable(spellBox, 'High Level Alchemy') = false) then
ableToAlch := false
else
ableToAlch := true;
end;


procedure SetUpSpellBook;
var
listInfo : TBooleanArray;
i : integer;
begin
// Switch to magic gametab
GoToMageTab;
listInfo := SpellsAvailable;
for i:= 0 to 3 do
if (listInfo[i]) then ClickSpellMode(i);

if SpellAvailable(spellBox, 'High Level Alchemy') then //there is no need to check if its false
ableToAlch := true; //booleans are set to false by default, unless its set to true

end;

actually, you can change
   if SpellAvailable(spellBox, 'High Level Alchemy') then //there is no need to check if its false
ableToAlch := true; //booleans are set to false by default, unless its set
to
 abletoalch:= SpellAvailable(spellBox, 'High Level Alchemy') 
because all SCAR sees in SpellAvailable is either true, or false. so what ever that equals, abletoalch will too :D

are you understanding this? :p if not, either read my basic scripting tut(its very informational on this stuff) or add my on msn: [email]akwardsaw@hotmail.com[/email]

Wewt

2009-10-14 15:13:33

Oh dang! Thanks a lot =D

And yes, I'm understanding it. A for loop would have been better in the first place.

Baked0420

2009-10-14 15:26:39

you should use the tab_(insert tab name here) instead of GameTab(25), using the constants will make it so if dev's update the SVN, your script won't break and you won't need to change the gametab to a different number.

in MoveMouseToNote you have:

FindDTM(NoteDTM,x,y,1,1,800,800)

notice the 1,1,800,800, well in SRL they have a bunch of set constants for us that make searching for things very easy, they include:
- MainScreen searches
-MSX1, MSX2, MSY1, MSY2 (MSX1 and MSY1 is the top left of the main screen, MSX2, and MSY2 are the bottom right, so you'd set it up in this order: MSX1, MSY1, MSX2, MSY2)
-MSCX, MSCY these are the mid-points of the mainscreen, MSCX is half way between MSX1, MSX2 (X coords go left and right, it's half way from left side to right) MSCY is the same, it's half way between MSY1, and MSY2, but it's half way from the top to bottom, instead of from side-to-side
- Inventory Searches
- MIX1, MIX2, MIY1, MIY2, all the same rules apply here, except this is for the inventory, instead of the mainscreen, so read above for descriptions, but switch the words mainscreen with inventory
- MICX, MICY, half way from the left to right and top to bottom of the inventory
- Minimap Searches
- MMX1, MMX2, MMY1, MMY2, and the same for here, but it's the top left and bottom right coords of the minimap, instead of the mainscreen or inventory
- MMCX, MMCY, half way from left to right and top to bottom of the Minimap

Well I hope that helps ya ;) if you need help understanding any of it just PM me.


but nice script, you remembered to free the dtm and everything, only thing I'd say to add is make it so instead of having to do all the alchs, make it so they can either select how many they want to alch, a specific number to alch, or amount of loads, people usually do loads though, but you could make them pick either or if you really wanted, or just implement one, your choice. It'd make it better, instead of making the script alch every note, someone could potentially have enough to stay on RS for 1 week straight auto alching never logging, they'd get banned. So make people enter the amount they want to alch/amount of loads. Maybe also add in sleeping. (you mentioned multiplayer, so I won't say it, but you should add it)

Wewt

2009-10-14 15:33:50

Okay, I see about the DTM finding.
Does SRL have any built in Timing functions, in order to find out time till break and things like that?

Awkwardsaw

2009-10-14 15:53:39

use this as an example:

var starttime : integer;
procedure break;
begin
if timefrommark(starttime) > (50 + random(50)) * 60 * 1000 then
begin
logout;
wait((60 + random(10)) * 1000);
loginplayer;
end;
end;
begin
marktime(starttime);
repeat
wait(1000);
break;
until isfkeydown(12);
end.

try to convert the time your self, this times 1000(mili seconds) into min(the 60) ect, lol

Wewt

2009-10-15 15:59:39

I'm trying to implement Multiplayer now…got a working breaking system, and trying to get multiplayer into it.

Edit: I just uploaded a new version, with Multiplayer and breaking. Tell me what you think, and if I could change anything in the methods used