Can't update GUI Labels

Started by deltamatrix, Wed 04/04/2007 14:48:15

Previous topic - Next topic

deltamatrix

I have the following code in the global script.
 
  lblHealth.Text = String.AsInt(heroHP);
  lblMonsterHealth.Text = String.AsInt(enemyHP);

Unfortunately, I get the following compilation error:

In: 'Global script'

Error (line 14): must have an instance of the struct to access a non-static member

How do I fix this? I cannot find any documentation about this.
BAD WOLF - TORCHWOOD - MR SAXON - THE BEES ARE DISAPPEARING - PANDORICA - RIVER SONG

Khris

#1
String.AsInt is for converting a string to an int, e.g.:
String a="333";
int b = a.AsInt;  // no brackets, too, btw

You'll want:
  lblHealth.Text = String.Format("%d", heroHP);

There is a pretty recent thread explaining this, too.

deltamatrix

BAD WOLF - TORCHWOOD - MR SAXON - THE BEES ARE DISAPPEARING - PANDORICA - RIVER SONG

SMF spam blocked by CleanTalk