Junior
04-09-2007, 05:57 PM
All About anti-ban and randoms
BY: Junior
I don’t know if a tutorial like this was already made, but I see a lot of people asking how to implement/add anti-ban or randoms into there script. These procedures and functions are NOT mine, there come straight out of SRL. You will need the newest version of SRL for this tutorial, found in the Download SRL here section (http://www.villavu.com/forum/showthread.php?t=2802?t=3410).
EDIT: Yes, there also is a tutorial on this by WhiteShadow. Link here (http://www.villavu.com/forum/showthread.php?t=633).
So, your probably here wondering how to implement some anti-ban into your script, well you came to the right place. Anti-ban is simply a procedure, function, or a collection of both coded into your script to make it seem more human like and solve some randoms for you, don’t expect to have all randoms solved, ill talk about that later on anyway. It can be from making a random mouse movement, to clicking on something, rotating the screen, or whatever floats your boat. Now, I will start with the basics, and move on to more procedures and then to functions, and how to actually use functions efficiently.
First I will talk about: How to make random mouse movements
This isn’t that important, but its better then just leaving the mouse sit. For something like this, I will use the procedure MouseBox. MouseBox is a procedure were your mouse moves to a random coordinate in a box you set as the area. I’ll show you how its coded.
MouseBox(MSx1, MSy1, MSx2, MSy2, 3); This will move the mouse to a random coordinate on the main screen, or you can change the area you whatever you wish. The last number in that procedure is the type of click you want. 1 = left click, 2 = right click, 3 = NO click. I’ll leave it to 3 so it just moves the mouse for us. If you don’t know what MSx1, MSy1, are etc… Those are cords that are already set for the main screen. The others are MIx1, MIy1, MIx2, MIy2 for the Inventory, and there’s MMx1, MMy1, MMx2, MMy2. Those are set for the Mini map.
Now for those of you that don’t know this, there is a procedure where it hovers over your skills as if you were checking the exp. This procedure is called… HoverSkill. HoverSkill is coded like this. HoverSkill('Attack', False) This will hover over the skill you put into the string (''), and the last part where it says False, it is there for if you want there to be any clicking. Obviously, false means no clicking. You can also insert the word Random into the hover skill string, that makes it hover over any random skill. The word False or a identifier resulting only True or False is considered a boolean by the way. There is also procedures such as AntiBan, BoredHuman, and PickUpMouse. Check this (http://www.srl-forums.com/forum/Manual.php?do=AntiBan) or this (http://www.srl-forums.com/forum/Manual.php?do=xAntiBan) out for more procedures.
Now, I will talk about: Combining procedures and functions
into a group, or choose a random one out of the ones you provided. I will use the procedures I used above in a special procedure to select a random one. This procedure is called a case. Cases can be used in many ways, but ill show you this way. I will start off by doing this. case Random(10) of That is basically choosing a random number from the range of 0 to 10. Now ill code out the whole procedure for you.
case Random(10) of
2: MouseBox(MSx1, MSy1, MSx2, MSy2, 3);
4: HoverSkill('Attack', False); // or HoverSkill('Random', False);
6: MouseBox(MIx1, MIy1, MIx2, MIy2, 3);
9: BoredHuman;
end; //You need this end, think of a case as like a 'begin'
Now ill explain, the case will chose a random number from the range of 0 - 10. If it picks a number that matches the number in the case (either 2, 4, 6, or 9) then it will perform that procedure that the number has. Like me when I first started out with cases, I didn’t know this. If the number is not there, and in this case there 1, 3, 5, 7, 8, or 10, NO procedure or function will be performed, it will just exit out of the case. For more about cases, look here (http://www.villavu.com/forum/showthread.php?t=1002?t=1155&highlight=cases).
Now I will talk about: Random Chatting/ Auto-talking
I will not get into detail with this, but most people like auto talkers and such. Personally, I never use them because I think there’s not need if you auto correctly. To detect chat in the chat box, you the function InChat, or InChatMulti. This function is a Boolean, you should now what that is by now (read above if you dont). It is coded like this.
if (InChat('yo')) then TypeSend('whats up?'); That’s saying if the word "yo" appears in the chat box, then you will type "whats up". Remember, if there is more then 1 procedure after a then you need a begin. Most people don't know this, I sure didn’t when I started scripting. An example of what I am saying
if (InChat('yo')) then
begin
Wait(500 + Random(500));
TypeSend('whats up?');
end;
//InChatMulti works the same way, just coded like below.
if (InChatMulti('he', 'ell', 'llo')) then Without the begin, it will only wait, but type what’s in the TypeSend procedure regardless. And remember for every begin, you need an end. There is also a procedure where it chats for you, randomly. This procedure is called RandomChatEvery. That procedure is coded like this, RandomChatEvery(2 + Random(2)); the integers (numbers) in that procedure mean that it will random chat every 2 plus a random 2 minutes. This wasn’t much on auto talking/random chatting, but there’s a better tutorial on this made by WT-Fakawi. This link (http://www.villavu.com/forum/showthread.php?t=1143?t=1310), all credits go to Fawki. Or take a look at this link (http://www.srl-forums.com/forum/Manual.php?do=AutoTalk) for a SRL manual page.
Now I will talk about: Finding and solving Random Events
This is what you guys want to know isn’t it? Well, its easy to tell you the truth. You will only need a couple of procedures for random events to be solved. First you will need a DeclarePlayers procedure.
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := 'Usernamehere';
Players[0].Pass := 'Passwordhere';
Players[0].Nick := 'Nicknamehere'; //3 - 4 letters of YOUR username, example: sern
Players[0].Active :=True;
end;
You will also need a procedure to create a bitmap of your nickname, and this is VERY VERY important, or NO talkin random event will be solved for you. The procedure is simply
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
That will need to be in the main loop towards the beginning , it only needs to be called once per player. Say a Frog comes up now, or a Old Man, or Rick, or anyone who says your name, the procedure that is used in functions to look for your name is the NickNameBMP, that I posted above. The most popular used random finding procedure is called FindNormalRandoms. It will look for all normal randoms. Some randoms like ScapeRune, Mime, Maze, and some others can NOT be solved by the difficultness of them. So for these you will need different functions. They are called FindScapeRune, FindMime, FindMaze. There is also a function that detects whether you are dead or not, called WeAreDead. The function FindTalk finds talking randoms, and you can also use FTWait(1000 + Random(500)), which waits while finding talking randoms, although FTWait, is NOT a function. To see more functions for finding randoms or to detect anything else like finding a fight, check out this link (http://www.srl-forums.com/forum/Manual.php?do=AntiRandoms).
This will explain: Skill based randoms and how to solve them
Skill base randoms are considered ents, whirlpools, and gas (while mining). There are special functions for these. The procedure FindEnt(TreeColor: integer) is used to… find an ent. Where it says TreeColor, that’s the color of the tree, obviously. So it would look like FindEnt(21321432); //NOT an actual tree color. There’s nothing really to explain about these, but this link (http://www.srl-forums.com/forum/Manual.php?)will provide you with what procedures or funtions to use during what skill your macroing on. Look at the left for the word Skill Includes, and all skills will be listed.
Let me explain how to: Use random event solving function in a loop
Can you see how almost every random event solver is a function, that is useful in a way. If your in a loop during your script, randoms can cause you to stop what your doing. An example will be like cutting a tree, or fishing, or mining. During any of these a random event can stop your actions. In many scripts people use time marks for waiting for a rock to be mined, or cutting down a tree. This procedure will show you what I am talking about by using these functions to break out of a loop. First I will set a time mark for how long you want to cut a tree, mine, etc.. And then while your still under the time mark it will check for a ent, gas, or anything else you put in your procedure. If it finds any of these it will break out of the loop, exit or whatever you want it to do. Ill show you how it works.
MarkTime(WaitTime); //VARIABLE for that procedure
while (TimeFromMark(WaitTime) < 10000) do //WHILE the time is under your set time, in this procedure its 10 seconds, DO the following.
begin //remember why you need the begin?
If (FindEnt(TreeColor)) or (FindNormalRandoms) then break;
case Random(5) of
2: MouseBox(MSx1, MSy1, MSx2, MSy2, 3);
5: MouseBox(MIx1, MIy1, MIx2, MIy2, 3);
end;
end;
See how I used if … then break? that means if it finds the ent or the function FindNormalRandoms results true, it will break out of that loop, meaning you don’t have to wait all that extra time waiting for the TimeMark. If you don’t understand this, I can help. This is just a more sufficient way of macroing, makes for faster procedures instead of just waiting there. This can be used for every function which is boolean, not just what I used above.
I tried to make this tutorial as noob proof as possible. Please if you don’t understand anything, do NOT PM me, post here instead. And if there is anything else you will like me to explain, just tell me what it is. If you read this whole tutorial and want to see a sample script, check out the sample script I attatched, and remembers its just an example script, it doesn’t actually compile/work.
BY: Junior
I don’t know if a tutorial like this was already made, but I see a lot of people asking how to implement/add anti-ban or randoms into there script. These procedures and functions are NOT mine, there come straight out of SRL. You will need the newest version of SRL for this tutorial, found in the Download SRL here section (http://www.villavu.com/forum/showthread.php?t=2802?t=3410).
EDIT: Yes, there also is a tutorial on this by WhiteShadow. Link here (http://www.villavu.com/forum/showthread.php?t=633).
So, your probably here wondering how to implement some anti-ban into your script, well you came to the right place. Anti-ban is simply a procedure, function, or a collection of both coded into your script to make it seem more human like and solve some randoms for you, don’t expect to have all randoms solved, ill talk about that later on anyway. It can be from making a random mouse movement, to clicking on something, rotating the screen, or whatever floats your boat. Now, I will start with the basics, and move on to more procedures and then to functions, and how to actually use functions efficiently.
First I will talk about: How to make random mouse movements
This isn’t that important, but its better then just leaving the mouse sit. For something like this, I will use the procedure MouseBox. MouseBox is a procedure were your mouse moves to a random coordinate in a box you set as the area. I’ll show you how its coded.
MouseBox(MSx1, MSy1, MSx2, MSy2, 3); This will move the mouse to a random coordinate on the main screen, or you can change the area you whatever you wish. The last number in that procedure is the type of click you want. 1 = left click, 2 = right click, 3 = NO click. I’ll leave it to 3 so it just moves the mouse for us. If you don’t know what MSx1, MSy1, are etc… Those are cords that are already set for the main screen. The others are MIx1, MIy1, MIx2, MIy2 for the Inventory, and there’s MMx1, MMy1, MMx2, MMy2. Those are set for the Mini map.
Now for those of you that don’t know this, there is a procedure where it hovers over your skills as if you were checking the exp. This procedure is called… HoverSkill. HoverSkill is coded like this. HoverSkill('Attack', False) This will hover over the skill you put into the string (''), and the last part where it says False, it is there for if you want there to be any clicking. Obviously, false means no clicking. You can also insert the word Random into the hover skill string, that makes it hover over any random skill. The word False or a identifier resulting only True or False is considered a boolean by the way. There is also procedures such as AntiBan, BoredHuman, and PickUpMouse. Check this (http://www.srl-forums.com/forum/Manual.php?do=AntiBan) or this (http://www.srl-forums.com/forum/Manual.php?do=xAntiBan) out for more procedures.
Now, I will talk about: Combining procedures and functions
into a group, or choose a random one out of the ones you provided. I will use the procedures I used above in a special procedure to select a random one. This procedure is called a case. Cases can be used in many ways, but ill show you this way. I will start off by doing this. case Random(10) of That is basically choosing a random number from the range of 0 to 10. Now ill code out the whole procedure for you.
case Random(10) of
2: MouseBox(MSx1, MSy1, MSx2, MSy2, 3);
4: HoverSkill('Attack', False); // or HoverSkill('Random', False);
6: MouseBox(MIx1, MIy1, MIx2, MIy2, 3);
9: BoredHuman;
end; //You need this end, think of a case as like a 'begin'
Now ill explain, the case will chose a random number from the range of 0 - 10. If it picks a number that matches the number in the case (either 2, 4, 6, or 9) then it will perform that procedure that the number has. Like me when I first started out with cases, I didn’t know this. If the number is not there, and in this case there 1, 3, 5, 7, 8, or 10, NO procedure or function will be performed, it will just exit out of the case. For more about cases, look here (http://www.villavu.com/forum/showthread.php?t=1002?t=1155&highlight=cases).
Now I will talk about: Random Chatting/ Auto-talking
I will not get into detail with this, but most people like auto talkers and such. Personally, I never use them because I think there’s not need if you auto correctly. To detect chat in the chat box, you the function InChat, or InChatMulti. This function is a Boolean, you should now what that is by now (read above if you dont). It is coded like this.
if (InChat('yo')) then TypeSend('whats up?'); That’s saying if the word "yo" appears in the chat box, then you will type "whats up". Remember, if there is more then 1 procedure after a then you need a begin. Most people don't know this, I sure didn’t when I started scripting. An example of what I am saying
if (InChat('yo')) then
begin
Wait(500 + Random(500));
TypeSend('whats up?');
end;
//InChatMulti works the same way, just coded like below.
if (InChatMulti('he', 'ell', 'llo')) then Without the begin, it will only wait, but type what’s in the TypeSend procedure regardless. And remember for every begin, you need an end. There is also a procedure where it chats for you, randomly. This procedure is called RandomChatEvery. That procedure is coded like this, RandomChatEvery(2 + Random(2)); the integers (numbers) in that procedure mean that it will random chat every 2 plus a random 2 minutes. This wasn’t much on auto talking/random chatting, but there’s a better tutorial on this made by WT-Fakawi. This link (http://www.villavu.com/forum/showthread.php?t=1143?t=1310), all credits go to Fawki. Or take a look at this link (http://www.srl-forums.com/forum/Manual.php?do=AutoTalk) for a SRL manual page.
Now I will talk about: Finding and solving Random Events
This is what you guys want to know isn’t it? Well, its easy to tell you the truth. You will only need a couple of procedures for random events to be solved. First you will need a DeclarePlayers procedure.
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := 'Usernamehere';
Players[0].Pass := 'Passwordhere';
Players[0].Nick := 'Nicknamehere'; //3 - 4 letters of YOUR username, example: sern
Players[0].Active :=True;
end;
You will also need a procedure to create a bitmap of your nickname, and this is VERY VERY important, or NO talkin random event will be solved for you. The procedure is simply
NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
That will need to be in the main loop towards the beginning , it only needs to be called once per player. Say a Frog comes up now, or a Old Man, or Rick, or anyone who says your name, the procedure that is used in functions to look for your name is the NickNameBMP, that I posted above. The most popular used random finding procedure is called FindNormalRandoms. It will look for all normal randoms. Some randoms like ScapeRune, Mime, Maze, and some others can NOT be solved by the difficultness of them. So for these you will need different functions. They are called FindScapeRune, FindMime, FindMaze. There is also a function that detects whether you are dead or not, called WeAreDead. The function FindTalk finds talking randoms, and you can also use FTWait(1000 + Random(500)), which waits while finding talking randoms, although FTWait, is NOT a function. To see more functions for finding randoms or to detect anything else like finding a fight, check out this link (http://www.srl-forums.com/forum/Manual.php?do=AntiRandoms).
This will explain: Skill based randoms and how to solve them
Skill base randoms are considered ents, whirlpools, and gas (while mining). There are special functions for these. The procedure FindEnt(TreeColor: integer) is used to… find an ent. Where it says TreeColor, that’s the color of the tree, obviously. So it would look like FindEnt(21321432); //NOT an actual tree color. There’s nothing really to explain about these, but this link (http://www.srl-forums.com/forum/Manual.php?)will provide you with what procedures or funtions to use during what skill your macroing on. Look at the left for the word Skill Includes, and all skills will be listed.
Let me explain how to: Use random event solving function in a loop
Can you see how almost every random event solver is a function, that is useful in a way. If your in a loop during your script, randoms can cause you to stop what your doing. An example will be like cutting a tree, or fishing, or mining. During any of these a random event can stop your actions. In many scripts people use time marks for waiting for a rock to be mined, or cutting down a tree. This procedure will show you what I am talking about by using these functions to break out of a loop. First I will set a time mark for how long you want to cut a tree, mine, etc.. And then while your still under the time mark it will check for a ent, gas, or anything else you put in your procedure. If it finds any of these it will break out of the loop, exit or whatever you want it to do. Ill show you how it works.
MarkTime(WaitTime); //VARIABLE for that procedure
while (TimeFromMark(WaitTime) < 10000) do //WHILE the time is under your set time, in this procedure its 10 seconds, DO the following.
begin //remember why you need the begin?
If (FindEnt(TreeColor)) or (FindNormalRandoms) then break;
case Random(5) of
2: MouseBox(MSx1, MSy1, MSx2, MSy2, 3);
5: MouseBox(MIx1, MIy1, MIx2, MIy2, 3);
end;
end;
See how I used if … then break? that means if it finds the ent or the function FindNormalRandoms results true, it will break out of that loop, meaning you don’t have to wait all that extra time waiting for the TimeMark. If you don’t understand this, I can help. This is just a more sufficient way of macroing, makes for faster procedures instead of just waiting there. This can be used for every function which is boolean, not just what I used above.
I tried to make this tutorial as noob proof as possible. Please if you don’t understand anything, do NOT PM me, post here instead. And if there is anything else you will like me to explain, just tell me what it is. If you read this whole tutorial and want to see a sample script, check out the sample script I attatched, and remembers its just an example script, it doesn’t actually compile/work.