Interaction Problem

Started by Armageddon, Fri 07/12/2012 07:02:50

Previous topic - Next topic

Armageddon

So I opened a project I haven't worked on in awhile, for some reason interactions won't work and walking won't work when scripting.

Here's the code.

Code: AGS
function hNest_Look()
{
  if (!GotThere()) GoFace(82, 137, eLeft);  // example coords
  else
  {
    cTest.Say("&1 That's an interesting wall.");
  }
}

function hNest_Interact()
{
  cTest.Walk(82, 132, eBlock, eWalkableAreas);
  cTest.Say("I used that hotspot and it did nothing!");
}

In the first instance he won't walk, in the second he won't even interact. Here's the mouse code.

Code: AGS
function on_mouse_click(MouseButton button) // called when a mouse button is clicked. button is either LEFT or RIGHT
{
  // inside on_mouse_click
  mouse_offset_x = mouse.x - (player.x - GetViewportX());
  mouse_offset_y = mouse.y - (player.y - GetViewportY());
  
  if (IsGamePaused() == 1)
  {
    //Game is paused, so do nothing on any mouse click
  }
  else
  {
    if (button == eMouseLeft)
    {
      //left mouse button
      if (GetLocationType(mouse.x, mouse.y) == eLocationNothing)
      {
        mouse.Mode=eModeWalkto;
        //not over hotspot so walk
        ProcessClick(mouse.x, mouse.y, eModeWalkto);
      }
      else
      {
        //over a hotspot/object etc
        if (mouse.Mode==eModeUseinv)
        {
          //using inventory on hotspot
          ProcessClick(mouse.x, mouse.y, eModeUseinv);
        }
        else
        {
          mouse.Mode=eModeInteract;
          //not using inventory, so Interact
          mouse.Mode=eModeInteract;
          ProcessClick(mouse.x, mouse.y, eModeInteract);
        }
      }  
    }
    else if (button == eMouseRight)
    {
      //right mouse button
      if (mouse.Mode==eModeUseinv)
      {
        //inventory item out, so cancel it
        mouse.Mode=eModeLookat;
      }
      else
      {
        //no inventory item out, so look
        ProcessClick(mouse.x, mouse.y, eModeLookat);
      }
    }
    else if (button == eMouseWheelNorth)
    {
      //mouse wheel up
    }
    else if (button == eMouseWheelSouth)
    {
      //mouse wheel down
    }
  }
}


The last thing I remember doing was removing the inventory GUI so I could remake it but I haven't gotten around to it yet.

Khris

Debugging 101:
Put Display("test"); in your code at various points to see if it's even called.
Maybe an invisible GUI is catching your clicks or something like that.

SMF spam blocked by CleanTalk