Naum
10-20-2008, 07:23 PM
How To Make a Version Checker
Table of Contents
0 - Intoduction
I - What is a version checker?
II - Ways of Making the script check.
III - Making your Website
IV - Implement your version Checker in Scripts!
V - End Notes/Credits.
0 - Intoduction
Hello guys/gals, this tutorial will be teaching you how to make a version checker which looks really 1337 and is very handy in complex scripts. So what is a Version Checker, is it one of those biscuits you can give to your dog?.. well alas, no.
I - What is a version checker?
A version checker is used in programs to check if you have the latest version of that program. Since this is a SCAR Scripting forum I will be talking about scripts. Version Checker are basically implemented in scripts and called before an event to check if that person has the latest offering of your script. If not you can make it stop the script or even make the script download it - else you can let it continue.
II - Ways of Making the script check
There are two main ways of making the script check for updates - One way is to use INI Files (http://www.villavu.com/forum/showthread.php?t=27994?t=30489&highlight=files). The other is much more easier/harder this involves making the script cross referance with a website. The latter is the one I will focus on.
WARNING - If you bore easily go play runescape. Legit!
III - Making your website
This I will be doing in steps to make it n00b pr00f!
Step:
1 : Go To www.freehostia.com/signup.html
2 : Make an account, make your website name like your script name e.g Guild X Min0r! ->
guildxminer.freehostia.com!
3. Login with your credentials (user + pass)
4. Once your logged in go to File Manager
http://i33.tinypic.com/309nedz.jpg
5. Now Go to your desktop and make a text file named 'version'
http://i36.tinypic.com/11t63b9.jpg
6. It should contain your starting version number e.g '0.1'
http://i38.tinypic.com/8y5191.jpg
7. Save it and go Back to file manager.
8. Click on 'browse' in the upload section of the page
http://i34.tinypic.com/jgqza0.jpg
9. Then Click On Upload File[s]. Note it would take some time to complete
http://i37.tinypic.com/2it67sw.jpg
10. Done!
IV - Impliment your Version checker in Scripts
Okay you've done the juicy part Now take a look at this code.
Const Ver = '0.1';
Procedure CheckVer;
Var Version : String
Begin
Version := GetPage('www.guildminer.freehostia.com\version.txt ');
If Version <> Ver Then
WriteLn('get a new version!')
else
WriteLn('good up to date!');
end;
Begin //main loop
CheckVer;
end.
So we have this to begin with:
program new;
begin
end.
Space out the lines and make a const called 'Ver', this constant must be a string
e.g Const Ver = '0.1';
Now create a new procedure called CheckVer. You should have something like this:
program new;
Const Ver = '0.1';
Procedure CheckVer;
Begin
end;
begin
end.
Now we need to use a Function called GetPage.
Info on this:
function GetPage(URL: string): string;
Return HTTP webpage contents as string.
Example:
s:= GetPage('http://kaitnieks.com');
if(s = '')then
begin
Writeln('Some kind of connection error');
end else
begin
..
end;
We need to make a variable called Version this is basically what your GetPage(''); is stored in, so this needs to be a string. Also we need to compare it to see if it is equal to the const 'Ver'.
So we should have something like this:
program new;
Const Ver = '0.1';
Procedure CheckVer;
Var Version : String;
Begin
Version := GetPage('www.{your site name here}.freehostia.com\version.txt');
If Version = Ver Then
end;
begin
end.
So now you need to make it take a specified action so you can say if its outdated or not:
Then you need to call it in your mainloop before everything else
program new;
Const Ver = '0.1';
Procedure CheckVer;
Var Version : String;
Begin
Version := GetPage('www.{your site name here}.freehostia.com\version.txt');
If Version = Ver Then
Begin
WriteLn('continue')
End Else
TerminateScript;
end;
begin
CheckVer;
SetupSRL;
end.
There you go easy. Done and dusted!
V - End Note/Credits
Now you realise that making this stuff isn't that hard. Just for clarification if you want to update the version number then instead of uploading a new file you can edit it by clicking on this:
http://i35.tinypic.com/mtq8p0.jpg
Easy no?
Credits :
Yakman - From the days when I was noob
TSN
P1nky
EvilChicken
Nielsie95
Sumilion
MastaRaymond
Munk
Santy
thechineseman
Loads of other people!
Edit : I'll move this to jr members once you give your opinions and once freehostia are open for registrations.
Table of Contents
0 - Intoduction
I - What is a version checker?
II - Ways of Making the script check.
III - Making your Website
IV - Implement your version Checker in Scripts!
V - End Notes/Credits.
0 - Intoduction
Hello guys/gals, this tutorial will be teaching you how to make a version checker which looks really 1337 and is very handy in complex scripts. So what is a Version Checker, is it one of those biscuits you can give to your dog?.. well alas, no.
I - What is a version checker?
A version checker is used in programs to check if you have the latest version of that program. Since this is a SCAR Scripting forum I will be talking about scripts. Version Checker are basically implemented in scripts and called before an event to check if that person has the latest offering of your script. If not you can make it stop the script or even make the script download it - else you can let it continue.
II - Ways of Making the script check
There are two main ways of making the script check for updates - One way is to use INI Files (http://www.villavu.com/forum/showthread.php?t=27994?t=30489&highlight=files). The other is much more easier/harder this involves making the script cross referance with a website. The latter is the one I will focus on.
WARNING - If you bore easily go play runescape. Legit!
III - Making your website
This I will be doing in steps to make it n00b pr00f!
Step:
1 : Go To www.freehostia.com/signup.html
2 : Make an account, make your website name like your script name e.g Guild X Min0r! ->
guildxminer.freehostia.com!
3. Login with your credentials (user + pass)
4. Once your logged in go to File Manager
http://i33.tinypic.com/309nedz.jpg
5. Now Go to your desktop and make a text file named 'version'
http://i36.tinypic.com/11t63b9.jpg
6. It should contain your starting version number e.g '0.1'
http://i38.tinypic.com/8y5191.jpg
7. Save it and go Back to file manager.
8. Click on 'browse' in the upload section of the page
http://i34.tinypic.com/jgqza0.jpg
9. Then Click On Upload File[s]. Note it would take some time to complete
http://i37.tinypic.com/2it67sw.jpg
10. Done!
IV - Impliment your Version checker in Scripts
Okay you've done the juicy part Now take a look at this code.
Const Ver = '0.1';
Procedure CheckVer;
Var Version : String
Begin
Version := GetPage('www.guildminer.freehostia.com\version.txt ');
If Version <> Ver Then
WriteLn('get a new version!')
else
WriteLn('good up to date!');
end;
Begin //main loop
CheckVer;
end.
So we have this to begin with:
program new;
begin
end.
Space out the lines and make a const called 'Ver', this constant must be a string
e.g Const Ver = '0.1';
Now create a new procedure called CheckVer. You should have something like this:
program new;
Const Ver = '0.1';
Procedure CheckVer;
Begin
end;
begin
end.
Now we need to use a Function called GetPage.
Info on this:
function GetPage(URL: string): string;
Return HTTP webpage contents as string.
Example:
s:= GetPage('http://kaitnieks.com');
if(s = '')then
begin
Writeln('Some kind of connection error');
end else
begin
..
end;
We need to make a variable called Version this is basically what your GetPage(''); is stored in, so this needs to be a string. Also we need to compare it to see if it is equal to the const 'Ver'.
So we should have something like this:
program new;
Const Ver = '0.1';
Procedure CheckVer;
Var Version : String;
Begin
Version := GetPage('www.{your site name here}.freehostia.com\version.txt');
If Version = Ver Then
end;
begin
end.
So now you need to make it take a specified action so you can say if its outdated or not:
Then you need to call it in your mainloop before everything else
program new;
Const Ver = '0.1';
Procedure CheckVer;
Var Version : String;
Begin
Version := GetPage('www.{your site name here}.freehostia.com\version.txt');
If Version = Ver Then
Begin
WriteLn('continue')
End Else
TerminateScript;
end;
begin
CheckVer;
SetupSRL;
end.
There you go easy. Done and dusted!
V - End Note/Credits
Now you realise that making this stuff isn't that hard. Just for clarification if you want to update the version number then instead of uploading a new file you can edit it by clicking on this:
http://i35.tinypic.com/mtq8p0.jpg
Easy no?
Credits :
Yakman - From the days when I was noob
TSN
P1nky
EvilChicken
Nielsie95
Sumilion
MastaRaymond
Munk
Santy
thechineseman
Loads of other people!
Edit : I'll move this to jr members once you give your opinions and once freehostia are open for registrations.