Opening an external file in an AGS game?

Started by , Tue 30/03/2004 21:12:59

Previous topic - Next topic

wombat

Is it possible to, when you're half way through an ags game, to open a game made in another program (namely games factory pro)?

Hollister Man

Unless I am mistaken, ATM you would have to make a custom "launcher" program.  This could be as simple as a batch file (yourlauncher.bat) that would run your AGS game, then run your oter program, then run the AGS game again.  Its sloppy, but it would prolly work adequately.
That's like looking through a microscope at a bacterial culture and seeing a THOUSAND DANCING HAMSTERS!

Your whole planet is gonna blow up!  Your whole DAMN planet...

Scummbuddy

That would be the closest thing you can do. The only other program that Ags can launch from within itself is another ags game.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

ElectricMonk

#3
You could create a batchfile that looks something like this.

(Commands in brackets mean that I know what the program is supposed to do, but I don't know the command...)


(create a text file named "check.txt" that contains the number "0")
AGSGAME.EXE
OTHERGAME.EXE
(change the number in the "check.txt" file to "1")
AGSGAME.EXE
(change the number in the "check.txt" file to "0")


Within the AGS game, you'd have to do the following:

When you break off the game to start the non-AGS game, execute a script similar to

SaveGameSlot (30, "dummygame");
QuitGame(0);


When you start it (again), you need to tell the game to continue where you left off. So somewhere near the function game_start (or possibly in the start script of your first room) execute a script like:

(Read the contents of the "check.txt" file into a variable, say "secondround")
if (secondround == 1)  RestoreGameSlot(30);


I'm not entirely certain how to create text files on the fly in batch files, but I think it's possible. It's been a long time since my batch file writin' days...
Perhaps AGS can also create short text files with FileOpen, I don't know. And I don't know how it will deal with files that need to be overwritten.

Well, that's my two cents anyway...

Radiant

For the batch files, try

ECHO 1 > TEXTFILE

And AGS can do FileReadRawChar () to check what's in the file.

wombat

Thanks for all the help guys, but im a real newbie, and I dont have a clue how to create the batch file you described.
Could you please help me out?

Thanks (sorry) :-)

Ishmael

#6
To create a batch file? Try this: go to the compiled folder of your game, right click, select New, and select Text File. Then, open the text file up and instert into it:

echo 0 > check.txt
agsgame.exe
othergame.exe
del check.txt
echo 1 > check.txt
agsgame.exe
del check.txt

... replaceing the agsgame.exe and othergame.exe with the proper executable names.

Work surely in all other OS' then XP, I'm not so sure 'bout XP just yet...

(Like TK originally said before I edited it for continuity, do not create new posts to continue a conversation on the same subject.)
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

ElectricMonk

...and then save the whole thing as "filename.bat".

Ishmael

I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Ginny

#9
Hey, that's real interesting! Where can I learn more about this batch "language"? I see potential :D
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

wombat

Thanks for all the help, and sorry bout screwing up in the forums - ill remember bout keeping the same topic.

Also, just cos im a member now, doesnt mean im any less new!!

thx

the wombat

wombat

#11
Ok, i tried the batch file thing you said, and i typed this into the text file:

echo 0 > check.bat
spygame.exe
shootergame.exe
del check.bat
echo 1 > check.bat
spygame.exe
del check.bat

In the ags game (spygame.exe) i typed the script (i'm trying to exit the ags game  from a dialog):

else if (param ==20) {
  SaveGameSlot (30, "SaveGame");
  QuitGame(0);

But when I reach the point in the game that it is meant to quit, it quits, saves, but does not open the external game (shootergame.exe). I'm not particularly surprised at this as I have put no script into ags telling it what to do, but I am unsure what script to write.

SSH

You need to run the .bat file, rather than the AGS .exe file...
12


ElectricMonk

Simply doubleclick on the .bat file like you would on a normal .exe and it should run.

TerranRich

#15
Lesson:

Windows supports four file extensions that can be executed as programs:

.EXE - Regular EXEcutable
.BAT - BATch file, with DOS commands inside a file that are run in sequence
.COM - DOS COMmand file, like an executable specially for DOS
.PIF - Program Initiation (?) File, like a Windows version of a batch file, with extra options

:)
Status: Trying to come up with some ideas...

wombat

Okay, so ive tried opening it up, an MSDOS window comes up then closes again real quick. when i go to edit the .bat file in notepad all it comes up with is 0. is this because i have xp or is it because i just suck at scripting?

also, how would i create a .pif file to do the same thing, and where can i find information on all of this?

Sorry i suck so much...

wombat

Ginny

I found a page on batch files that seems interesting:
http://www.computerhope.com/batch.htm
Why did the file display zero?
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

wombat

i tried that website, and did what it said (which worked) but i could never seem to get it to start up any programs. I'm getting really annoyed with myself now. I need a definitive way to swich between my two files - oh dammit, i just realised that my ags game is not one file, it is loads of files, on for each room etc. Does this make it harder to switch between programs considering there is no "agsgame.exe" to switch from or to?

Oh god im drowning in the complexity of my first game!!! i dont know how i'm going to finish... im still on level one

Ginny

#19
I think you should put the batch file (aswell as the other game .exe made in a different program) in the compiled folder, where there is only one game file.
(That is unless I've missed something and you already have).
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

SMF spam blocked by CleanTalk