LocalClientCommand

版本 v1.0.0·更新於 2022-04-09

Allow you to add local client with callback. These commands only run in local.

模組介紹 作者原文

What this mod brings

I tried to use AddClientCommandCallback, but met a CLIENT SCRIPT COMPILE ERROR.

// CLIENT SCRIPT COMPILE ERROR Undefined variable "AddClientCommandCallback"

So I made this to allow you to custom commands in local easier.

You can type some commands like /ping in the chat. These commands you sent will not show to other players, so feel free to use them.

Type /helpor? to get the commands list. Use up-arrow/down-arrow to scroll.

New callbacks

void function AddLocalClientCommand(string command, void functionref(entity, array) func)

You can add command with this function.

entity is the local player.

array is an array of args. args[0] is the command string.

void function PingCommand(entity player, array args)

{

int ping = MyPing()

Logger.Info("ping: " + ping)

}

// args[0] is the command string. Here is ping.

AddLocalClientCommand("ping", PingCommand)

global struct Logger

It offer 5 functions you can use to log in the chat window(only shown to you). I don’t know how to colorize the text, so they are not color-modified.

  • Logger.Trace(string str)

Trace is not completed. Do not use.

  • Logger.Debug(string str)
  • Logger.Info(string str)

Default log level.

  • Logger.Warn(string str)
  • Logger.Error(string str)

Once if the log function you use is lower than the log level, the log message will not show.

Configure this int Logger.logLevel. You can find the levels with Logger.LogType["INFO"].

If you want to change the log level, just like this:

Logger.logLevel = Logger.LogType["DEBUG"]

Logger.Debug(command)

Some default commands

  • ping

Show ping.

  • list_all_player

List all players.

  • list_all_command
  • help

-?

List all commands.

  • convar ConVarname

Show the value of the ConVarname.

Mod.json

Convars

"ConVars": [

// use to identify the commands, these chats will be blocked.

{

"Name": "l1nexus_local_client_command_prefix",

"DefaultValue": "/"

}

]

Files

│ mod.json

│

└─mod

└─scripts

└─vscripts

l1nexus_local_client_command.nut

l1nexus_local_client_command_default_commands.nut

l1nexus_logger.nut

Further updates

  • Colorize the log.

Update log

v1.0.0

  • Upload.

安裝與使用 安裝:Northstar 用戶端模組

  1. 先安裝 Northstar 用戶端(Titanfall 2 的開源社群用戶端,官方發布頁提供安裝器),模組由它載入。
  2. 把本站下載的壓縮包解壓,內容放入 Titanfall2 目錄下的 Northstar/mods/ 資料夾。
  3. 透過 NorthstarLauncher.exe 啟動遊戲,控制台會列出已載入的模組。

Northstar 用於私人伺服器與自訂內容,請勿用它連線官方伺服器。

檔案與校驗

檔案名稱
LocalClientCommand-1.0.0.zip
檔案大小
79.4 KiB