[SOLVED] What is the use case of room messages?

Started by artium, Fri 15/12/2017 13:20:40

Previous topic - Next topic

artium

When is it preferable to use room messages instead of simply using a string?

It seems to me that
Code: ags

cChar.Say(Room.Messages[1]);


is much less maintainable than
Code: ags

cChar.Say("Hi!");


so I guess there are specific use cases that room messages are required.

Khris

The only use case I can think of is the one stated in the manual. They are never required, you can always use your own Strings.

Crimson Wizard

#2
Personally I never used these and did not even remember these existed.

I would not say they are required, but I guess they may be used when you have a generic type of message for multiple rooms, with the actual text being dependant on the room.

For example, your character has an action "sniff air", and depending on the room he/she may give different response. Then instead of doing a big "if/else if" switch to check what room they are in, you do "player.Say(Room.Messages[1]);" (the text may be different for each room).

E: ah, yes, the manual gives similar example - the room description.

To think about it, this is like custom properties, just strings only, and only for rooms.

artium

Great, thank you.

Can you point me to the relevant manual entry? I was not able to find anything relevant in http://www.adventuregamestudio.co.uk/manual/

Crimson Wizard

#4
Quote from: artium on Fri 15/12/2017 17:51:57
Can you point me to the relevant manual entry? I was not able to find anything relevant in http://www.adventuregamestudio.co.uk/manual/

Simply type "Messages" on "Index" tab, "Messages property" entry will be found.

Also, whenever there is a function or property of a class, you will find it in a "N class functions [and properties]" section, e.g. "Scripting / Room functions".

PS. I forgot to mention, if you put cursor on Room.Messages in the script and press F1, the offline manual will come up with the related topic open.

SMF spam blocked by CleanTalk