global messages with AGS 3.2.11 (solved)

Started by Volcan, Wed 18/09/2013 00:38:15

Previous topic - Next topic

Volcan

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:

Khris

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.

Crimson Wizard

You can create Global Variables of type String and use them by their name.

Volcan

Thank you for the tip, Crimson Wizard.

It works like a charm.

Volcan

The translation does not seen those variables. Any suggestions?

Crimson Wizard

#5
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

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

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

Stupot

#6
@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
MAGGIES 2024
Voting is over  |  Play the games

Crimson Wizard

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).

Khris

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?

Crimson Wizard

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.

Khris

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.

Crimson Wizard

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.

Volcan

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

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.

Khris

Sure, exactly. I assumed you knew about global variables/strings, so I was curious whether you needed them for some other reason.

Volcan

#14
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.

Crimson Wizard

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

Khris

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.

Volcan

Thanks Khris for the advice.

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

SMF spam blocked by CleanTalk