安装 Steam
登录
|
语言
繁體中文(繁体中文)
日本語(日语)
한국어(韩语)
ไทย(泰语)
български(保加利亚语)
Čeština(捷克语)
Dansk(丹麦语)
Deutsch(德语)
English(英语)
Español-España(西班牙语 - 西班牙)
Español - Latinoamérica(西班牙语 - 拉丁美洲)
Ελληνικά(希腊语)
Français(法语)
Italiano(意大利语)
Bahasa Indonesia(印度尼西亚语)
Magyar(匈牙利语)
Nederlands(荷兰语)
Norsk(挪威语)
Polski(波兰语)
Português(葡萄牙语 - 葡萄牙)
Português-Brasil(葡萄牙语 - 巴西)
Română(罗马尼亚语)
Русский(俄语)
Suomi(芬兰语)
Svenska(瑞典语)
Türkçe(土耳其语)
Tiếng Việt(越南语)
Українська(乌克兰语)
报告翻译问题
If so, create a discussion with your script and maybe I can help!
There actually is a callback, but its for the whole object, not specific settings.
Your modOption object has an apply function you can override that is called whenever the user applies settings
Discussion link because comments do not allow adequate formatting:
https://psteamcommunity.yuanyoumao.com/workshop/filedetails/discussion/3386860561/595136643598386903/
Thank you for your response and development request. I was hoping to process it only once when it is changed instead of every time to improve processing performance, I look forward to the ModOptions update, thank you!
There's a "Modding Request" thread on the official Zomboid Discord, and I requested that an event be created when changes are applied (even provided a snippet of code for them to accomplish this), so hopefully there will be an event in a future update that you can use to re-read all of your settings.
The settings are loaded as part of the GameBoot, you're correct (specifically when the MainScreen's object is created).
That said, instead of calling load yourself and reading your options immediately after creating them, I would recommend adding an OnGameBoot function of your own to parse the values and set any local variables you need. Or, you can wait until OnGameStart since most options are typically unused until you start the game anyways.
I think it's probably best that all mods have a chance to load and create their options first, before the mod options load is performed.
But yea, for most of them its just "option:getValue()"
You don't have to store all of the configs like I did either. You can get your "options" table anytime via:
local options = PZAPI.ModOptions:getOptions("UNIQUEID")
Then get your individual options with:
local option = options:getOption("OptionID")
You you let me think Dhert.. it was supposed to be YOUR job, not mine
I think the way to get the option object is, but how do we extract something from it ?