TheGathering console 1.4.61

If you liked this item, please rate it up on Steam Workshop page.

Author: Inter-object

Last revision: 15 Oct, 2019 at 06:16 UTC (5)

File size: 299.01 KB

On Steam Workshop

Description:
Update notes
  1. 1.4.6
    • 1.3.0 update. This mod is no longer ‘required mod’ of The Gathring sandbox’ mod. Unsubscribe this mod. The sandbox mod now have own UI.
  2. 1.4.4
    • Auto-detect locale and some ‘zh’ localisations.
  3. 1.4.3
    • New OO-like logger and minor fixes. 11 Sep.
  4. 1.4.1
    • New ‘insert line’ button, new ‘console_log, true/false’ command. 31 Aug.
  5. 1.4.0.
    • run command to excute external Lua scripts like ‘run, console/run_test’. 27 Aug
  6. 1.3.73.
    • Separated from the sandbox mod. 24 Aug

This mod has limited ability to send commands to ‘The Gathering Sandbox Mod’. For now, to use ‘The Gathering sandbox mod’ through UI, you need to subscribe to this mod.

Main mod TheGathering sandbox

============================================================================

The following is for the script modders.

Previous versions of ‘The Gathering sandbox mod’ were removed from Steam Workshop because of a report of Vandy who originally declared "I opened this ‘Lua Console’ as a modder resource". Also, it’s because of my mistake that I didn’t check the e-mail from the CA as the Steam sender.

Separated from the sandbox mod, this UI mod is 100% newly created. And this mod is a good sample for those who are new to 3K script modding.

I opened this ‘TheGathering console mod’ as a modder resource.

This word does not change. Even if it changes, the work using this mod before the change is respected.

This mod can be a good start for the script modder:

  1. It shows the basic mode initialization routines by campaign manager and core.
    • Initializing when ui created.
    • Initializing just before campaign first turn.
    • Initializing at campaign first turn.
  2. This mod suggests ways to increase compatibility by all functions and variables name space are in local visibility.
  3. Demonstrates how to configure a mod directory composed of multiple script files.
  4. Demonstrates how you can make multiple functions all local references in an external library.
  5. This mod can log to a specified file.
  6. This mod provides a way to communicate with external mods by core events.
  7. In addition, it also shows how to send multiple commands to sandbox mod at given turn.

The functionality of communication with sandbox mod by core events cannot be released in public without my permission.

Demonstrates a basic way to construct and create a UI.

  1. Notified that the UI framework has been created.
  2. Create component from assets in the CA pack files.
  3. Register as a member to the parent UI component .
  4. Resize the component created.
  5. Position component within the parent UI component.
  6. Shows how to pre-set ‘text’ as the button changes state.
  7. Register an event listener for the component you created.

How this mod can be used in real 3K campaign.

  1. How to hide UI, when full-screen panel active.
  2. How to detect when pre/post battle panel is active to avoid problem.
  3. Most importantly, when switching between campaign and battle screens, the game crashes because of duplicate event listeners. ‘Battle UI’ CA scripts does not check unique ID of event listener. This should be avoided.
  4. This mod handles subtle situations where menu icons are created in unnecessary places in battle screen.

Upcoming Update

  1. Ability to execute predefined script commands inside.
  2. Ability to read and run external Lua scripts.

Skyrim Modders Resources

If you are unfamiliar with the term modder resource, please refer to Modders Resources[www.nexusmods.com] of Skyrim at the Nexus site where most of the modders were active. Many good mods have moved to that category so that modders can freely modify and extract the contents.

1.4.0. Run Command Description

run, console/run_test

The Run command excutes an external Lua script. The base path for looking for external scripts is the "Game" directory. This explanation assumes that you have a directory called ‘console’ in your game directory and that there is a file called ‘run_test.lua’.

The contents of the example ‘run_test.lua’ are as follows.

local logger = require("lib.TheGathering_mod_logger"):new( ‘run’, "console/run_test_log.txt", true, Logger.Verbose, true ) —————————————————————————— —————————————————————————— local function out_metatables() –logger:inspect( "inspect", inspect ) — inspect, self description. –logger:inspect( "_G", _G ) — over 8,000 lines out. local query_faction = cm:query_faction( cm:get_local_faction() ) local query_character = query_faction:faction_leader() logger:inspect( "query_faction", getmetatable( query_faction ) ) logger:inspect( "query_character", getmetatable( query_character ) ) if TheGathering_sandbox then — currently ‘TheGathering_sandbox’ is global. local modify_model = TheGathering_sandbox.modify_model if modify_model and not modify_model:is_null_interface() then local modify_character = TheGathering_sandbox:modify_character( query_character ) local modify_faction = TheGathering_sandbox:modify_faction( query_faction ) logger:inspect( "modify_faction", getmetatable( modify_faction ) ) logger:inspect( "modify_character", getmetatable( modify_character ) ) local action = { db_key = "조조" } –action.db_key = ‘cao_cao’ local query_cao_cao = TheGathering_sandbox:find_action_character( action, true ) if query_cao_cao then local modify_cao_cao = TheGathering_sandbox:modify_character( query_cao_cao ) modify_cao_cao:set_undercover_character_enabler( true ) end end end end —————————————————————————— —————————————————————————— logger:line( "run test started" ) — 오류가 발생하면 이 함수 호출 이후가 중단되어 로그가 원래로 복원되지 않으니 pcall을 사용합니다. — If an error occurs, the call is aborted and the log is not restored. — So, Using pcall for exceptional handling. local function call_internal() out_metatables() end local ret, err = pcall( call_internal ) if not ret then logger:error( err ) end logger:line( "run test end" ) logger = nil return "run_test done"

Above example shows ‘query_faction, query_character, modify_faction, modify_character’ API using inspect[github.com] function. Output to ‘console/run_test_log.txt’ file.

If ‘run’ command failed, you can see error message in ‘TheGathering_console_log.txt’ if enabled in the console script.

Scripts running with the sandbox console can see the results, change them, and run them again. This can be very helpful for script development. Depending on the user, the difference will be very large.

Overriding already loaded Lua function is key. In some cases, you do not need to start a new game.