Function not working with inv interations

Started by Alynn, Mon 05/04/2004 05:33:16

Previous topic - Next topic

Alynn

This is my FaceDirection(int ch, int direction) function...

Code: ags
function FaceDirection(int ch, int direction) {
  if (direction == F_UP) {
    FaceLocation(ch, character[ch].x, character[ch].y - 50);
  }
  else if (direction == F_LEFT) {
    FaceLocation(ch, character[ch].x - 50, character[ch].y);
  }
  else if (direction == F_DOWN) {
    FaceLocation(ch, character[ch].x, character[ch].y + 50);
  }
  else if (direction == F_RIGHT) {
    FaceLocation(ch, character[ch].x + 50, character[ch].y);
  }
}


The F_ are just constants for use with the function... for the most part, I have no problems with this, however when called in this block of code (Inventory on inventory interation)

Code: ags
if ((player.activeinv == 1) || (player.activeinv == 2)){
    DisplaySpeech(ALYNN, "Paper covers rock! I win!");  
    FaceDirection(ALYNN, F_DOWN);
    DisplaySpeech(ALYNN, "Maybe I should quit playing with myself.");
  }


The first speech is displayed... when I click to remove it, the game shows the wait cursor, and sits there... and thats it... when I alt+X out of it it is stopped at global script line 14 which is the line

FaceLocation(ch, character[ch].x, character[ch].y + 50);

Which... anytime else... it works fine, it only seems to mess up during inv to inv interations... my game is also set to turn before moving, so I don't know if that has anything to do with this... or it has something to do with the inv gui being open

If it is the GUI then I would like to offically make this a bug report...

Pumaman

Are you using the default inventory window or a custom one?

If it's a custom one, the problem could well be that the game is paused while the inventory window is up, so the character doesn't turn. A solution would be:

if ((player.activeinv == 1) || (player.activeinv == 2)){
GUIOff(INVENTORY);
DisplaySpeech(ALYNN, "Paper covers rock! I win!");
FaceDirection(ALYNN, F_DOWN);
DisplaySpeech(ALYNN, "Maybe I should quit playing with myself.");
GUIOn(INVENTORY);
}

SMF spam blocked by CleanTalk