SRL Archive - OSR Help

Antiban & Randoms


Footy

2012-06-24 19:29:34

Hey, I just made my first script that actually runs for more then 30 seconds, super super simple alcher, but I'd like to incorperate a randomdectection and antiban into it, can anyone help me with this? Heres my script


program Alcher;
{$i srl/srl.simba}

Procedure alch;
var
x, y:integer;
begin
if findcolorspiraltolerance(x, y, 226957, 568, 370, 580, 382, 5) then
mouse(x, y, 3, 3, 1);
wait(randomrange(100, 213));
mouse(x, y, 3, 3, 1);
wait(randomrange(1612, 2136));
end;

begin
setupSRL
repeat
Alch
until(false);
end.

(s)okkr7

2012-06-24 19:35:19

Yeah, here's the updated code:

program Alcher;
{$i srl/srl.simba}

Procedure AntiBan;
begin
{Insert antiban here}
{If you need help....}
{just PM me...........}
end;

Procedure alch;
var
x, y:integer;
begin
If (Not(FindNormalRandoms)) then
Begin
if findcolorspiraltolerance(x, y, 226957, 568, 370, 580, 382, 5) then
mouse(x, y, 3, 3, 1);
wait(randomrange(100, 213));
mouse(x, y, 3, 3, 1);
wait(randomrange(1612, 2136));
end;
end;

begin
setupSRL
repeat
Alch
AntiBan;
until(false);
end.

What I edited:
FindNormalRandoms= SRL's compilation of random events
& AntiBan procedure!

Footy

2012-06-24 19:38:09

Lol, I've only been scripting for 3 days, so I have 0 idea how I'd do it, and it also cant slow down my aching by much. Also, would I insert an if text failsafe into my script? Thanks!

stuartroad

2012-06-24 19:45:57

Generally with antibans, its easier just to copy someone elses, simple hover skill magic, quick afks, hover random skills, just look in some other magic scripts and steal it, always good to give credit, things like that do not have to be unique. also dont forget to include it in the mainloop. and it is best to have the antiban procedure right after you declare players i believe.

Footy

2012-06-24 19:49:14

Well, I haven't learned declare players, is it necessary if I'm not using smart, and only using the script for myself? I'll just find another slicers antiban and nip that. But how would I do a failsafe, so if I stop aching, of I run out of nats, it stops?

stuartroad

2012-06-24 19:55:13

Well seem as though you are using colour of the alch thing, if you run out of nats it wont be coloured, so if it doesn't find the colour then it logs out, not entirely sure how to implement that,

You dont need to declare, if you are already logged in. And also generally you would alch in soulwars, so you don't get randoms, hence not needing the find normal randoms bit, but it doesnt hurt to have that in.

P1ng

2012-06-24 20:22:42

I'd suggest just using it in soulwars if you are going to run it for an extended period of time, otherwise implement the anti-randoms between clicking the high alch symbol and clicking the item you wish to alch.

FindNormalRandoms will open up your inventory tab so that's why I put it there with a short wait before it calls the anti-randoms so that the InvTab is already open.

For anti-ban do as suggested above, find another person's antiban on a released script and use that (with credit). Antiban doesn't differ all that much from script to script so it's not a huge issue, but before using it try to have a flick through and learn what each of the bits of code does so that you understand it a bit better and can then implement it yourself next time without just copying others.

I'd look more in-depth into adding failsafes for when things could possibly go wrong in your Alch procedure and such, like at the moment you search for the colour of the high alchemy logo and then click, short wait and then click again.

I would recommend maybe using ExistsItem and CoordsToItem to make sure that there is actually something there to alch because otherwise if you run out of items and still have runes it will just sit there constantly clicking nothing (looks alot like a bot, no human would do that).

Footy

2012-06-24 20:25:46

lol, ive been alching in soul wars the whole time, didnt even think about that. I tried what you said, but im not sure if im doing it right… When I run it, it presses the alch button, then shuts down…

program Alcher;
{$i srl/srl.simba}

Procedure alch;
var
x, y:integer;
begin
if findcolorspiraltolerance(x, y, 226957, 568, 370, 580, 382, 5) then
mouse(x, y, 3, 3, 1) else
logout;
terminatescript;
wait(randomrange(100, 213));
ClickMouse2(1);
wait(randomrange(1612, 2136));
end;

procedure AntiBan;
begin
if(not(LoggedIn))then
exit;
Findnoninventoryrandoms;
Case Random (2500) of
0..18: Begin SleepAndMoveMouse(5000 + Random(750)); End;
19..24: Begin GameTab(tab_Inv) ExamineInv; GameTab(tab_Magic); SleepAndMoveMouse(2500 + Random(553)); End;
25..42: Begin RandomAngle(1); End;
43..48: Begin GameTab(Tab_Stats); Wait(3000 + Random(400)); GameTab(tab_Magic); SleepAndMoveMouse(2550 + Random(658)); End;
49..54: Begin GameTab(tab_Stats) HoverSkill('random', False); GameTab(tab_Magic); SleepAndMoveMouse(2200 + Random(545)); End;
55..60: Begin PickUpMouse; End;
61..66: Begin RandomMovement; End;
67..72: Begin BoredHuman; GameTab(tab_Magic); End;
73..78: if(gametab(tab_inv))then Begin ExamineInv; GameTab(tab_Magic); End;
End;
end;

begin
setupSRL
repeat
Alch
Antiban
until(false);
end.
and i got an awesome antiban from LEETZalcher, :D

E: Just read your post Ping, about the failsafe, i have no idea what either of those things do, so I would have no idea how to implement them into my script… Could you put them into the above script, then show me how you did it and what they mean?
Thanks soo much!

P1ng

2012-06-24 20:31:08

if findcolorspiraltolerance(x, y, 226957, 568, 370, 580, 382, 5) then
mouse(x, y, 3, 3, 1) else
logout;
terminatescript;

What you are telling the script here is if you find this colour then click it otherwise logout.
When you are done doing one of those two things, terminate the script.

Footy

2012-06-24 20:34:48

ooooooh, so if i put an and inbetween them, it would mean if it doesent find it, do both?

E: this is what i attempted, got a type mismatch

if findcolorspiraltolerance(x, y, 226957, 568, 370, 580, 382, 5) then
mouse(x, y, 3, 3, 1) else
logout and
terminatescript;

P1ng

2012-06-24 20:38:47

  begin
if FindColorSpiralTolerance(x,y,226957,568,370,580,382,5) then
Mouse(x,y,3,3,mouse_Left) else
begin
LogOut;
TerminateScript;
end;

Instead of using an 'and' (you were on the right sort of track) use a begin and end;

Footy

2012-06-24 20:39:32

that makes sense. Thanks, everything compiles and works!

P1ng

2012-06-24 20:59:05

if ExistsItem(CoordsToItem(x,y)) then //Is there an item where your mouse is?
begin
ClickMouse2(mouse_Left); //if yes then click it
WriteLn('Successfully clicked the item');
end else
begin
WriteLn('No item available'); //we do this if there was no item there
LogOut; //player logs out
TerminateScript; //script shuts down
end;

ExistsItem - This checks if there is an item at the integer you specified. Each inventory slot has a number associated with it i.e. inventory slot 1 through to 28.
CoordsToItem(x,y) - This gets the position of your mouse and then converts it into the appropriate integer for the inventory slot. Thus, I used this to replace putting in a single number which would limit the player to having their spellbook setup a certain way to ensure their high alch and item were lined up.

Hopefully that all makes sense to you what I did there :)

Footy

2012-06-24 21:24:40

Makes sense, and I've just expanded my scripting "vocabulary", I assume I add this in after I click the high alch button, as that's all that makes sence to me… Thanks so much to everyone who helped! I am now a little bit less of a noob! :)