Baradé's Log 1.0

This bundle is marked as pending. It has not been reviewed by a staff member yet.
Motivation
Warcraft III's singleplayer log is not available in multiplayer.
Hence, game messages can only be read when they appear.
This system provides a custom log UI keeping game and chat messages even in multiplayer.


Features
  • Custom UI
  • Chat command "-log" to open it
  • Overwrites the F12 hotkey and button to open it
  • Supports logging chat commands and any game text messages (vJass hook)
  • Customizable log size
SimError without desync for this system
The regular library SimError will desync with this system since it adds a hook to the native DisplayTimedTextToPlayer and this is placed in the GetLocalPlayer block.
Here is a version of SimError which will not desync with this system:

JASS:
library SimError initializer init
//**************************************************************************************************
//*
//*  SimError
//*
//*     Mimic an interface error message
//*       call SimError(ForPlayer, msg)
//*         ForPlayer : The player to show the error
//*         msg       : The error
//*   
//*     To implement this function, copy this trigger and paste it in your map.
//* Unless of course you are actually reading the library from wc3c's scripts section, then just
//* paste the contents into some custom text trigger in your map.
//*
//**************************************************************************************************

globals
    private sound error
endglobals

function SimError takes player ForPlayer, string msg returns nothing
    if (GetLocalPlayer() == ForPlayer) then
        call ClearTextMessages()
    endif
    // Barade: This must be outside of GetLocalPlayer due to the hook for DisplayTimedTextToPlayer from Log.
    call DisplayTimedTextToPlayer(ForPlayer, 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n|cffffcc00" + msg + "|r")
    if (GetLocalPlayer() == ForPlayer) then
        call StartSound(error)
    endif
endfunction

private function init takes nothing returns nothing
     set error=CreateSoundFromLabel("InterfaceError",false,false,false,10,10)
     //call StartSound( error ) //apparently the bug in which you play a sound for the first time
                                //and it doesn't work is not there anymore in patch 1.22
endfunction

endlibrary
Contents

Baradé's Log 1.0 (Map)

Reviews
Antares
No reply from author. Awaiting Update
Level 11
Joined
Dec 16, 2017
Messages
418
This is so dope, a feature i didn't knew i needed, lol

If someone saves the game and loads it another time, will this log somehow break, or it will retain that log when its loaded?
 
Level 28
Joined
Feb 2, 2006
Messages
1,628
This is so dope, a feature i didn't knew i needed, lol

If someone saves the game and loads it another time, will this log somehow break, or it will retain that log when its loaded?
Right now it should hide and disable the log shortly on every save and reenable it it after a short delay and recreate it on loading save games but I can improve this behavior a bit. Note after loading save games frames are invalid and must be recreated. The log should not be discarded until it reaches the specified maximum.

edit:
Updated the system and simplified the code for save games.
Whenever a savegame is loaded the UI is recreated due to Reforged's bugs with framehandles in save games but the UI is not hidden anymore.
 
Last edited:
Sry I don't know much about LUA. Can LUA not me mixed with vJass?
You can only either use Lua or JASS.

Great system! I always found it stupid that system messages are not shown in the message log in multiplayer.

If I add my own messages to the periodic trigger, they get converted to TRIGSTR_07 etc. Idk why yours do not, but this is something I think you have to address. You can avoid the trigstrings by setting the tooltip of an unused ability to the chat message, then extracting the tooltip with BlzGetAbilityExtendedTooltip.

Having the normal Blizzard log as well as your custom log can be quite confusing. I think you could hide the F12 button, create a fake one at the same position to open your log, and then create a trigger for F12 press to open and close it as well.
 
Level 28
Joined
Feb 2, 2006
Messages
1,628
It handles localized strings with the function GetLocalizedMessage, so as soon as your string starts with TRIGSTR_XXX it actually should be converted. Which GUI function did you try? The example map does the same.

About hiding the standard log: I am not quite sure but could work on this. For my own map some chat messages are sent from AI scripts which will only be shown in the official multiplayer log during a multiplayer game since hooks do not work there but this is a really really rare case.
I might add this somehow when I have more time and add it optionally.
 
I don't know, I just added a GUI line at the bottom of your periodic trigger and launched the map. In-game it got displayed as "TRIGSTR_07".

  • Messages
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • Game - Display to (All players) the text: All players!
      • Game - Display to (All players) for 30.00 seconds the text: All players timed! ...
      • Game - Display to Player Group - Player 1 (Red) the text: Player |cffff0000Re...
      • Game - Display to Player Group - Player 2 (Blue) the text: Player |cff0000ffBl...
      • Quest - Display to (All players) the Quest Update message: All players quest u...
      • Cinematic - Send transmission to (All players) from Paladin 0000 <gen> named Paladin: Play No sound and display Paladin All!. Modify duration: Add 0.00 seconds and Don't wait
      • Cinematic - Send transmission to (Player group(Player 1 (Red))) from Paladin 0000 <gen> named Paladin: Play No sound and display Red Paladin!. Modify duration: Add 0.00 seconds and Don't wait
      • Cinematic - Send transmission to (Player group(Player 2 (Blue))) from Paladin 0029 <gen> named Paladin: Play No sound and display Blue Paladin!. Modify duration: Add 0.00 seconds and Don't wait
      • Cinematic - Send transmission to (All players) from a Player 1 (Red).Archmage named Archmage at (Center of (Playable map area)): Play No sound and display Archmage!. Modify duration: Add 0.00 seconds and Don't wait
      • Custom script: call BlzDisplayChatMessage(Player(0), 0, "Chat message from red!")
      • Custom script: call BlzDisplayChatMessage(Player(1), 0, "Chat message from blue!")
      • Game - Display to (All players) the text: dudenstein
 
Level 28
Joined
Feb 2, 2006
Messages
1,628
I will have to check this since, the other messages worked.

I have added a fixed SimError to the description. This system will cause desyncs to the regular SimError because of the hooks.

edit:
There is indeed a bug. StringLength seems to already use the localized version, so StringLength("TRIGSTR_104") returns the length of "dudenstein" and not the string "TRIGSTR_104" itself. I did not know that.

edit2:
  • Fixed the bug which did not translate all strings properly because of the wrong string length of localized strings.
  • Added an option to overwrite the upper F12 Log/Chat button: UPPER_BUTTON_OVERWRITE. Note that when pressing the hotkey F12 it automatically pauses the game and hence the native Log UI has to be closed in single player as well but pressing on the button will always only open this custom Log UI.
  • Added an option for the chat commands: CHAT_COMMAND_ENABLE
  • Localized the chat message strings: CHAT_RECIPIENT_ALL, CHAT_RECIPIENT_ALLIES, CHAT_RECIPIENT_OBSERVERS and CHAT_RECIPIENT_PRIVATE
  • Added a SimError version without desync to the map file.
  • Removed function GetLocalizedMessage.
  • CreateUI is private now.
 
Last edited:
Top