Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
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://steamhost.cn/steamcommunity_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 ?