Author Topic: procedure Shutdown  (Read 1391 times)

0 Members and 1 Guest are viewing this topic.

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
procedure Shutdown
« on: September 16, 2010, 09:34:14 am »
 
Code: [Select]
if (Shutdown) and (Timer > 0) then
     WriteConsole(0,'Scheduled server-restart in ' + IntToStr(Timer),$FF0000);
         if Timer = 0 then begin
           WriteConsole(0,'Bye.',$FF0000);
             Shutdown;
         end;

Outputs me a "Assignment expected" error for the line where Shutdown; is in.
Without the Shutdown everything works fine. Whats the problem in there?
The truth is out there? Does anyone know the URL?
The URL is here

DarkCrusade

  • Guest
Re: procedure Shutdown
« Reply #1 on: September 16, 2010, 10:01:30 am »
Code: (pascal) [Select]

if ((Shutdown) and (Timer > 0)) then begin
  WriteConsole(0,'Scheduled server-restart in ' + IntToStr(Timer),$FF0000);
  if Timer = 0 then begin
    WriteConsole(0,'Bye.',$FF0000);
    Shutdown;
  end;
end;

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: procedure Shutdown
« Reply #2 on: September 16, 2010, 10:42:53 am »
what? Timer and Shutdown are different types, why should I put them into another bracket? Thats useless.
The truth is out there? Does anyone know the URL?
The URL is here

Offline tk

  • Soldier
  • **
  • Posts: 235
Re: procedure Shutdown
« Reply #3 on: September 16, 2010, 11:13:32 am »
You declared 'shutdown' as a variable before...

DarkCrusade

  • Guest
Re: procedure Shutdown
« Reply #4 on: September 16, 2010, 11:52:58 am »
Each bracket is one condition. Not putting these conditions in one big one makes scripts crash (at least in Java, didn't test that script yet). And it's nothing wrong with doing it like that. As long as you don't use something like "if 5 = true" it's okay. Again: each bracket counts as a boolean. That's why you can use the logical and you fool :P

Offline Stuffy

  • Soldier
  • **
  • Posts: 182
  • Very stuffy.
    • Climb-Zone Forum
Re: procedure Shutdown
« Reply #5 on: September 16, 2010, 11:59:12 am »
Well, I've nerver used it in my script, and they works without any problems, and those bracket fix nothing.
In some programming languages you have to put brackets around the if-conditions, but not in delphi as far is I know.

And tk was right. Now it works.
The truth is out there? Does anyone know the URL?
The URL is here