Different Text Messages to appear on one GUI (SOLVED)

Started by jfarwyke, Sun 14/02/2010 18:59:07

Previous topic - Next topic

jfarwyke

Sorry to be having another problem so soon (I've actually had several but solved them using available resources), can't find any info on this one though...

I have a GUI called gDead which would appear when the player dies. It enables him to restore or quit. That works fine. Basically, I would very much like it to display a different message according to the way in which he dies. For example, a chicken pecks him to death, so it would say "You 'pecked' the wrong the choice" or something corny along those lines (the Quest for Glory games used to do the same). I already made a text box on my GUI even though I understand this is for the player to enter text. Here's what I have in my GlobalScript under the repeatedly_execute:

Code: ags

  if (IsTimerExpired(3)){
    StopMusic();
    PlayMusic(5);
    gDead.Visible = true;
    gDead.Centre();
  }


I was hoping I could put a command at the end specifying what text I'd like displayed, but I don't see anything in the call box, nor would I expect it to be that easy. Any ideas? Thanks.

NsMn

what you need is a Label. Create one and then use

Code: ags
LabelName.Text="You were attacked by Sally the Sandworm. Nom nom nom";


jfarwyke

Quote from: NsMn on Sun 14/02/2010 19:05:37
what you need is a Label. Create one and then use

Code: ags
LabelName.Text="You were attacked by Sally the Sandworm. Nom nom nom";



My game crashed with the following message: ---------------------------
Illegal exception
---------------------------
An exception 0xC0000005 occurred in ACWIN.EXE at EIP = 0x0043FBE7 ; program pointer is +379, ACI version 3.12.1074, gtags (147,3)

AGS cannot continue, this exception was fatal. Please note...etc.

It did the same when I was experimenting with using Displays for the same purpose. Here's my script...

Code: ags

  if (IsTimerExpired(3)){
    StopMusic();
    PlayMusic(5);
    gDead.Visible = true;
    gDead.Centre();
    LabelDead.Text="blah";
  }


EDIT:

My bad! The crash has nothing to do with the label at all. It crashes without it, though I can't remember doing anything different since the last time I tested it, which is pretty frequent. I'll get to the bottom of it.

EDIT ONCE MORE:

Ha Ha! It works! Silly me. I was trying to choose a font I don't have, that's why it crashed. It works perfectly. Thanks a lot man!

SMF spam blocked by CleanTalk