SRL Archive - Reflection Development

Hooks, hooks, hooks...


Nava2

2009-02-09 21:37:28

So, lordsaturn and I created a system to update the hooks much easier! :)

I think in the next revision, dependent on your opinions, we will be adding this feature. If added, it will be required, no choice when it comes to updating hooks, as they SVN will not be updated for each and every hook update.

It will not slow scripts, but will call for another procedure to be called at the beginning of a script.

Here is the code:
{*******************************************************************************
procedure UpdateHooks;
By: lordsaturn, Nava2 & Narcle
Description: Updates hooks using online file.
*******************************************************************************}
procedure UpdateHooks;
var
page, v: string;
Hooks: integer;
begin
Writeln('Attempting to update Hooks...');
v := GetPage('http://scardevreflection.googlecode.com/svn/trunk/RSBuild.txt');
if v = '' then
SRL_Warn('SetupReflection', 'Hooks Server down, please notify a Reflection Developer of this issue.', Warn_AllVersions)
else
if not (RSBuild = StrToInt(GetNumbers(v))) then
Page := GetPage('http://scardevreflection.googlecode.com/svn/trunk/Hooks.Scar')
else
Writeln('New Hooks are not uploaded yet - please try later...');
if Page <> '' then
begin
Hooks := RewriteFile(AppPath+'includes\SRL\SRL\reflection\Hooks.Scar', False);
WriteFileString(Hooks, Page);
Writeln('Reflection Hooks Updated! Please restart script!');
CloseFile(Hooks);
end;
TerminateScript;
end;

{*******************************************************************************
procedure SetupReflection;
By: The Reflection Development Team
Description: Sets up the reflection include for use.
*******************************************************************************}
procedure SetupReflection;
begin
// If this returns -1, then the hooks are out.
if SmartGetFieldInt(0, LoginIndex) = -1 then
UpdateHooks;
end;

If the hooks are out, the script will try to update them. The script will terminate regardless of whether new hooks are available or not. The function will return what occured! :)

Please post your opinions.

Also, check the Development SVN for new updates :)

BIG POINT: There will not be a commit for every hook update, instead, the reflection include will update automatically when there are hooks available.

mormonman

2009-02-09 21:45:24

Good idea… Hope it works like you want it to! I say this should be used if it is stable.

Nava2

2009-02-09 21:46:11

From: mormonman
Good idea… Hope it works like you want it to! I say this should be used if it is stable.


As long as FreeHostia is stable, it will be :)

Widget

2009-02-09 21:47:54

http://scarreflection.googlecode.com/svn/trunk/Hooks.Scar

Nava2

2009-02-10 00:03:09

From: Widget
http://scarreflection.googlecode.com/svn/trunk/Hooks.Scar


Why post this?

Boreas

2009-02-10 00:35:11

Page := GetPage('http://nava2.freehostia.com/Reflection/Dev/CurrentHooks.txt');


Prolly for that.

Nava2

2009-02-10 00:36:16

From: Boreas
Prolly for that.


Thats the point, to eliminate the need for a new revision for every hook update. Also removes the need for people to manually update the SVN.

Narcle

2009-02-10 00:42:12

We'll place a RSBuild File in the Dev as well as updated hooks - best solution imo and we can have the regular download those from Dev.

Also we should do a 2 week test or at least until hooks update w/ testing before going to main SVN.

Nava2

2009-02-10 00:44:09

From: Narcle
We'll place a RSBuild File in the Dev as well as updated hooks - best solution imo and we can have the regular download those from Dev.

Also we should do a 2 week test or at least until hooks update w/ testing before going to main SVN.


Hence why I'm announcing it here ;)

Narcle

2009-02-10 00:47:48

Edit2: Uploaded new system to Dev SVN. Test it by changing your RSBuild number in Hooks.scar. (and not running smart)

Have Method put in a RSBuild.txt file with JUST the rsbuild number. We'll use that for quick download check.

Updated again this is in the Dev trunk now. This will even work if you place it regular reflection SVN right now.
Edit: Updated
{*******************************************************************************
procedure UpdateHooks;
By: lordsaturn, Nava2 & Narcle
Description: Updates hooks using online file.
*******************************************************************************}
procedure UpdateHooks;
var
page, v: string;
Hooks: integer;
begin
Writeln('Attempting to update Hooks...');
v := GetPage('http://scardevreflection.googlecode.com/svn/trunk/RSBuild.txt');
if v = '' then
SRL_Warn('SetupReflection', 'Hooks Server down, please notify a Reflection Developer of this issue.', Warn_AllVersions)
else
if not (RSBuild = StrToInt(GetNumbers(v))) then
Page := GetPage('http://scardevreflection.googlecode.com/svn/trunk/Hooks.Scar')
else
Writeln('New Hooks are not uploaded yet - please try later...');
if Page <> '' then
begin
Hooks := RewriteFile(AppPath+'includes\SRL\SRL\reflection\Hooks.Scar', False);
WriteFileString(Hooks, Page);
Writeln('Reflection Hooks Updated! Please restart script!');
CloseFile(Hooks);
end;
TerminateScript;
end;

{*******************************************************************************
procedure SetupReflection;
By: The Reflection Development Team
Description: Sets up the reflection include for use.
*******************************************************************************}
procedure SetupReflection;
begin
// If this returns -1, then the hooks are out.
if SmartGetFieldInt(0, LoginIndex) = -1 then
UpdateHooks;
end;

BazzBarrett

2009-02-16 17:49:43

yup sounds like a good idear to me im voting yes and keep up the good work :)

dark bl00d23

2009-02-17 11:43:13

Nice job :)