Cursor says:label4obj0 when not pointed at objects.SOLVED

Started by Grim, Sun 10/02/2008 13:52:38

Previous topic - Next topic

Grim

Hello again

I've upgraded my version ags to 2.72 from 2.61 and the game I'm working on upgraded itself( I didn't know I could do that!). Anyway, the problem is that wherever I point cursor this text is displayed next to it : label4obj0. When cursor is over objects or hotspots it displays the name of  that hotspot or object, but everywhere else I get that silly message. Is it something to do with GUI or cursor settings? Please, help!:)

Khris

Please show us the contents of your repeatedly_execute and tell us if you're using any modules.

Grim

This is code from global script:

#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
  // put anything you want to happen every game cycle here
 

 
if ((IsGUIOn(1) == 0) || (character[GetPlayerCharacter()].room !=0))  {
    SetNormalFont(4);
    }

 
 
  if (IsTimerExpired(1) == 1) {
  timeexp ++;
   string strmin; 
    StrFormat(strmin,"Playing Time %d minutes",timeexp);
  //  SetLabelText(6,0,strmin);
  //Display("%d minutes of game play",timeexp);
 
  SetGlobalInt(143,timeexp);

  SetTimer(1,2400);
  }

 

 
GetLocationName(mouse.x,mouse.y,location_name);
if (location_name == "") {
  StrCopy(location_name,"Label4 Obj0");
  }
 
get_gui = GetGUIAt(mouse.x,mouse.y);
got_inv = character[GetPlayerCharacter()].activeinv;

// PART 1 - determina cursor quando em cima de GUI

if (get_gui != -1) { // se estiver no GUI

  if (got_inv != -1) { // se cursor for invmode
     SetCursorMode(4);
     }
     else {
     SetCursorMode(MODE_USE);
     SetMouseCursor(2);
     } 
}
else if ((GetLocationType(mouse.x,mouse.y) > 0) && (got_inv == -1)) { // se nao estiver no GUI nem tiver cursor como objecto
    SetMouseCursor(2);
    }
    else if (got_inv != -1) {
      SetCursorMode(4);
      }
      else { // neste caso, estara em nada, e será "Walk"
     SetMouseCursor(0);
           }
       
         
// fim de PART 1

// PART 2 GUI 4 é um pequeno gui usado apenas como label (0) para texto respectivo ao objecto


if (mouse.y < 223) {
  // if(mouse.y > 20 {
  SetGUIPosition(4,mouse.x,mouse.y+7);
  //SetGUIPosition(4,mouse.x,mouse.y-14);
  //SetGUIPosition(4,270,10);
}

else {
   SetGUIPosition(4,mouse.x,mouse.y-14);
   //SetGUIPosition(4,270,10);
   }

  SetLabelText(4,0,location_name);
// fim de PART 2

}
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE

..........................................

I'm using Broken Sword GUI.

Matti

I'm very sure it has to do with your SetLabelText(4,0,location_name) line at the end of your script. The message "label4obj0" would at least fit.

I don't know the version 2.61 but in the 2.72-help it says the SetLabelText-function is obsolete and is now called: lblStatus.Text = Game.GetLocationName(mouse.x, mouse.y);
You should look it up in the help file.


And by the way use the (code)...(/code)  for your script, it's smaller and easier to read... you have to change the "(" to "["

Pumaman

You have this code:

Code: ags

GetLocationName(mouse.x,mouse.y,location_name);
if (location_name == "") {
  StrCopy(location_name,"Label4 Obj0");
  }


Which is setting it to display "Label 4 Obj 0" as the default text. The difference is probably that the == operator can be used to compare strings in 2.72, whereas in 2.61 that "if" statement would always have failed.

Grim

Should I just remove this line completely:

GetLocationName(mouse.x,mouse.y,location_name);
if (location_name == "") {
  StrCopy(location_name,"Label4 Obj0");
  }

?
Or should I replace with something else?

.M.M.

Easier is to create label, and replace text "new label" with @OVERHOTSPOT@.

Khris

How did the code end in there in the first place?
It doesn't make much sense, not even for debugging purposes.
Leave the "GetLocationName" line, but ditch the rest.

Grim

Thanks guys!
After a couple of tests I found that leaving "" empty inside does the job.
SOLVED

SMF spam blocked by CleanTalk