Author Topic: Project looking for Programmer (I can't do it myself)  (Read 44185 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #30 on: October 06, 2021, 01:33:35 pm »
Yeah, except User Interface is probably much easier with QB64, specially if at some point we want to select items from an array.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #31 on: October 06, 2021, 01:42:00 pm »
Is it as simple as this...

DEMO. I would recommend this.

1) DON'T use run, instead choose to make this exe by clicking RUN in the IDE and in the menu that opens, click "Make exe only."

2) Now make a folder called "myQB64installdemo" and cut and use Windows Explorer to move the qb64 exe file just made into that new folder.

3) Run the exe.

This is just for piece of mind, so any modifications will not mess with stuff in your QB64 folder.

The program will make a new sub-directory, called: mock-directory-to-demo-installer

Now I made it a sub-directory for demo purposes, only. If this is what the OP is looking for, obviously that part of the installer would need to be worked on so the user could install to the C drive, D drive, etc.

The code also makes a phony Hello World text file in the folder the exe is in. It then copies that file to the new install folder. The demo technique could be used to copy (install) any file. Of course this simple type of install process does not affect the Windows Registry. Anyway, here's my demo...

Code: QB64: [Select]
  1. OPEN "Hello-World.txt" FOR OUTPUT AS #1: PRINT #1, "Hello World!": CLOSE #1
  2.  
  3. SourceFile$ = "Hello-World.txt"
  4. TargetDir$ = "mock-directory-to-demo-installer"
  5. IF _FILEEXISTS(SourceFile$) THEN ELSE PRINT "Source file: "; SourceFile$; " not found. Ending...": _DELAY 5: END
  6. ' Source file exists, ask user to install.
  7. PRINT "Would you like to install " + SourceFile$ + "? Y/N: ";: LINE INPUT ans$: PRINT
  8. IF ans$ = "" OR UCASE$(ans$) = "N" THEN END
  9. ' User wants to install. Ask if target directory is okay for install.
  10. IF _DIREXISTS(TargetDir$) THEN
  11.     ' Prompt for overwrite.
  12.     IF _FILEEXISTS(TargetDir$ + "\" + SourceFile$) THEN
  13.         PRINT SourceFile$ + " already exists on this device. Overwrite? Y/N: ";: LINE INPUT ans$: PRINT
  14.         IF ans$ = "" OR UCASE$(ans$) = "N" THEN END
  15.         PRINT "Overwrite in progress...": PRINT
  16.         KILL TargetDir$ + "\" + SourceFile$ ' Removes previous install.
  17.     END IF
  18.     PRINT "Setup will create directory " + TargetDir$
  19.     PRINT "to install " + SourceFile$ + ". Press Enter to begin or Esc to abort.": PRINT
  20.     DO
  21.         _LIMIT 30
  22.         b$ = INKEY$
  23.         IF LEN(b$) THEN
  24.             SELECT CASE b$
  25.                 CASE CHR$(23): SYSTEM ' Ends routine and closes install window.
  26.                 CASE CHR$(13): EXIT DO ' Okay to install.
  27.                 CASE ELSE: BEEP ' Wrong entry signal.
  28.             END SELECT
  29.         END IF
  30.     LOOP
  31.     ' Create directory.
  32.     MKDIR TargetDir$
  33. ' Install.
  34. IF _DIREXISTS(TargetDir$) THEN
  35.     PRINT "Directory path: "; TargetDir$
  36.     PRINT "not found. Cannot install. Ending...": _DELAY 5: END ' Fail safe.
  37. PRINT "Installing app...": PRINT
  38. OPEN SourceFile$ FOR BINARY AS #1
  39. a$ = SPACE$(LOF(1))
  40. GET #1, , a$
  41. OPEN TargetDir$ + "\" + SourceFile$ FOR BINARY AS #1
  42. PUT #1, , a$
  43. ' Verify install.
  44. IF _FILEEXISTS(TargetDir$ + "\" + SourceFile$) THEN
  45.     PRINT "Installation successful.": PRINT
  46.     PRINT "Installation failed.": PRINT

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Project looking for Programmer (I can't do it myself)
« Reply #32 on: October 06, 2021, 02:03:51 pm »
If these are for windows only, couldn't you just make the whole thing a self-extracting EXE?

https://www.winosbite.com/iexpress-exe/

iexpress comes with windows in the C:\Windows\System32\ and can create self-extracting archives, and sounds like it'd be the best tool for the job to me.  Compress and make the EXE.  Distribute it.  User clicks the EXE and windows handles the rest of the install process.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #33 on: October 06, 2021, 02:09:56 pm »
I used to use WinZIP Professional to set up my office software. I wrote a setup program and included the 20 or so office programs. Remember, that was back in the day QuickBASIC was limited to about 200KB per app, provided you took a mullti-modular build approach. Anyway, the WinZIP allowed me to pack all my files and unpack them on all my office computers. It would also initiate my setup.exe program, upon unpacking. What was neat is it kept all files in a temp folder, until the directories were made by the setup program. It would then transfer them to the correct folders, and kill the temp stuff.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Daniel3D

  • Newbie
  • Posts: 62
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #34 on: October 06, 2021, 03:29:31 pm »
If these are for windows only, couldn't you just make the whole thing a self-extracting EXE?
It is meant to be DOS only. To fit with the game.

And maybe a batch script can do it to, I don't know
I don't know if that can handle sub folders and check source and destination.

I'll type out a pseudo script later when I am behind a real computer.

Thanks for the response so far.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Project looking for Programmer (I can't do it myself)
« Reply #35 on: October 06, 2021, 03:56:11 pm »
It is meant to be DOS only. To fit with the game.

@bplus Then you're going to need DOSBOX and QB45, if you want to compile a DOS-level executable from a BAS file.  QB64 requires Win XP or better to run.

I haven't did any DOS level stuff for twenty years.  I moved on with the times.  :P
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #36 on: October 06, 2021, 04:27:36 pm »
@SMcNeill  That's what I thought but Daniel was posting FB code at another forum. So I am thinking he has Windows to run exe's that do Setups but Runs the actual game in DOSBOX.

Yeah I haven't done DOS since late 90's. I gave my computer with all that stuff to a kid that didn't have anything when I updated to Windows 7? I think.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #37 on: October 06, 2021, 04:55:55 pm »
@bplus and @SMcNeill Do you guys think what I posted will turn out to be relevant or is this project looking like something more complicated than the usual way we copy files in QB64?

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #38 on: October 06, 2021, 05:24:53 pm »
@Pete  going by this

Quote
User input. As long as the source contains the game.
If destination doesn't exist ask to create.
If it does exist ask for overwrite.

I was thinking "the source" is Folder containing "the game".

We could actually make a backup folder before overwriting the destination in case something goes horribly wrong.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #39 on: October 06, 2021, 05:27:51 pm »
I'll wait for pseudo, get all questions answered before coding.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #40 on: October 06, 2021, 06:38:48 pm »
Mostly, you need to be careful while you're coding it. I think that's why BASIC developers chose the name KILL for that keyword. I mean you could incorporate Indy's neat send to the Recycle Bin API code. That way, nothing every gets completely removed, or sure, MKDIR backup and number the backup files. That's the method I use for my database files... myfile-1.bak, myfile-2.bak, etc. Hey, what are the chances Rob will return and code us the _RESURRECT keyword? That would solve everything! :D

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Project looking for Programmer (I can't do it myself)
« Reply #41 on: October 06, 2021, 07:15:06 pm »
The problem with this type of request is the target audience.

This task is as simple zs:

At command prompt type: COPY *.* MyDrive://MyFolder/MySubfolder/*.*

That's it, and any jack-ass even 0.01 percent fluent with DOS should know enough to do that.  Unfortunately, the people who play this game are completely clueless about the environment they're working in because they need an installer.

Which leads to using QB45 and DOSBOX...

Where nobody has any libraries or toolsets anymore...

Which means you need to write a file listing program to give you a list of the files and folders on the drive, then an input routine so the user can choose which drive and folder to copy it to, then you need a disk space checker, then finally a copy routine with clean up and overwrite capacity...

Your little one line DOS command is now 1000 lines of antiquated, redundant, error-checking with a simple single SHELL command placed right before the END statement.


Good luck with that!

Here's my go at this:

INSTALL.BAT:
Code: [Select]
COPY *.* DRIVE://FOLDER/*.*
README.TXT:
Code: [Select]
Edit INSTALL.BAT to point to desired directory to save to.  Save and execute.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Daniel3D

  • Newbie
  • Posts: 62
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #42 on: October 07, 2021, 03:18:25 am »
Yes, the installer is aimed at people not used to DOS. I do expect them to be able to navigate in a DOS environment though.
But that's about it.

@bplus : the Freebasic code you referred to was compiled such that it runs under DOS. It was the easiest way to code what was needed and still support DOS.

As for the installer.  (I included screenshots of the original installer that doesn't work with this version of the game: it has a text mode interface. It would be cool if that could be copied for ascetic reasons, the base for that is in the SETUP.BAS that may be used. But command line is fine to)

Code: QB64: [Select]
  1. on run install
  2. - ask source of the game #(can be the same as the current dir or different, does not matter | does not need to be checked)
  3.   # Enter drive to install form:
  4.   # EXAMPLE: A:\  
  5.  
  6. - check if the source contains SKID*.exe files (there should be four of them, but check for any)
  7.  
  8. ask for destination,
  9.   # Enter GAME directory
  10.   # EXAMPLE c:\stunts\
  11.  
  12. Check if the destination exists.  Create or Ask to overwrite or change destination.
  13. Don't check for enough space.
  14.  
  15. then copy files [source directory + subdirectories + all files]
  16. (ESC to terminate, don't revert, just stop)
  17. show, install complete box Return to menu on enter.

« Last Edit: October 07, 2021, 04:10:23 am by Daniel3D »

Offline Daniel3D

  • Newbie
  • Posts: 62
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #43 on: October 07, 2021, 03:32:09 am »
I'll wait for pseudo, get all questions answered before coding.
I hope I cover all important bits.
Like I said in the title. I can't write code, I can read it and understand most of it though. I'm not completely clueless.

Keep it simple. If the user f**s it up, he can download it again. It is a free game.

Offline Daniel3D

  • Newbie
  • Posts: 62
    • View Profile
Re: Project looking for Programmer (I can't do it myself)
« Reply #44 on: October 07, 2021, 04:00:00 am »
@Pete  going by this

I was thinking "the source" is Folder containing "the game".

We could actually make a backup folder before overwriting the destination in case something goes horribly wrong.
Technically, one could use the installer to restore a broken game by installing/overwrite.
It should not matter if the installer is started from the broken game folder or from the installation copy.

A backup is not needed. Too much work, the game can always be downloaded again, just as any mods.