A modding prefix for your mods

burn

A Smooth-Skin
Modder
Modder prefix list
(see description below):
  1. g_ - burn
  2. p_ - pelicano (used in Party Orders)
  3. k_ - (reserved by me for) killap's mods: RP, UP
  4. cr_ - Cyrus
  5. v_ - Velizar
(Also see reserved box bars and hotkeys at the end of the post.)

This is intended for mod authors who:
  1. Use scripts - global scripts, in particular.
  2. Care about mod compatibility.
Sfall's global scripts and global variable greatly expanded modding possibilities. However, the problem with globals is that they are... global. Each name in the namespace is available for everyone. And that will inevitably lead to conflicts, sooner or later.
Infinity Engine modders started a modding prefix list over a decade ago to tackle this exact problem. The simple idea is that you pick a 2-3 (ascii) character prefix, and use it to create your own, private namespace inside the global one.

My suggestion is to do the same. For example, if you pick prefix “a_”, your script could be named gl_a_myscript.int, and might look like this:
Code:
#define S_NAME "gl_a_myscript"
#define ndebug(message) debug_msg(S_NAME + ": " + message + "\n")

procedure start begin
 if game_loaded then begin
   set_sfall_global("a_myvar", 1000);
   ndebug("initialized");
 end
end
...

So, if you want to ensure (to some degree) that another mod doesn’t overwrite your scripts, doesn’t mess with your global variables, and that debug messages coming from your scripts can be distinguished easily, pick a prefix, post it here, and use it for:
  • global script names
  • global variable names and saved array names
  • debug messages
  • new message files (can be loaded with add_extra_msg_file)

Of course, you can just as well not do that... but then don't say I didn't warn you.


My personal prefix is "g_", and I'm using it for quite a while already.


Edit: In addition to the above, there are other resources should be used sparingly and with caution to avoid conflicts (listing the mods I'm aware of, post to add things):

Box bars
("LEVEL", "ADDICT", etc).
Hotkeys
  • Vanilla engine:
    A, B, C, I, M, N, O, P, S, Z
    1-8, Enter, Esc, Space, Tab, Home, +, -, ?, <, >
    F1-F7, F10
    Ctrl-L, Ctrl-P, Ctrl-S, Ctrl-X
  • Party Orders: D, F, G, H, R, X, T, 0, Ctrl-B, Ctrl-W.
  • FO2tweaks: J, V, W, Y, F5, F8, F9 (F's are remapped, so no clash with vanilla).
 
Last edited:
The main problem with sfall is the order of execution of global scripts, not a name conflict.
If your script performs any important calculations for the mechanics of the engine/game, then this script should be executed first, so that subsequent executed scripts have new calculation data from your script, so your script should start with a priority prefix in its name, for example, the '#' symbol is considered to be higher than prefixes starting with 'a_'.

Главная проблема sfall - это очередность выполнения глобальных скриптов, а не конфликт имен.
Если ваш скрипт выполняет какие-либо важные расчеты для механики движка/игры, то такой скрипт должен выполняться первым, чтобы последующие выполняемые скрипты имели новые расчетные данные от вашего скрипта, поэтому ваш скрипт должен начинаться с приоритетного префикса в его имени, например символ '#' считается приоритетнее чем префиксы начинающиеся с 'а_'.
 
Last edited:
Главная проблема sfall - это очередность выполнения глобальных скриптов, а не конфликт имен.
Если ваш скрипт выполняет какие-либо важные расчеты для механики движка/игры, то такой скрипт должен выполняться первым, чтобы последующие выполняемые скрипты имели новые расчетные данные от вашего скрипта, поэтому ваш скрипт должен начинаться с приоритетного префикса в его имени, например символ '#' считается приоритетнее чем префиксы начинающиеся с 'а_'.
I don't think it's a good approach. A good approach would be to write scripts in such a way that execution order doesn't matter, which is what set_sfall_arg for.
Making a mod dependent on script execution order will only lead to prefix arms race and in the end result in the same conflicting situation. Mods that aren't compatible conceptually should be simply marked as such in the readmes.

Also, added a list of reserved box bars and hotkeys to the first post.
 
set_sfall_arg-does not solve the problem when the order of execution is important. Take the ECCO hs_barter script... and a filter with a tweak to trade, i.e. the tweak in the filter must be executed after the Ecco script.

set_sfall_arg - не решает проблему, когда важна очередность выполнения. Возьми скрипт ECCO hs_barter... и фильтра с твиком к торговле, т.е твик в фильтре должен выполняться после скрипта Ecco.
 
Last edited:
Мне непонятна проблема, на гитхабе написал.
 
I'd like to use v if that's ok. I'm currently working on a mod which will hopefully be good enough to justify the hoarding of a single-letter prefix :P
 
Z - reserved for All user :)

Не вижу я смысла в этих префиксах, они нужны только для того чтобы определить порядок выполнения для скриптов в одном большом проекте.

Сейчас у вас это больше похоже на подпись к авторству скриптов.
 
Last edited:
I guess my prefix is pbs.

To add my 5 cents to the argument, I think Mr.Stalin talked about a different issue. Prefixes are useful to avoid global var naming conflicts, just like burn said in OP. We should strive for modularity and use get_sfall_arg - agree 100%. However, order does matter when it comes to mod folders/archives. When different mods change a lot of different files and you have tens or hundreds of mods - you need ability to set up mod priority order just like most other games do. User has to be able to decide which changes are more important and how to set up order correctly, including compatibility patches etc.

With that said, currently we have a tiny amount of usable mods available (compared to other popular games), so the issue of conflicts doesn't come up. A lot of folk who play heavily modded game use various mod re-packs that already contain a certain set of mods pre-tweaked and merged to work together. So they don't have this issue either (although that's a whole another can of worms, and something I think we should move away from).
 
Back
Top