procedure problem???

hi i am writting a word rpg. I have each room as a procedure. i wrote a sample to show you what i have written. But can someone help me out or tell me a better way to do it? thanks though
var
move:string;

procedure green;
begin
writeln('You are at green');
write('Go to blue or red? ');
readln(move);
if move='red' then
red;
if move='blue' then
blue;
end;
procedure red;
begin
writeln('You are at red');
write('Go to green or blue? ');
readln(move);
if move='green' then
green;
if move='blue' then
blue;
end;
procedure blue;
begin
writeln('You are at blue');
write('Go to blue or blue? ');
readln(move);
if move='red' then
red;
if move='green' then
green;
end;
{==main==}
begin
green;
end.

i tried to define them above the procedures typing;

var
move:string;

procedure blue;
procedure green;
procedure red;

it would then not say "blue undefined" or whatever but at the end it would say ";" needed at the "end."

Comments

  • : i tried to define them above the procedures typing;
    :
    : var
    : move:string;
    :
    : procedure blue;
    : procedure green;
    : procedure red;
    :
    : it would then not say "blue undefined" or whatever but at the end it would say ";" needed at the "end."
    :

    Use the "forward" keyword:

    [code]
    procedure blue; forward;
    procedure green; forward;
    procedure red; forward;
    [/code]

    tron.

  • :
    : Use the "forward" keyword:
    :
    : [code]
    : procedure blue; forward;
    : procedure green; forward;
    : procedure red; forward;
    : [/code]
    :
    : tron.
    :
    Thanks man. That worked!!!
    Wizarbo
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion