紙莎草記錄本

作者 Pickysaurus·版本 v1.0·更新於 2018-10-03

一對腳本,允許您在腳本中記錄事件,這對於錯誤檢查很有用。

截圖 共 1 張

模組介紹 作者原文

一對腳本,允許您在腳本中記錄事件,這對於錯誤檢查很有用。

這裏有一些我編寫的腳本,如果您想從mod腳本中記錄事件和錯誤,這些腳本可能很有用。它基於我添加到Dragonborn of Legborn的系統,並將在Dragonborn的Odyssey中使用。它具有一個調試系統,可以根據調試全局顯示消息。

它是什麼?

存檔中包含兩個包含大量註釋的腳本。

PKY_DebugScript - 這是主腳本,您可以將事件發送到此腳本,它會將消息打印到您的mod的調試日誌中。

PKY_DebugAliasScript - 這是一個幫助腳本,它將在開始新遊戲或加載保存遊戲時喚醒調試日誌。

我該如何使用它?

腳本是鬆散的,因此您可以隨意使用它們,但推薦的設置需要一些東西:

1.創建一個新的Quest條目,在{YourPrefix} Logger或{YourPrefix} Debugger的行中爲其指定一個編輯器ID。確保將其設置爲“啓用遊戲啓用”。 (你還需要生成一個新的SEQ文件)

2.在任務中添加一個指向Unique Actor“Player”的新別名。將PKY_DebugAliasScript附加到別名。

3.創建一個全局變量,這將控制調試級別。

4.在您的任務中附加PKY_DebugScript,然後在屬性窗口中填寫調試全局和您的mod名稱。

接下來,在您希望能夠記錄/調試的腳本中添加以下屬性。

PKY_DebugScript屬性LogFile自動

確保在Creation Kit中填寫上面的屬性。

現在,當您要寫入日誌時,請使用以下功能之一:

LogFile.Log(“在這裏留言”)

LogFile.Log(“警告在這裏”,1)

LogFile.Log(“錯誤在這裏”,2)

函數的格式是Log(Script asMessage,int aiPriority)。 asMessage是要寫入的消息,aiPriority默認爲info(0),但可以定義爲warning(1)或error(2)。

現在,當您記錄事件時,您將在My Documents \ My Games \ Skyrim Special Edition \ Logs \ Script \ User中找到它的記錄 - 其中文件將在上面的步驟4中定義您的mod名稱。

我建議使用像Notepad ++這樣的文本編輯器打開此文件以提高可讀性。

注意,如果調試/日誌全局高於日誌優先級,則不會打印消息。用於在故障排除時打開/關閉高級日誌記錄。

這不就是Debug.TraceUser()嗎?

是的,不是。如果您沒有提前打開日誌,那麼簡單地調用TraceUser()將會失敗。如果您的全局設置爲允許,則會動態打開日誌。

——————————————————————————————————————————————————————————

Here's a couple of scripts I wrote that may be useful if you'd like to log events and errors from your mod scripts. It's loosely based off the system I added into Legacy of the Dragonborn and will be using in Odyssey of the Dragonborn. It features a debug system that will display messages based on the debug global.

What is it?

There are two scripts, with plenty of comments, included in the archive.

PKY_DebugScript - This is the master script, you can send events to this script and it will print a message to a debug log for your mod.

PKY_DebugAliasScript - This is a help script, it will wake up the debug log on starting a new game or loading a save game.

How do I use it?

The scripts are loose so you can use them however you like, but the recommended setup requires a few things:

  • Create a new Quest entry, give it an editor ID along the lines of {YourPrefix}Logger or {YourPrefix}Debugger. Make sure it's set to "Start Game Enabled". (You'll need to generate a new SEQ file too)
  • Within the quest add a new alias pointing to Unique Actor "Player". Attach PKY_DebugAliasScript to the alias.
  • Create a global variable, this will control the debug level.
  • On your quest attach PKY_DebugScript, then fill the debug global and your mod name in the properties window.

Next, in scripts you want to be able to log/debug add the following property.

PKY_DebugScript Property LogFile Auto

Make sure you fill the property above in the Creation Kit.

Now when you want to write to the log, use one of the following functions:

LogFile.Log("Message here")

LogFile.Log("Warning here", 1)

LogFile.Log("Error here", 2)

The format of the function is Log(Script asMessage, int aiPriority). asMessage is the message to write, aiPriority is default to info (0), but can be defined as warning (1) or error (2).

Now when you log an event, you'll find record of it in My Documents\My Games\Skyrim Special Edition\Logs\Script\User - where the file will be named as you defined your mod name in step 4 above.

I recommended using a text editor like Notepad++ to open this file for readability.

Note, if you debug/log global is higher than the log priority, it will not print a message. Useful for turning on/off advanced logging when troubleshooting.

Isn't this just Debug.TraceUser()?

Yes and no. Simply calling TraceUser() will fail if you did not open the log ahead of time. This will open the log dynamically, provided your global is set to allow it.

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 這類遊戲沒有通用的模組管理器:有的模組直接替換遊戲檔案、有的放進遊戲專屬的 Mods 資料夾、有的要先裝遊戲對應的社群載入器或工具,以包內說明為準。
  3. 嚴格按說明放置檔案;標註「前置依賴」的模組需要把依賴一併裝好。
  4. 啟動遊戲確認載入成功;部分遊戲需要在設定或模組選單裡手動啟用。

不同遊戲、不同模組的安裝位置差異很大,包內說明是最可靠的依據。

檔案與校驗

檔案名稱
纸莎草记录本
檔案大小
4.1 KiB
SHA-256
38411b4a11b1d6e9829e663ad0c613bf05c81ea821412d6692e3453f5827d3d5
入庫時間
2026-10-08 18:17