plyMessage, plyRedirectMessage, questions and suggestions

Post ideas & suggestions you have pertaining to the game here.
Post Reply
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Hi George.

In several of the mods I am working on I have been looking for ways to suppress the common messages, such as "press [M] for map", "press [D] for docking" etc...

The are a few reasons. Mostly I want to pass some messages to the player myself at the beginning of an adventure, and those other messages keep pushing them offscreen. Also, in some games the player may not need to dock at all, making that message obsolete and potentially confusing.

So, perhaps you already solved this problem with plyRedirectMessage, but since it's function signature is very lacking I am not sure. The only thing I have been able to make it do is kill messages completely, which is not good (no "Pause/Unpause", "Enemy Detected", etc. messages). So, is there some technique I have missed with this?

Also, you have plyClearShowHelpRefuel... but creating one such function for each built in message hardly seems like the right way to go.

So, I have a suggestion:

Deprecate plyClearShowHelpRefuel and enhance plyRedirectMessage to take a lambda as it's second argument, which receives the message to be redirected as it's only argument, and returns the message to be displayed, or nil if it should be suppressed. That would allow us to do:

Code: Select all

(plyRedirectMessage gPlayer (lambda (message)
  (switch
    (eq message "press [M] to see a map of the system")
      (setq message nil)
    (eq message "Enemy Detected")
      (setq message "Captain, Klingon ships decloaking off port bow")
  )
  message
))
The example might be a bit silly, but it seems to me to be very powerful.

Any thoughts on this? Is it already possible to kill only some of the built in messages?
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

plyRedirectMessage is a complete hack. Here is how it works:

Imagine that you have an event on an item, something like <OnRefuel>. Sometimes, <OnRefuel> needs to tell the player about what happened. In those cases, the normal thing to do is to call objSendMessage, which puts up a message on the main screen.

But what if sometimes you have to call <OnRefuel> from inside a dock screen? The message displayed by objSendMessage will not be seen because the dock screen is on top (you can't see the main screen).

To solve that, the screen needs to call plyRedirectMessage. You turn redirect on:

(plyRedirectMessage gPlayer True)

All calls to objSendMessage are sent to a buffer instead of the screen. When you are done, you turn off redirect:

(plyRedirectMessage gPlayer Nil)

If you want to see the contents of the buffer, you can call:

(plyGetRedirectMessage gPlayer)

This allows the dock screen to capture any calls to objSendMessage and then display the resulting message on the dock screen.
-----------------------

plyClearShowHelpRefuel is also a bit of a hack.

Internally the game keeps a set of bits for each piece of help text. When the game starts, all bits are on, meaning that we are always checking to see if we should show the help text.

For most of the bits, the game itself can figure out when the user acted on the help. For example, when the user presses the "M" key, we clear the bit for the map help.

For refueling, however, because it is done through a dock screen, we need some script to tell the engine when to clear the bit. Thus, plyClearShowHelpRefuel.

One possible way of generalizing this, which could also solve your problem, is to have a function like:

(plyShowControlHints gPlayer hint True/Nil)

Where "hint" is a keyword representing the kind of help to show. For example,

(plyShowControlHints gPlayer 'mapHint Nil)

would disable showing map help.

(plyShowControlHints gPlayer 'refuelHint Nil)

would stop showing fuel help.

We could even support a syntax like:

(plyShowControlHints gPlayer "*" Nil)

OR

(plyShowControlHints gPlayer Nil)

Which would turn off all hints. You could then issue that at game start (or something).

To generalize even further, we could add:

(plyEnableMessage gPlayer messageType True/Nil)

where "messageType" is an identifier representing the type of message:

mapHint
refuelHint
...
allHints
enemiesDetected
custom

etc.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

OK, I see what your reasons were now.

As for the best way of working with the bits, I think plyEnableMessage seems like it offers most flexibility (and a good signature). It might be fun to disable the "Enemies Detected" message for only a period of time, as part of a computer glitch or similar :)

Do you want me to open a ticket for this?

Thanks for the response in any case! :)
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

alterecco wrote:OK, I see what your reasons were now.

As for the best way of working with the bits, I think plyEnableMessage seems like it offers most flexibility (and a good signature). It might be fun to disable the "Enemies Detected" message for only a period of time, as part of a computer glitch or similar :)

Do you want me to open a ticket for this?

Thanks for the response in any case! :)
Yes, please open a ticket. It will be relatively easy to do plyEnableMessage with control over all help messages. We can add control over more messages over time.
User avatar
Prophet
Militia Captain
Militia Captain
Posts: 826
Joined: Tue Nov 18, 2008 6:09 pm

YAY!

Thanks George, that will be a big help in the Syrtian War adventure! (As most of those help messages don't apply :mrgreen: )
Coming soon: The Syrtian War adventure mod!
A Turret defense genre mod exploring the worst era in Earth's history.
Can you defend the Earth from the Syrtian invaders?
Stay tuned for updates!
Post Reply