Recent

Author Topic: Need C&C on my new console  (Read 9547 times)

captian jaster

  • Guest
Need C&C on my new console
« on: February 23, 2010, 09:25:48 pm »
Code: [Select]
BEGIN
  TextBackground(LightGreen);
  ClrScr;
  writeln('Please wait...');
  Delay(1000);
  RootDir := Fsearch('C:\Xhydriks\Console\', GetEnv(''));
  if RootDir = '' then
  begin
    writeln('An installation is required!');
    writeln('Would you like to install?');
    writeln('Type "install" and press Enter if so');
    writeln('Type in "Close" and press enter to close');
    readln(Command);
    if Command = 'Close' then Halt;
    if Command = 'Install' then
    begin//INSTALLER
      writeln('Now Installing...');
      writeln('Building directorys...');
      CreateDir('C:\Xhydriks\');
      writeln('C:\Xhydriks\');
      Delay(1000);
      CreateDir('C:\Xhydriks\Console\');
      writeln('C:\Xhydriks\Console\');
      Delay(1000);
      CreateDir('C:\Xhydriks\Docs\');
      writeln('C:\Xhydriks\Docs\');
      Delay(1000);
      writeln('Writing files...');
      assignfile(file1, 'C:\Xhydriks\Console\records.dat');
      writeln('C:\Xhydriks\Console\records.dat');
      Delay(1000);
      rewrite(file1);
      writeln(file1,'User input history:');
      closefile(file1);
      writeln('Installation complete!');
      writeln('Close the program and restart it to use the console!');
      Readln;
    end;
  end;
END;
If you have an idea for a code i should add please tell me so.

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Need C&C on my new console
« Reply #1 on: February 23, 2010, 11:27:50 pm »
What's C&C?  (other than Command & Conquer  ::) )
At least i can't tell from code what you are asking of us, and also, why manually making installer take longer with delays puzzles me.

captian jaster

  • Guest
Re: Need C&C on my new console
« Reply #2 on: February 24, 2010, 01:40:08 am »
C&C stands for comments and criticism.
I remember putting the delays there cuz it just looked smoother.
I wann know what you think i should add to improve it
Feature wise,Graphic wise,Code wise

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Need C&C on my new console
« Reply #3 on: February 24, 2010, 03:15:09 am »
I would change the first question in installer to
"Would you like to continue install? [Y/N]"

Code: [Select]
if UpperCase(Command) <> 'Y' then Halt
else begin
  // Install
This would require user to type 'Y' or 'y' to continue and answering anything else would close it.

Another feature could be starting the program after install, i got the idea that it was what user was trying to do. Also you are missing error handling. What if directory can't be written to?
« Last Edit: February 24, 2010, 03:17:47 am by User137 »

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1927
Re: Need C&C on my new console
« Reply #4 on: February 24, 2010, 10:18:37 am »
Why is this interactive at all?
I can choose "Install" or "Close" nothing more, no Paths to enter nothing.
If I call this programm, it could just do it, no?

Imo there is no need for colors and stuff for such an installer.

If you want to do it like this, you should probably lowercase the input.
More so if you write "Type "install" and press Enter if .." and then check for "Install" with a big letter.

Generally I'd use parameters with GetOpts

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: Need C&C on my new console
« Reply #5 on: February 24, 2010, 12:53:32 pm »
Quote
writeln('Close the program and restart it to use the console!');

So your program "console" is both the installer for itself as well as the actual program (that does what? ATM when RootDir exists (RootDir is not '') the program does nothing at all.)?
More common practice (in Win/DOS) would be to call the installer "install.exe" or "setup.exe" and make the actual working pogram (xhydraks?) a separate executable.

B.t.w. we gave you plenty C&C in the previous topics on the same program. (Some of us practically rewrote the program for you.)
No need to open yet another thread.

Bart

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Need C&C on my new console
« Reply #6 on: February 25, 2010, 02:16:01 pm »
I agree with Bart. Create a different program/script for installation. Note that you can call the installer from the console itself (i.e. TProcess ;)).

BTW, most Linux distributions uses package files (i.e. rpm, deb, pkg, ... ) but some uses executables as in Windows.
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

captian jaster

  • Guest
Re: Need C&C on my new console
« Reply #7 on: February 25, 2010, 04:33:42 pm »
But how would i make the installer?
i know what you mean but idk how i would put the programs exe in the installer.

davesimplewear

  • Sr. Member
  • ****
  • Posts: 319
    • Davids Freeware
Re: Need C&C on my new console
« Reply #8 on: February 25, 2010, 11:05:06 pm »
create a procedure to run from the installer eg:
Code: [Select]
var
aProcess:Tprocess;
begin
  AProcess := TProcess.Create(nil);
  AProcess.CommandLine := ' "program name with .exe for windows" ';
  AProcess.Options := AProcess.Options + [poWaitOnExit];
  AProcess.Execute;
  AProcess.Free;
end;
All things considered insanity seems the best option

Ñuño_Martínez

  • Hero Member
  • *****
  • Posts: 1186
    • Burdjia
Re: Need C&C on my new console
« Reply #9 on: February 26, 2010, 09:45:22 am »
But how would i make the installer?
i know what you mean but idk how i would put the programs exe in the installer.
You can use Inno Setup on Windows, on Linux create an installation package (actually a tar file containing files and installation scripts with fancy names: deb, rpm, ...) or just pack the sources in a tar file with instructions. AFAIK MacOS X uses installation packages too.
« Last Edit: February 26, 2010, 09:47:11 am by Ñuño_Martínez »
Are you interested in game programming? Join the Pascal Game Development community!
Also visit the Game Development Portal

 

TinyPortal © 2005-2018