Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Ishmael on Sun 04/05/2003 20:21:54

Title: Walking with talk... a bug?
Post by: Ishmael on Sun 04/05/2003 20:21:54
I am not sure if this has been asked before... But anyway: Sometimes when testing my game I come up with this:

Select talk mode, talk to other char. end conversation (next time you try to talk to him, you just get a message saying he dont want to talk to you), and when you click to remove the last message box, the main char starts to walk to the point where the mouse was (talk mode!). And if I click again, the char starts walking there. This goes on until I change mode or click on the main char. If I click on the other char, it starts the converstion...

Is this a bug in AGS or in my game? It's fun, but I'd like to get rid of it....  :P
Title: Re:Walking with talk... a bug?
Post by: Pumaman on Sun 04/05/2003 20:55:38
It's probably some sort of problem with your on_mouse_click function - could you paste your script code for that in here.
Title: Re:Walking with talk... a bug?
Post by: Ishmael on Mon 05/05/2003 19:20:32
function on_mouse_click(int button) {
 // called when a mouse button is clicked. button is either LEFT or RIGHT
 if (IsGamePaused() == 1) { }
 if ((button==RIGHT) && (IsGUIOn(0))) {
   if (GetCursorMode() < 6) { curmode=GetCursorMode(); } else { curmode=0; }
   GUIOff(0);
   GUIOn(1);
   SetCursorMode(6);
 }
 else if ((IsGamePaused() == 1) && (button==RIGHT) && (IsGUIOn(1)==1)) {
   GUIOff(1);
   GUIOn(3);
 }
 else if ((IsGamePaused() == 1) && (button==RIGHT) && (IsGUIOn(3)==1)) {
   GUIOff(3);
   GUIOn(0);
   UnPauseGame();
   SetCursorMode(curmode);
 }
 else if ((IsGamePaused() == 1) && (button==RIGHT) && (IsGUIOn(2)==1)) {
   GUIOff(2);
   GUIOn(0);
   UnPauseGame();
   SetCursorMode(curmode); }
 if (button==LEFT) {
   if (GetGlobalInt(1)==0 || GetCursorMode()==0) {
     MoveCharacter(TK,mouse.x,mouse.y);
   }
   ProcessClick(mouse.x, mouse.y, GetCursorMode() );
 }
 if (button==MIDDLE) {
   SetNextCursorMode();
 }
}

I think it's all there... I haven't put in the inventory scritps yet...
Title: Re:Walking with talk... a bug?
Post by: Pumaman on Mon 05/05/2003 20:38:22
Quote from: TK on Mon 05/05/2003 19:20:32
 if (button==LEFT) {
   if (GetGlobalInt(1)==0 || GetCursorMode()==0) {
     MoveCharacter(TK,mouse.x,mouse.y);
   }
   ProcessClick(mouse.x, mouse.y, GetCursorMode() );
 }

Well, that MoveCharacter command will start the character moving, and if Globalint 1 was 0, then it will run. You might want an "else" before ProcessClick, or use MoveCharacterBlocking, depending on what you want to achieve.
Title: Re:Walking with talk... a bug?
Post by: Ishmael on Tue 06/05/2003 11:35:34
Damn me! Thanks.... it's suposed to be &&, not ||... oops...