Condition not recognized in function room_b()

Started by spook1, Fri 27/06/2003 17:01:59

Previous topic - Next topic

spook1

I have a condition set in function room_b()
After a long time of puzzling, I conlcude that I cannot find the error.

The last condition, when GI 31 =1 and GI 17 < 2 is not recognized by the function.

To be sure I have the ResetRoom command before I enter the room.
Otherwise also the MoveObject commands are not performed.

Is there special place in the code where this function should go???

I hope someone can help me with this one...

kind regards,

martijn



function room_b() {
 // script for room: Player enters screen (before fadein)
 
shallowmessage = 0;
 
ObjectOff(3);  
ObjectOff(4);
ObjectOff(5);
ObjectOff(6);
ObjectOff(9);


objectused0 = 0;
objectused1 = 0;
objectused2 = 0;
objectused7 = 0;
objectused8 = 0;

MoveObjectDirect(0, 5,  199,0);
MoveObjectDirect(1, 25, 199,0);
MoveObjectDirect(2, 45, 199,0);
MoveObjectDirect(7, 65, 199,0);
MoveObjectDirect(8, 75, 199,0);

PickedObject = -1;
a1 = 1;
a2 = 1;
a3 = 1;
b1 = 1;
b2 = 1;
b3 = 1;

A = 1;
B = 1;
V = -1;
I = -1;


  if (GetGlobalInt(50) == 1) {
            SetBackgroundFrame(1);      
  }                                 
  if (GetGlobalInt(51) == 1) {
            SetBackgroundFrame(2);
  }
  if (GetGlobalInt(52) == 1) {
           SetBackgroundFrame(3);
  }

  if ((GetGlobalInt(31) == 1) && (GetGlobalInt(17) < 2)) {
           SetBackgroundFrame(4);
  }

  if (doornaarroom30 == 1)  NewRoom(30);
 
}

Pumaman

Put in a line of code like this:

Display("GI31 is %d,  GI17 is %d", GetGlobalInt(31), GetGlobalInt(17));

so that you can see what values the globalints have.


spook1

#2
Quote from: CJ on Fri 27/06/2003 18:05:53
Put in a line of code like this:

Display("GI31 is %d,  GI17 is %d", GetGlobalInt(31), GetGlobalInt(17));

so that you can see what values the globalints have.



CJ,
thanks for the real fast reply.
I tried your suggestion before.
If I display the values (after fade out) and even if I check the condition, it seems that everything is fine, exept that the Background is not being set to image 4

It is even so that everything works fine when I copy the whole code to

function room_c()  //player enters after fade-in

What can be wrong???

Is the function placed in a wrong place??

Kind regards,
martijn

Pumaman

Well the first thing to do is to put something like:

Display("Test");

after the SetBackgroundFrame(4); line, so that you can tell whether that bit of script is being run or not.

What is happening, is it displaying a wrong fixed frame, or is it animating through them all?

spook1

#4
it is animating through all of them, and the display(test) test learned me that the bit of script is not run at all.
I also learned that because the whole thing works fine if I put the coed in function room_c()

Strange it is .....

But... I found out that in room 1 two functions exist

function room_b() Player enters room (before fade in)

function room_e() Player enters room (before fade in)

Maybe this has something to do with the problem in room 13 ???

Can I remove one of the two functions someway ??

Pumaman

Strange that you've managed to create two of the same function. Go in through the interaction editor and do "Edit Script", to find out which one it's actually using.

As for the globalint problem, put that Display line just before the "if" statement, so that you can tell for sure what values the globalints have at that point. Are you sure you haven't got some dodgy code somewhere in the global script which is changing one of them without necessarily realising it?

spook1

One of the two functions for enters screen before fade in could be removed without the program creating errors. So I still have one function room_e() for entering screen before fade in

After this artefact was set straight in room 1, in room 13 the "eneters screen before fade-in" function is processed again.

In conclusion: We had some strange kind of bug. If it does not occur more often we can leave it... It won't happen too often I suppose

kind regards and thanks for your interest,

Martijn

Scorpiorus

As there is one function can be assigned per interaction you put the code inside room_b() while AGS probably calls room_e(). BTW room_* names have nothing the same with interaction names but assigned depending on the order you add them.

-Cheers

spook1

Hi scorpious,

That is what happened in room 1 indeed.
but as a consequence, in room 13 the player enters screen function was skipped all together. Which is typical and strange. But, all together I am glad that I solved the curious  error

Kind regards

SMF spam blocked by CleanTalk