Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Nine Toes on Sun 01/05/2005 00:58:04

Title: Verb-coin troubles (SOLVED)
Post by: Nine Toes on Sun 01/05/2005 00:58:04
I'm trying to craft my own verb coin.  I think what I have should theoretically work, but for some strange reason, it's not.

Not too sure what's wrong, but I know for a fact that everything I click on is being classified as "Nothing, inventory, or GUI" by GetLocationType.

Here's the script, in it's entirety:

repeatedly_execute:
    if (GetCharacterAt(mouse.x,mouse.y)==1 && GetCursorMode() != 10){
      SaveCursorForLocationChange();
      SetCursorMode(10);
      }

Character: Interaction Editor: Any Click On Character:
if (GetCursorMode() == 10){
  if (mouse.x <= 160 && mouse.y >= 121){
    SetGlobalInt(98, mouse.x);
    SetGlobalInt(99, mouse.y);
    SetGUIPosition(10, mouse.x+1, mouse.y-40);
    SetGUIPosition(11, mouse.x+1, mouse.y-27);
    SetGUIPosition(12, mouse.x+1, mouse.y-14);
    GUIOn(10);
    GUIOn(11);
    GUIOn(12);
    SetCursorMode(6);
    }
  if (mouse.x >= 161 && mouse.y >= 121){
    SetGlobalInt(98, mouse.x);
    SetGlobalInt(99, mouse.y);
    SetGUIPosition(10, mouse.x-32, mouse.y-40);
    SetGUIPosition(11, mouse.x-56, mouse.y-27);
    SetGUIPosition(12, mouse.x-32, mouse.y-14);
    GUIOn(10);
    GUIOn(11);
    GUIOn(12);
    SetCursorMode(6);
    }
  if (mouse.x <= 160 && mouse.y <= 120){
    SetGlobalInt(98, mouse.x);
    SetGlobalInt(99, mouse.y);
    SetGUIPosition(10, mouse.x+1, mouse.y+1);
    SetGUIPosition(11, mouse.x+1, mouse.y+14);
    SetGUIPosition(12, mouse.x+1, mouse.y+27);
    GUIOn(10);
    GUIOn(11);
    GUIOn(12);
    SetCursorMode(6);
    }
  if (mouse.x >= 161 && mouse.y <= 120){
    SetGlobalInt(98, mouse.x);
    SetGlobalInt(99, mouse.y);
    SetGUIPosition(10, mouse.x-32, mouse.y+1);
    SetGUIPosition(11, mouse.x-56, mouse.y+14);
    SetGUIPosition(12, mouse.x-32, mouse.y+27);
    GUIOn(10);
    GUIOn(11);
    GUIOn(12);
    SetCursorMode(6);
    }
  }

interface_click:
  if (interface == LOOKAT){
    if (button == 0){
      GUIOff(10);
      GUIOff(11);
      GUIOff(12);
      if (IsInteractionAvailable(GetGlobalInt(98), GetGlobalInt(99), MODE_LOOK) == 1){
        if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 0){
          Display("Something isn't right here, because this is being classified as 'nothing, inventory, or GUI' by GetLocationType.");
          }
        else if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 1){
          RunHotspotInteraction(GetHotspotAt(GetGlobalInt(98), GetGlobalInt(99)), MODE_LOOK);
          }
        else if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 2){
          RunCharacterInteraction(GetCharacterAt(GetGlobalInt(98), GetGlobalInt(99)), MODE_LOOK);
          }
        else if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 3){
          RunObjectInteraction(GetObjectAt(GetGlobalInt(98), GetGlobalInt(99)), MODE_LOOK);
          }
        }
      }
    }
  if (interface == INTERACTWITH){
    if (button == 0){
      GUIOff(10);
      GUIOff(11);
      GUIOff(12);
      if (IsInteractionAvailable(GetGlobalInt(98), GetGlobalInt(99), MODE_USE) == 1){
        if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 0){
          Display("Something isn't right here, because this is being classified as 'nothing, inventory, or GUI' by GetLocationType.");
          }
        else if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 1){
          RunHotspotInteraction(GetHotspotAt(GetGlobalInt(98), GetGlobalInt(99)), MODE_USE);
          }
        else if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 2){
          RunCharacterInteraction(GetCharacterAt(GetGlobalInt(98), GetGlobalInt(99)), MODE_USE);
          }
        else if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 3){
          RunObjectInteraction(GetObjectAt(GetGlobalInt(98), GetGlobalInt(99)), MODE_USE);
          }
        }
      }
    }
  if (interface == TALKTO){
    if (button == 0){
      GUIOff(10);
      GUIOff(11);
      GUIOff(12);
      if (IsInteractionAvailable(GetGlobalInt(98), GetGlobalInt(99), MODE_TALK) == 1){
        if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 0){
          Display("Something isn't right here, because this is being classified as 'nothing, inventory, or GUI' by GetLocationType.");
          }
        else if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 1){
          RunHotspotInteraction(GetHotspotAt(GetGlobalInt(98), GetGlobalInt(99)), MODE_TALK);
          }
        else if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 2){
          RunCharacterInteraction(GetCharacterAt(GetGlobalInt(98), GetGlobalInt(99)), MODE_TALK);
          }
        else if (GetLocationType(GetGlobalInt(98), GetGlobalInt(99)) == 3){
          RunObjectInteraction(GetObjectAt(GetGlobalInt(98), GetGlobalInt(99)), MODE_TALK);
          }
        }
      }
    }



I've been tinkering with this for about 2 days now, trying to get it to work, but it's just not working, and I don't know what I've done wrong.

I will look around the forums and a few sites for some info on creating verb-coin interfaces, but in the meantime, can anyone help me out with this?
Title: Re: Verb-coin troubles
Post by: Ashen on Sun 01/05/2005 01:24:15
Is possible that one of the GUIs (10, 11, 12) was covering (GetGlobalInt (89), GetGlobalInt (99)), and the engine hasn't processed it as 'off'?
Try adding a Wait(1); after the GUIOff ( ) commands in interface_click. I had a problem with a save GUI appearing in savegame screenshots despite having been turned off before the game was saved, and adding a Wait command sorted that.
Title: Re: Verb-coin troubles
Post by: Nine Toes on Sun 01/05/2005 01:40:07
I wouldn't think that the GUI would be covering the co-ordinates where the mouse clicked, which is why I added:

SetGUIPosition(10, mouse.x+1, mouse.y+1);
SetGUIPosition(11, mouse.x+1, mouse.y+14);
SetGUIPosition(12, mouse.x+1, mouse.y+27);

GUI 10 and 12 are 31 x 13 pixels, and GUI 11 is 55 x 13 pixels.

I have it set up so that no matter where GUIs 10, 11, and 12 come up on the screen, they are always 1 pixel away from the point where the mouse clicked.

I'm almost positive I already tried it (and it didn't have any effect or help at all), but I will try the Wait() command again once I get home.

Thanks. :)

Does anyone else have any other suggestions?

Edit:  I got home last night and tryed out your suggestion, Ashen.  It works fine now.  Thanks for your help.