Problem with semicolon and something more

Started by Draco, Sat 10/09/2011 18:18:03

Previous topic - Next topic

Draco

Hi,
I have a little problem.
I have started one game and I wanted to spare some time so I used the code from the Demo game (I hope it doesn't matter ???). Of course I changed the code a little bit, after the change the code is:
function room_c() {
   // script for room: Repeatedly execute
   if (FadeToBlack()==false) {
      SetScreenTransition(eTransitionDissolve);
      player.ChangeRoom(Menu.crm);
    }

So I have two problems; first one: in the original code it was it was like: player.ChangeRoom(crmMenu);
and when I copied it the AGS said its "unknown token:crmMenu" so I tried to change it a little bit and it has disapper. But I don't know if its right. The second problem is that the AGS say that in the last part of the problem code  (player.ChangeRoom(Menu.crm); ) is expected semicolon. But the semicolon is already there.
Could you help me?

Draco

Draco


pcj

You have to specify the room number in ChangeRoom(), not what you did.  So it would be like player.ChangeRoom(1); or something.
Space Quest: Vohaul Strikes Back is now available to download!

Lt. Smash

Yep, pcj is right. You've passed the room's filename as argument for ChangeRoom instead of the right room number.

Possibly crmMenu was originally defined as a variable with the proper room number. Smth like int crmMenu = 2;

Btw welcome aboard on the AGS forums ;)

RickJ

If you look at the demo game's header file you will find a line "#define crmMenu 1" (don't rememebr the exact number).  The compiler substitutes "1" (or whatever text comes after crmMenu) for "crmMenu" before compilation.   

The #define lines in the header demonstrate how to give names to the room numbers.  You will either have to use the room number or put your own #define lines in the header file.  It's your choice to work with numbers or names.

SMF spam blocked by CleanTalk