Description

This is my first mod, and its goal (unless you have severe issues with memory retention) is to help other beginner modders. The mod configures that when the M key is pressed a message will display telling you if it is night time or daytime. It is set so that night time begins at 21:00 and ends at 04:00. I also attached three txt files with more general information about modding. Thanks to xcvb, RavenAscendant, demonized and GhenTuong. Installation follows like most other mods - unpack the included gamedata file and drop it in your Anomaly folder. Or better yet, consider using a mod manager like MO2. Inspired by Classic bandits taunt mod by DerChrom.

Preview
Is it night time? (educational)
Post comment Comments
M4K5P0W3R
M4K5P0W3R - - 284 comments

hello, is it possible to make your addon show information after displaying the time in this addon Moddb.com, when everything is set to 1 key? The idea is to write AM PM after the clock is displayed.

Now when you press the button, first the information from your addon is displayed and only then the clock

Reply Good karma Bad karma+1 vote
ravenascendant
ravenascendant - - 1,104 comments

wrist watch should show AM and PM when used...

Reply Good karma Bad karma+2 votes
M4K5P0W3R
M4K5P0W3R - - 284 comments

With the Russian version of the game does not show Ibb.co

Reply Good karma Bad karma+1 vote
zoust
zoust - - 359 comments

Always good to see new modders :) gl and tx for helping others

Reply Good karma Bad karma+3 votes
ggforever++ Author
ggforever++ - - 27 comments

Thank you!

Reply Good karma+3 votes
]{oNtrAst
]{oNtrAst - - 261 comments

Что делает этот аддон?

Reply Good karma Bad karma+1 vote
Chesy
Chesy - - 2 comments

Этот мод добавляет возможность просматривать время, жмешь на клавишу M и тебе показывает сейчас ночь или день

Reply Good karma Bad karma+1 vote
ravenascendant
ravenascendant - - 1,104 comments

Now for the 200 level lesson:
Use MCM to allow the user change the key in game.
Github.com
Similar examples:
Moddb.com
Github.com

Reply Good karma Bad karma+2 votes
ggforever++ Author
ggforever++ - - 27 comments

Yes master.
I actually wanted to do this for an already existing mod that I love, Free Zoom. Moddb.com

Reply Good karma+2 votes
Banjaji
Banjaji - - 389 comments

This is about script names.

One thing that has become relevant for me since I started monkeypatching and accessing variables from other scripts is the name of the script. By the way monkeypatching is when you change an already existing function and overwrite the previous function with your new code. The scripts are loaded in alphabetic order. So "a.script" is loaded before "k.script".

Now lets say you have "b.script" that wants to access a variable from "k.script" on loading the script. This would crash the game (or you catch the error and simply don't have the variable) since "k.script" isn't loaded yet. Then you could rename your script into eg "m.script".

Another thing is when you are monkeypatching. Sometimes you want to just overwrite the entire function's contents. Then I think it's good to name your script "a_b.script". Then if there are other monkeypatches that want to add to the code then they will add to your code which is already loaded and you won't overwrite their additions. However, if you just want the function to do whatever it does but do something extra for you then I think it's good to name your script "zz_b.script" or "zzzzzzz_b.script" if you really-really need it to load last. Then other mods can overwrite the function but you will keep their changes and still get to have your piece of code in addition.

Lately I've been experimenting with putting the vanilla file in addition with your monkeypatch script into the mod. That way direct conflicts will show, otherwise monkeypatch will result in a sneaky conflict. It has actually already saved me from a tedious debugging session. However, this way you'll need to give clear instructions to the users where to put your mod in the load order. Eg if it was just the monkeypatch and the vanilla script then the mod should be the lowest priority so that everything else overwrites the mod.

Reply Good karma Bad karma+2 votes
Banjaji
Banjaji - - 389 comments

This is about callbacks and other functions that work with xray engine.

Also another script which has callbacks is "axr_main.script". More precisely it's the list "intercepts". I'm not sure whether the callback needs to be defined in "bind_stalker_ext.script" in order to actually use the callback in LUA.

Another helpful file has been "lua_help.script". There are many functions that can be called in LUA to intercept/change something in the engine. Eg db.actor:cast_Actor():conditions():ChangeSatiety(number) changes your satiety (ChangeSatiety() is listed in the file).

The engine can be found here (Monolith xray engine "xray-monolith"): Bitbucket.org

Reply Good karma Bad karma+2 votes
Banjaji
Banjaji - - 389 comments

This is about objects and executing some engine-based commands.

Occasionally I've stumbled on objects that differ from usual objects. Usually it's a "game object" (usually "obj") eg like a piece of bread which you can throw on the ground or an npc that you can talk to. Then you can get it's section with obj:section(). However eg when you create a stash it's going to be a "server object" (usually "se_obj"). This differs somehow and eventually turns into a game object. se_obj:id() will crash and se_obj.id will actually give the result you want. I think the game creates this virtual server object and then passes it into the engine which creates an actual game object instead of the first one. I think it's better to pass object IDs instead of objects themselves due to this reason. The point is that this process takes actual time and if you don't account for it you'll get unexpected behavior (eg crash).

A way to have real-world time pass before running some code is to use TimeEvents: CreateTimeEvent("General event ID","Specific event ID",seconds_before_running,function_to_run, function_argument_1,function_argument_2, function_argument_3).

In those the code will execute function_to_run after seconds_before_running of seconds. Note that it seems that the arguments that are passed to the actual function aren't original variables. These are copies of the variables. Also the function will keep running over and over and over again until it returns true.

The example for TimeEvents and those objects is in my Wheelbarrow mod ( Moddb.com ), more specifically in "banjaji_wheelbarrow.script" .

Reply Good karma Bad karma+2 votes
Banjaji
Banjaji - - 389 comments

About the logs.

Logs "also go in the console you can get to by hitting ~ but that can't be scrolled". You can scroll the console with "page up" and "page down" keys at least for me. That's why I love to use printdbg("Something") when debugging my scripts. I haven't really seen much difference in printf() and printdbg(). Both print actively to the debug window and after the game has exited then also to the log file.

Reply Good karma Bad karma+2 votes
ggforever++ Author
ggforever++ - - 27 comments

Thank you for all the information. By the way, the people on discord are working on a wiki: Igigog.github.io
Centralizing all the information is a task in it of itself I guess. :)

Reply Good karma+2 votes
Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: