Computer Science Canada

Calling procedures from inside procedures

Author:  Paul Brenek [ Sun May 23, 2004 5:31 pm ]
Post subject:  Calling procedures from inside procedures

Hi All,

I am coding a game and one of my menus has the following procedures codes to buttons:
start a new game
resume a saved game
quit

I have two questions:

1. I am using setscreen to set up the game window. How do I close the screen (game window) on quitting? I am using return but it leaves the screen up. I tried quit but it did the same thing and added an error message window. This was no good.

2.The start new game is a procedure. I want to launch other procedures from it such as getting number of players and other types of user input. Anyone know how to do this since Turing will not allow you to call procedures from within procedures?

Thanks for all you help.

Author:  LiquidDragon [ Sun May 23, 2004 5:47 pm ]
Post subject: 

they do let u call procedures in procedures u just have to have the one you are calling before the one you are calling it in

EXAMPLE CODE:
code:

proc cookie
    %code stuffs
end cookie

proc start
    %code stuffs
    cookie
end start


basically it would look like that. Hope that helps your procedure problem

Author:  Paul [ Sun May 23, 2004 6:46 pm ]
Post subject: 

You can call procedures from procedures, as long as the contained procedure is coded first.
and to close a window u must first open one
code:

var WinID:= Window.Open ("graphics: max; max; offscreenonly")
%program here
Window.Close (WinID)

Author:  Dan [ Tue May 25, 2004 2:13 pm ]
Post subject: 

if you look in to the forward comand, it dose not even have to be code 1st but you just have to let turing know that is will be coded latter.


: