Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Volcan on Wed 18/09/2013 00:38:15

Title: global messages with AGS 3.2.11 (solved)
Post by: Volcan on Wed 18/09/2013 00:38:15
I'd like to use global messages in my game but I don't see any options in AGS editor 3.2.1 unless I missed it somehow.
:confused:
Title: Re: global messages with AGS 3.2.11
Post by: Khris on Wed 18/09/2013 00:41:19
They were removed (I believe as of 3.0, when the editor was rewritten).
The question is, what do you need them for? There's nothing they can do better than the alternatives, afaik.
Title: Re: global messages with AGS 3.2.11
Post by: Crimson Wizard on Wed 18/09/2013 00:58:29
You can create Global Variables of type String and use them by their name.
Title: Re: global messages with AGS 3.2.11
Post by: Volcan on Wed 18/09/2013 01:21:20
Thank you for the tip, Crimson Wizard.

It works like a charm.
Title: Re: global messages with AGS 3.2.11
Post by: Volcan on Wed 18/09/2013 03:29:52
The translation does not seen those variables. Any suggestions?
Title: Re: global messages with AGS 3.2.11
Post by: Crimson Wizard on Wed 18/09/2013 08:12:12
Quote from: Volcan on Wed 18/09/2013 03:29:52
The translation does not seen those variables. Any suggestions?

I assume you used the "Global Variables" panel?
Sounds like a bug really. It really does not go to translation files.


I'd suggest to define variables manually in global script similar to how I explained here, just of "String" type:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=48992.msg636467928#msg636467928

How stupid of me. You can actually ignore this, and continue using ones from Global Variables pane.

You'll just have to initialize values in some function, preferably game_start() in GlobalScript (or any of your custom modules).
Code (ags) Select

function game_start()
{
   MyGlobalMessage1 = "This is global message text";
}

Just make sure it is actually becomes initialized before being used.
Title: Re: global messages with AGS 3.2.11
Post by: Stupot on Wed 18/09/2013 10:08:36
@CW Can't you just set the global message as the initial value of the string when you create it in the Global Variables pane?
Right you are. Carry on :P
Title: Re: global messages with AGS 3.2.11
Post by: Crimson Wizard on Wed 18/09/2013 10:11:37
Quote from: Stupot+ on Wed 18/09/2013 10:08:36
@CW Can't you just set the global message as the initial value of the string when you create it in the Global Variables pane?
Yes, but Volcan just found that in such case the initial value is not included to translation file (see few posts above).
Title: Re: global messages with AGS 3.2.11
Post by: Khris on Wed 18/09/2013 10:40:47
I'm curious, because I always thought that Global messages are completely obsolete, hailing from back when everything was referenced by numbers.

How are you using them?
Title: Re: global messages with AGS 3.2.11
Post by: Crimson Wizard on Wed 18/09/2013 10:42:31
Quote from: Khris on Wed 18/09/2013 10:40:47
I'm curious, because I always thought that Global messages are completely obsolete, hailing from back when everything was referenced by numbers.

How are you using them?

Hmm, I think there's some misunderstanding.
I was referring to Global Variables, that may be of numerous possible types, including int, String, float, bool, and some pointer types too.
Title: Re: global messages with AGS 3.2.11
Post by: Khris on Wed 18/09/2013 10:57:42
Sure, I know, but what misunderstanding? I was asking Volcan why he needs them.
Afaik, Global messages were basically an array of 500 Strings, like GlobalInts. In the interaction editor, you could use a "display global message" action and enter the respective number (or use DisplayMessage(5); in a script).

They're outdated and useless by now, so I was curious how he wants to use them.
Title: Re: global messages with AGS 3.2.11
Post by: Crimson Wizard on Wed 18/09/2013 11:01:28
Ah, sorry, I thought you... thought we were using them somehow in 3.2 :). So it is a misunderstanding on my part.
I guess Volcan just wanted to have some global strings? but he will explain better of course.
Title: Re: global messages with AGS 3.2.11
Post by: Volcan on Wed 18/09/2013 15:37:14
Quote from: Crimson Wizard on Wed 18/09/2013 08:12:12
Quote from: Volcan on Wed 18/09/2013 03:29:52
The translation does not seen those variables. Any suggestions?

I assume you used the "Global Variables" panel?
Sounds like a bug really. It really does not go to translation files.


I'd suggest to define variables manually in global script similar to how I explained here, just of "String" type:
http://www.adventuregamestudio.co.uk/forums/index.php?topic=48992.msg636467928#msg636467928

How stupid of me. You can actually ignore this, and continue using ones from Global Variables pane.

You'll just have to initialize values in some function, preferably game_start() in GlobalScript (or any of your custom modules).
Code (ags) Select

function game_start()
{
   MyGlobalMessage1 = "This is global message text";
}

Just make sure it is actually becomes initialized before being used.

Thanks CW. Your code works fine.

For other people ...

I made 50 rooms so far. With Global Message, if I make a mistake, it's easy just to correct one string unstead going to the whole game to correct the same thing.
Title: Re: global messages with AGS 3.2.11
Post by: Khris on Wed 18/09/2013 17:54:38
Sure, exactly. I assumed you knew about global variables/strings, so I was curious whether you needed them for some other reason.
Title: Re: global messages with AGS 3.2.11
Post by: Volcan on Wed 18/09/2013 20:28:04
I made more global messages and translate them without any problems.

To Khris:

If I write display("You can't doo Dat."); 200 times and later I discovered I spelled them wrong, I would need to correct those things 200 times.

With global messages, I only need to correct one thing and the whole game is fixed.

I hope you understand that.
Title: Re: global messages with AGS 3.2.11 (solved)
Post by: Crimson Wizard on Wed 18/09/2013 20:41:53
Quote from: Volcan on Wed 18/09/2013 20:28:04To Khris:

If I write display("You can't doo Dat."); 200 times and later I discovered I spelled them wrong, I would need to correct those things 200 times.

With global messages, I only need to correct one thing and the whole game is fixed.

I hope you understand that.

Lol. ;)
http://www.adventuregamestudio.co.uk/forums/index.php?topic=48998.msg636468002#msg636468002
Title: Re: global messages with AGS 3.2.11 (solved)
Post by: Khris on Wed 18/09/2013 22:39:20
Hehe :D

You can also use unhandled_event() for stuff like that, that way you won't have to write anything at all 200 times.
Even if you are using global strings or messages, putting "you can't do that" code in all interaction functions separately is a bad idea.
Title: Re: global messages with AGS 3.2.11 (solved)
Post by: Volcan on Wed 18/09/2013 23:15:14
Thanks Khris for the advice.

If I need help with unhandled_event(), I'll start a new topic.