Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: TheKnight on Wed 21/07/2004 21:09:58

Title: GUI don't show text in label???
Post by: TheKnight on Wed 21/07/2004 21:09:58

Here is my global script, what is wrong? I get no error messages but the textes are not shown in label

#sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() // called when the game starts, before the first room is loaded
  {
SetGlobalInt(299,8);
game.items_per_line=5;
game.num_inv_displayed=5;
game.text_speed=7;
  }
#sectionend game_start  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
  string buffer;
  string madetext;
  int cur_mode;
  int useorgive;
  StrCopy (madetext, "lll");
  cur_mode = GetCursorMode();
  if (cur_mode == MODE_WALK)
    StrCat(madetext,"Gehe zu ");
  else if (cur_mode == MODE_LOOK)
    StrCat (madetext,"Schau an ");
  else if ((cur_mode == MODE_USE) && (GetGlobalInt(1)==1))
    StrCat(madetext,"Benutze ");
  else if ((cur_mode == MODE_USE) && (GetGlobalInt(1)==0))
    StrCat(madetext,"Gib ");
  else if (cur_mode == MODE_TALK)
    StrCat(madetext,"Rede mit ");
  else if (cur_mode == 5)
    StrCat(madetext,"Nimm ");
  else if ((cur_mode == 4) && (GetGlobalInt(1)==1))
    {
    StrCat(madetext,"Benutze ");
    GetInvName (player.activeinv, buffer);
    StrCat(madetext,buffer);
    StrCat(madetext," mit ");
    }
  else if ((cur_mode == 4) && (GetGlobalInt(1)==0))
    {
    StrCat(madetext,"Gib ");
    GetInvName (player.activeinv, buffer);
    StrCat(madetext,buffer);
    StrCat(madetext," an ");
    }

  else if (cur_mode == 8) {
    if (GetGlobalInt(80) == 1) StrCat(madetext,"SchlieàŸe ");
    if (GetGlobalInt(80) == 2) StrCat(madetext,"Gib ");
    if (GetGlobalInt(80) == 3) StrCat(madetext,"Öffne ");
    if (GetGlobalInt(80) == 4) StrCat(madetext,"Drücke ");
    if (GetGlobalInt(80) == 5) StrCat(madetext,"Ziehe ");
    }

  // Find out what's under the cursor, and add it to the status line
  GetLocationName(mouse.x,mouse.y,buffer);
  StrCat(madetext,buffer);
  SetLabelText ( 0, 2, madetext);
  }
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE


function show_inventory_window()   
// This demonstrates both types of inventory window - the first part is how to
// show the built-in inventory window, the second part uses the custom one.
// Un-comment one section or the other below.
  {
  // ** DEFAULT INVENTORY WINDOW
  InventoryScreen();
  /* 
  // ** CUSTOM INVENTORY WINDOW
  GUIOn (INVENTORY); 
  // switch to the Use cursor (to select items with)
  SetCursorMode (MODE_USE);
  // But, override the appearance to look like the arrow
  SetMouseCursor (6);
  */
  }



#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int button) // called when a mouse button is clicked. button is either LEFT or RIGHT
  {
      if (IsGamePaused()==1) // Game is paused, so do nothing (ie. don't allow mouse click)
    {
    }
  else if (button==LEFT)
    {
    ProcessClick(mouse.x,mouse.y,GetCursorMode());
    SetCursorMode(MODE_WALK);
    }
  else if (button==RIGHT)
    {

  if (GetLocationType(mouse.x, mouse.y) == 2) {
    SetGlobalInt(299,9);
    ProcessClick(mouse.x, mouse.y, MODE_TALK);
    SetGlobalInt(299,0);
    }
  else {
    FaceLocation(GetPlayerCharacter(), mouse.x, mouse.y);
    ProcessClick(mouse.x, mouse.y, MODE_LOOK);
    SetCursorMode(MODE_WALK);
  }
}
  }
#sectionend on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE


#sectionstart interface_click  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
  // this GUI system uses GlobalInt 80 to store which of the extended
  // modes is in use (close, give, push, pull, etc)


  if (interface == 0) {
    if (button == 1) {   // Pick up
      SetCursorMode(5);
      SetGlobalInt(80,3);
      }
    if (button == 3) {   // Talk
      SetCursorMode(3);
      SetGlobalInt(1,1);
      SetGlobalInt(80,7);     
      }
    if (button == 4) {   // Use
      SetCursorMode(2);
      SetGlobalInt(80,1);
      }   
    if (button == 5) {   // Look
      SetCursorMode(1);
      SetGlobalInt(80,4);
      }
    if (button == 6) {   // Options
      SetGlobalInt(80,6);
      }
    if (button == 7) {   // Quit Game
      SetGlobalInt(80,9);
      QuitGame (1);
      }
    if (button == 8) {   // Load
      SetGlobalInt(80,5);
      RestoreGameDialog();

      }
    if (button == 9) {   // Save
      SetGlobalInt(80,9);
      SaveGameDialog();
      }

    if ((button == 10) & (game.top_inv_item < game.num_inv_items - 7))
      game.top_inv_item = game.top_inv_item + 4;
    if ((button == 9) & (game.top_inv_item > 0))
      game.top_inv_item = game.top_inv_item - 4;
    }
  }
#sectionend interface_click  // DO NOT EDIT OR REMOVE THIS LINE

Title: Re: GUI don't show text in label???
Post by: Pumaman on Wed 21/07/2004 21:44:57
Is Label 2 on GUI 0 definitely the one you're looking at? Is it big enough to contain the text?
Title: Re: GUI don't show text in label???
Post by: TheKnight on Thu 22/07/2004 08:28:49
Yes, it's big enough and it exists and it's the only label in this GUI.

I think i have an errror anywhere in the source code.... or do i have a bug in the cur_modes???
Title: Re: GUI don't show text in label???
Post by: Radiant on Fri 23/07/2004 14:40:01
Maybe the GUI label has its text color set to black?
Title: Re: GUI don't show text in label???
Post by: TheKnight on Fri 23/07/2004 23:34:15
Yes, the Label text color was balck. Ha, thats funny. THX :)