Amos Professional Manual  Contents  Index

Disc Access


For example:

X> Run "Next level.AMOS"

This method is known as "chaining" programs together. When programs run like this, data screens and banks will be kept, allowing you to pass data and display a screen of graphics while the next level is loading. But the redundant last program will be erased to make room for the new program, so you should remember the fact that any variables will be lost in the process.

In fact, AMOS Professional does allow you to pass variable data from one program to another, by making use of "Command Lines".

COMMAND LINE$
reserved variable: transfer parameters between programs
c$=Command Lines$

Data for hi-scores, messages, names and so on can be carried through to the next level of computer game by the following method.

Type in the next example program:

E> Rem Program 1
   Screen Open 0,640,200,4.Hires
   Rem greetings sent by previous program
   Print "Greetings from Program 2:";Command Line$
   Input "Please type in a greeting!";A$
   Command Line$=A$
   Print "Running Program 2!" : Wait 100
   Run "Program2.AMOS"

Now save that example on a suitable disc, and name it "Program1.AMOS". Next, change that example program as follows:

E> Rem Program 2
   Screen Open 0.320,200,4,Lowres
   Rem Greetings sent by previous program
   Print "Greetings from Program 1:";Command Line$
   Input "Please type in a greeting!";A$
   Command Line$=A$
   Print "Running Program 1!"
   Wait 100
   Run "Program1.AMOS"

Save Program 2, and call it "Program2.AMOS". Now run Program 2, which should still be in memory. After the first blank communication, the two programs will greet one another until you break into their conversation with [Ctrl]+[C].

Back    Next
10.02.09