Jump to content

Proper use of debug messages


steelfeathers

Recommended Posts

Quick question for the community:

When you want to show the player on-screen context messages, like "A dark contract is formed..." when a spell from your mod takes hold, should you use a full-blown message, and call message.show() in your script? Or is it fine to use debug.notification?

 

Debug.notification always shows a message in my game, but could there be a case where a player has those messages turned off, and won't see the context message I'm trying to display on-screen?

Link to comment
Share on other sites

Probably depends on what you really want the message to entail. You can add all kinds of stuff, or just make it simple and clean. AFAIK, unless you specify in the debug whether you want it shown or if the user has control through a menu or a prompt...whereas, the "message" seems you can give all sorts of info in the corner, shows up in the message queue. I might be wrong or not quite right, but message seems sufficient unless you plan on adding debugging to your mod (messages that will help you fix your WIP, etc).

(sources:)

http://www.creationkit.com/Message_Script

http://www.creationkit.com/Show_-_Message

http://www.creationkit.com/Notification_-_Debug

http://www.creationkit.com/MessageBox_-_Debug

 

I skimmed, and I don't code as a profession. Assume there was a disclaimer.

Link to comment
Share on other sites

I always use a message, for a constellation of reasons with no rational basis and none of which I feel all that strongly about. In general if there is a built-in way to do something and a scripted way of doing it, I will always prefer the non-script way. For short notifications, I doubt it matters much. For long messages, my guess, without much basis, is that using a message is ever-so-slightly (as in, undetectably) more efficient. And of course obviously if you want to use text replacement or multiple response options you have to use a message.

 

I like that you can edit messages without having to recompile a script, as well.

Link to comment
Share on other sites

All good points, but if I'm using a script anyway it just seems quicker to throw in a debug.notification() line. Is there a chance that the player won't be able to see it if they fiddle with ini settings or something?

 

Also, related: How on earth does debug.trace work? The thing I'm trying to trace never shows up anywhere...

Link to comment
Share on other sites

You have to turn on Papyrus logging in your ini to see traces. Even then, since only the last few traces are included in the log and since Bethesda left so many traces in their scripts, the log is unlikely to be of much use unless you quit the game immediately following the printing of your message. Personally, I just use notifications since most of the time I want to know what is happening without quitting the game anyway.

 

Very often I put the debug.notification in while I am working on the mod, then at some point I go through and convert them all to messages.

Link to comment
Share on other sites

The biggest reason to use messages rather than debug notifications is that they're far easier to translate. If you use debugs, someone needs access to the source code and has to recompile it with a different message. With a message, they just change the text in the esp and don't need to touch your script at all.

Link to comment
Share on other sites

Message.Show() would be the better option to use if your planning to be showing the same message on a regular basis.

Message.Show() is really very limited for text replacement and you need to do all sorts of bs things to effectively and dynamically display different messages in the same message.
eg: "Tom is approaching and is 10 meters away!"
Text replacement of 10 or any number in the above messages is very easy, but changing Tom to John or any other string dynamically on the fly is damn cumbersome and relies on using quest aliases.
So instead of a simple text replacement you now have aliases and properties everywhere in your code just to present a simple message to the user.
TBH whoever designed the message system in the game engine should be shot, drawn and quartered.

But in the same sense message can be very handy with quests and renaming what's held in an alias.

Debug.Notification() should be used only for debugging and not relied on in your end mod when released.
But Debug.Notification() is just so easy to dynamic present text to the user without jumping through hoops.

I could be way of track but I thought message was localized and can be used in other languages (what is in the message translates to other languages).
Where as Debug.Notification() will present the message non localized (whatever you put in the notification is what language it stays as)

That is probably probably pure wrong assumption on my part.

Link to comment
Share on other sites

Without text replacement, replacing "Tom" with "John" was impossible before SKSE, and with SKSE requires that you find the right function to return the right object to get the right display name of. Anyway, I don't find creating an alias and filling it with an actor to be cumbersome, nor do I feel like "properties and aliases in your code" is a reasonable argument against them. That's like saying you shouldn't use the letter i or t because you'll end up with jots and tittles everywhere.

 

Text replacement isn't complicated. You're just putting the variable into the message text instead of into your text string.

Link to comment
Share on other sites

  On 8/17/2015 at 1:28 AM, Arthmoor said:

The biggest reason to use messages rather than debug notifications is that they're far easier to translate. If you use debugs, someone needs access to the source code and has to recompile it with a different message. With a message, they just change the text in the esp and don't need to touch your script at all.

 

That's only a consideration for modders who plan to translate their work or think they might get popular enough for somebody else to want to translate. I highly doubt that will ever happen to me. Anyway, if it did I would probably use a string file so that the translator didn't even need the esp.

Link to comment
Share on other sites

  On 8/17/2015 at 1:44 AM, lofgren said:

Without text replacement, replacing "Tom" with "John" was impossible before SKSE, and with SKSE requires that you find the right function to return the right object to get the right display name of. Anyway, I don't find creating an alias and filling it with an actor to be cumbersome, nor do I feel like "properties and aliases in your code" is a reasonable argument against them. That's like saying you shouldn't use the letter i or t because you'll end up with jots and tittles everywhere.

 

Text replacement isn't complicated. You're just putting the variable into the message text instead of into your text string.

Tell me again how easy message is to replace text dynamically on the fly creating a quest, creating aliases and force crap into them...

 

Oh, hang on I want a another message now

Let me add another property for the message, now I'll just create some more aliases, let's see...

 

hmm

string myString = "My dynamic string can be anything and who gives a rats if I didn't make a quest and fill aliases to display this because " + game.GetPlayer().GetActorBase().GetName() + " is being a tosser."

debug.notification(mystring + " damn this is easy to have anything in a string that doesn't require jumping through hoops extra quests and pushing referemces to aliases.")

 

Mind you I would not use Debug.Notification to do the above..

 

So I can see why people will end up using Debug.notification in a released mod.

But, I prefer not to myself.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...