A G E N T
06-07-2007, 08:15 PM
Hi, I was kind of bored today and thought I'd make this tutorial. Hopefully someone will enjoy it somewhat and make it not completely useless.
So in case you did not know, 'auths' or 'authorizing' is a way of making sure that only people who the maker of the script wants to use said script may use it. For example I want Bob to be able to use it because he paid me for it but not Jim because he is a big bully or something. Anyway, this is not the place to get into auths too much.
The (very noob-like) technique of authorizing I am going to show you today makes use of the following three things:
The ReadLN function. (See http://www.villavu.com/forum/showthread.php?t=8544 if you are not familiar.
The fact that SCAR does not set any margin limits.
The fact that making a new line for each statement is NOT necessary.
So, let's get started. Here is what SCAR looks like when you first open it:
program New;
begin
end.
Often times, the space between program New; and begin is used to put in notes (green text) in // or {} format. For our purposes, we have to use {} format so that the whole line is not noted. So we put this:
program New;
{Your notes here, possibly your name.}
{Maybe some more notes. Feel free to continue notes down.}
begin
end.
Next, you need the actual authorization code. Here is an example of what to use:function GetNames:boolean;
var Name,Pass:string;
begin
Name:=Readln('Username?');
Pass:=Readln('Pass?');
if((Name='A83')and(Pass='A84'))then
Result:=True;
end;
This will put up a prompt box then check to see if what the user inputted matches with what you have set as "correct" (In my case, Username A83, password A84.). However, in order to hide this line so that sneaky people can't change it around. So we condense it all into one line, separating lines and statements with semicolons.function GetNames:boolean;var Name,Pass:string;begin Name:=Readln('Username?');Pass:=Readln('Pass?');if ((Name='A83')and(Pass='A84'))then Result:=True;end; You then paste this on the same line as your notes, but really far into the margin (i.e starting at column 870). This is what our script looks like now.
program New;
{Here are some notes.} function GetNames:boolean;var Name,Pass:string;begin Name:=Readln('Username?');Pass:=Readln('Pass?');if ((Name='A83')and(Pass='A84'))then Result:=True;end ;
begin
end. If you scroll way over, you can see the GetNames. After the notes, you are free to put in your script. I will put in a useless one for our example, then include it in the main line.
program New;
{By: Agent 83} function GetNames:boolean;var Name,Pass:string;begin Name:=Readln('Username?');Pass:=Readln('Pass?');if ((Name='A83')and(Pass='A84'))then Result:=True;end;
procedure ScriptIt;
begin
//Do stuff here...
end;
begin
ScriptIt;
end;
Now to make the GetNames function work, we simply have to put a few statements far into the margins of the same line as ScriptIt, in the main loop.
The code is as follows, condensed, again, into one line:
if not(GetNames)then Writeln('Your cheeky message telling them they are unauthorized goes here.');TerminateScript;
So we paste that into the margins, and the finished product looks like this:
program New;
{By: Agent 83} function GetNames:boolean;var Name,Pass:string;begin Name:=Readln('Username?');Pass:=Readln('Pass?');if ((Name='A83')and(Pass='A84'))then Result:=True;end;
procedure ScriptIt;
begin
//Do stuff here...
end;
begin
ScriptIt; if not(GetNames)then Writeln('Your cheeky message telling them they are unauthorized.');TerminateScript;
end.
I hope this tutorial wasn't too wordy, but I wanted to be clear...I have attached a working example, enjoy! :)
So in case you did not know, 'auths' or 'authorizing' is a way of making sure that only people who the maker of the script wants to use said script may use it. For example I want Bob to be able to use it because he paid me for it but not Jim because he is a big bully or something. Anyway, this is not the place to get into auths too much.
The (very noob-like) technique of authorizing I am going to show you today makes use of the following three things:
The ReadLN function. (See http://www.villavu.com/forum/showthread.php?t=8544 if you are not familiar.
The fact that SCAR does not set any margin limits.
The fact that making a new line for each statement is NOT necessary.
So, let's get started. Here is what SCAR looks like when you first open it:
program New;
begin
end.
Often times, the space between program New; and begin is used to put in notes (green text) in // or {} format. For our purposes, we have to use {} format so that the whole line is not noted. So we put this:
program New;
{Your notes here, possibly your name.}
{Maybe some more notes. Feel free to continue notes down.}
begin
end.
Next, you need the actual authorization code. Here is an example of what to use:function GetNames:boolean;
var Name,Pass:string;
begin
Name:=Readln('Username?');
Pass:=Readln('Pass?');
if((Name='A83')and(Pass='A84'))then
Result:=True;
end;
This will put up a prompt box then check to see if what the user inputted matches with what you have set as "correct" (In my case, Username A83, password A84.). However, in order to hide this line so that sneaky people can't change it around. So we condense it all into one line, separating lines and statements with semicolons.function GetNames:boolean;var Name,Pass:string;begin Name:=Readln('Username?');Pass:=Readln('Pass?');if ((Name='A83')and(Pass='A84'))then Result:=True;end; You then paste this on the same line as your notes, but really far into the margin (i.e starting at column 870). This is what our script looks like now.
program New;
{Here are some notes.} function GetNames:boolean;var Name,Pass:string;begin Name:=Readln('Username?');Pass:=Readln('Pass?');if ((Name='A83')and(Pass='A84'))then Result:=True;end ;
begin
end. If you scroll way over, you can see the GetNames. After the notes, you are free to put in your script. I will put in a useless one for our example, then include it in the main line.
program New;
{By: Agent 83} function GetNames:boolean;var Name,Pass:string;begin Name:=Readln('Username?');Pass:=Readln('Pass?');if ((Name='A83')and(Pass='A84'))then Result:=True;end;
procedure ScriptIt;
begin
//Do stuff here...
end;
begin
ScriptIt;
end;
Now to make the GetNames function work, we simply have to put a few statements far into the margins of the same line as ScriptIt, in the main loop.
The code is as follows, condensed, again, into one line:
if not(GetNames)then Writeln('Your cheeky message telling them they are unauthorized goes here.');TerminateScript;
So we paste that into the margins, and the finished product looks like this:
program New;
{By: Agent 83} function GetNames:boolean;var Name,Pass:string;begin Name:=Readln('Username?');Pass:=Readln('Pass?');if ((Name='A83')and(Pass='A84'))then Result:=True;end;
procedure ScriptIt;
begin
//Do stuff here...
end;
begin
ScriptIt; if not(GetNames)then Writeln('Your cheeky message telling them they are unauthorized.');TerminateScript;
end.
I hope this tutorial wasn't too wordy, but I wanted to be clear...I have attached a working example, enjoy! :)