Author Topic: How to display general, changing text in status bar GUI  (Read 144 times)  Share 

Hello All,

I am making my first game and already understand that a changing text field can be placed in the long grey "status bar" GUI using commands like:
@HOTSPOT@ or @SCORE@ ...BUT

What I would like to know is how to display a general entity in the status bar. For instance, let's say I define new global integers (I want more score-like variables to stand for things like money, health, time, etc) and I want them to keep updating their values in the status bar display field at the top. How do I do this? I've tried playing around and dug into a lot of tutorials but haven't been able to find out...

Thanks so much for your help.

Khris

  • Evil Dark Emperor Death-Kill
    • Lifetime Achievement Award Winner
    •  
    • I can help with play testing
    •  
    • I can help with scripting
    •  
    • I can help with translating
    •  
Re: How to display general, changing text in status bar GUI
« Reply #1 on: 06 Aug 2012, 19:40 »
Change the text whenever the values change and put it on a label.
Code: Adventure Game Studio
  1. // GlobalScript.ash
  2. import void UpdateStatusText();
  3.  
  4. // GlobalScript.asc
  5. void UpdateStatusText() {
  6.   lblStatus.Text = String.Format("Money: $%d - Health: %d% - Time: %d:%d", player_money, player_health, time_hour, time_minute);
  7. }
  8.  
  9. // example code in room
  10.   Display("You find a hundred dollar bill.");
  11.   player_money += 100;
  12.   UpdateStatusText();

If the time display is going to change every minute or second, just put the call to UpdateStatusText(); in repeatedly_execute in GlobalScript.asc. That way the label is updated constantly.
http://whathaveyoutried.com/

The other day on yahoo answers:
"Can you print colored images with black ink? If so tell me how please Thanx Kimberly"

Re: How to display general, changing text in status bar GUI
« Reply #2 on: 06 Aug 2012, 19:54 »
Thanks very much! Super helpful.