Tootoot222
2009-01-12 15:00:16
SRL should be made debug-able by using compiler directives.
(compiler directives are those that are like {$DEFINE DebugThisMethod}, {$IFDEF DebugThisMethod}, {$ENDIF}, etc)
when a new SRL method is made, all the coder will have to do is (instead of commenting out the debug, as is so often done), add the compiler directives around the debug code (and as a standard, for debugging an entire method a directive name should be "Debug" followed directly by the full name of the method, I.E. "DebugFindSymbol"); I.E.:
If the coder would like to have multiple sections that are debug-able, you can do something like:
Now, if the user only wants to debug half the procedure, all they have to do is call {$DEFINE DebugThisIsATestProcedurePart1}, and you don't get the debug from the other half
Now, for use in SRL, you would have to make an area for setting up the directives, this doesn't need to be done inside a procedure:
and the user must define the CD on their own:
Now, ofcource, you probably don't want to debug ALL of SRL, so why not just debug that you think is broken? (I.E. when RS updates and you can't figure out why the mouse if hovering over the "Log in" button…
These things would mostly be used for the advanced users to see what goes on with when they call a procedure (without trying to decypher the coding style of other scripters), and the devs that want to see why some procedures aren't working properly.
The major benifeit of having this is that when using compiler directives, you don't have to have them defined beforehand, like booleans
Well, rate/hate plox :)
(compiler directives are those that are like {$DEFINE DebugThisMethod}, {$IFDEF DebugThisMethod}, {$ENDIF}, etc)
when a new SRL method is made, all the coder will have to do is (instead of commenting out the debug, as is so often done), add the compiler directives around the debug code (and as a standard, for debugging an entire method a directive name should be "Debug" followed directly by the full name of the method, I.E. "DebugFindSymbol"); I.E.:
procedure ThisIsATestProcedure(var X, Y: Integer);
begin
{$IFDEF DebugThisIsATestProcedure}
Writeln('X is ' + IntToStr(X) + ', and Y is ' + IntToStr(Y));
{$ENDIF}
end;If the coder would like to have multiple sections that are debug-able, you can do something like:
procedure ThisIsATestProcedure(var X, Y: Integer);
begin
{$IFDEF DebugThisIsATestProcedure}
{$DEFINE DebugThisIsATestProcedurePart1}
{$DEFINE DebugThisIsATestProcedurePart2}
{$ENDIF}
{$IFDEF DebugThisIsATestProcedurePart1}
Writeln('X is ' + IntToStr(X));
{$ENDIF}
{$IFDEF DebugThisIsATestProcedurePart2}
Writeln('Y is ' + IntToStr(Y));
{$ENDIF}
end;Now, if the user only wants to debug half the procedure, all they have to do is call {$DEFINE DebugThisIsATestProcedurePart1}, and you don't get the debug from the other half
Now, for use in SRL, you would have to make an area for setting up the directives, this doesn't need to be done inside a procedure:
{$IFDEF DebugSRL}
{$DEFINE DebugRadialWalk}
{$DEFINE DebugRadialWalkEx}
{$DEFINE DebugWhateverOtherProcedure}
//etc...
{$ENDIF}and the user must define the CD on their own:
program CDTest;
{$DEFINE DebugSRL}
{.include SRL\SRL.scar}
begin
SetupSRL;
end.Now, ofcource, you probably don't want to debug ALL of SRL, so why not just debug that you think is broken? (I.E. when RS updates and you can't figure out why the mouse if hovering over the "Log in" button…
program CDTest;
{$DEFINE DebugLoginPlayer}
{.include SRL\SRL.scar}
begin
SetupSRL;
DeclarePlayers;
LoginPlayer;
end.These things would mostly be used for the advanced users to see what goes on with when they call a procedure (without trying to decypher the coding style of other scripters), and the devs that want to see why some procedures aren't working properly.
The major benifeit of having this is that when using compiler directives, you don't have to have them defined beforehand, like booleans
Well, rate/hate plox :)