Jump to content
shadowrecon

{$IFNDEF} Questions about use

Recommended Posts

So im trying to add a function to my script when it starts if smart isnt enabled and it is defined, it will writeln a statement until smart is enabled.

so far what im doing is not working. Heres what i have

 

   {$IFNDEF SMART}
while Not(SmartEnabled) do
begin
Writeln('Please Enable Smart...');
Wait(1000);
end;
cleardebug;
{$ENDIF}[/Code]

Edited by shadowrecon
Link to comment
Share on other sites

program New;

{$DEFINE RS2}
{$DEFINE OSI_Color_Anti_Randoms}
//{$DEFINE SMART}                   // Comment out to disable SMART

{$I OSI\OSI.scar}

procedure ScriptTerminate;
begin
 FreeOSI;
end;

begin
 SetUpOSI;
 {$IFNDEF SMART}
   WriteLn('Smart disabled');
 {$ENDIF}
end.

 

what im trying to do is delay the script until smart has been 'enabled' i can use this which waits until smart is enabled

   while Not(SmartEnabled) do
   begin
     Writeln('Please Enable Smart...');
     Wait(1000);
   end;
 cleardebug;

 

but i dont want it to check if smart is enabled if smart is not defined, make since?

Link to comment
Share on other sites

what im trying to do is delay the script until smart has been 'enabled' i can use this which waits until smart is enabled

   while Not(SmartEnabled) do
   begin
     Writeln('Please Enable Smart...');
     Wait(1000);
   end;
 cleardebug;

 

but i dont want it to check if smart is enabled if smart is not defined, make since?

 

What you are trying to do is not possible, at least not with practically with OSI. In order to use SMART at all using OSI's implantation you must define it which overrides all mouse/color routines.

 

If you really wanted to you could not define SMART, still use OSI.. make all of your own custom functions that are found in smart.scar that use a boolean to use the smart function or revert to the normal one.

 

Seems like a lot of work to do something that is pretty pointless.

 

You definitely wouldn't be able to change that during runtime unless you had like a shortkey or readln etc.

Link to comment
Share on other sites

What you are trying to do is not possible, at least not with practically with OSI. In order to use SMART at all using OSI's implantation you must define it which overrides all mouse/color routines.

 

If you really wanted to you could not define SMART, still use OSI.. make all of your own custom functions that are found in smart.scar that use a boolean to use the smart function or revert to the normal one.

 

Seems like a lot of work to do something that is pretty pointless.

 

You definitely wouldn't be able to change that during runtime unless you had like a shortkey or readln etc.

i think the point is being missed here, im trying to write a statement that says if Smart.scar is defined then check to see if it is "enabled" before continuing.

 

right now im using the SmartEnabled function that returns a Boolean, true if it is enabled or false if it is not enabled. i would like to only call the SmartEnabled function if smart is defined. other wise if the user is using something else other than smart it will not call it.

Link to comment
Share on other sites

Hmm, {$IFNDEF ...} is a compiler directive, it's handled before the script is compiled, If you use {$IFNDEF SMART} ... {$ENDIF} and SMART is defined with the $DEFINE directive, then all of the code in the $IFNDEF clause is removed from the script before it's even compiled. If SMART isn't defined, your code will throw a compiler error, because SmartEnabled will not exist in the script.

Link to comment
Share on other sites

Hmm, {$IFNDEF ...} is a compiler directive, it's handled before the script is compiled, If you use {$IFNDEF SMART} ... {$ENDIF} and SMART is defined with the $DEFINE directive, then all of the code in the $IFNDEF clause is removed from the script before it's even compiled. If SMART isn't defined, your code will throw a compiler error, because SmartEnabled will not exist in the script.

yeah, ive never really messed with them a whole lot, i knew they were used by the compiler, i just thought it the {if de..} was true then it would add the code to the script where if it was not defined then it wouldnt add anything and just skip that section.

Link to comment
Share on other sites

im using the SmartEnabled function that returns a Boolean, true if it is enabled or false if it is not enabled.
Everybody seems to have missed this bit, which was the entire point of the original post.

 

Your {$IFNDEF} should be {$IFDEF}. Your loop should work as written.

 

Whether the function is working as it is documented is another matter (WaitFuncEx was broken for the longest time). I would try writing a script that does nothing except writeln the status of SmartEnabled, run the script with smart enabled, run the script with smart disabled, and see what the result is.

Edited by Bixby Sayz
Link to comment
Share on other sites

Ah shit? I thought you meant SMART itself being enabled or disabled. Not like the Clicking disable thing (like disable debug) yea this is probably easy give me a min

yeah, figured thats what you were getting at, lol.

 

i just hate starting a script and it loging out because i didnt enable smart.. lol

 

---------- Post added at 01:05 AM ---------- Previous post was at 01:04 AM ----------

 

Everybody seems to have missed this bit, which was the entire point of the original post.

 

Your {$IFNDEF} should be {$IFDEF}. Your loop should work as written.

 

Whether the function is working as it is documented is another matter (WaitFuncEx was broken for the longest time). I would try writing a script that does nothing except writeln the status of SmartEnabled, run the script with smart enabled, run the script with smart disabled, and see what the result is.

 

it works if its not in the {IfDef..} brackets but i think you solved my problem =)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...