Warband Refined and Enhanced Compiler Kit 增强编译器套件
战团精制&增强编译器工具包(w ^。- [R 。ê。Ç。ķ。)
WRECK描述和特性
W.RECK旨在替代 Taleworlds提供的模块系统编译器,提供显着改进的性能,增强的错误报告和一些在Warband mod开发中可能有用的高级功能。
基本 WRECK功能:
编译速度比vanilla编译器高几倍。
WRECK实际上检测并报告了许多未被 vanilla编译器检测到的潜在错误。此外,与vanilla编译器不同,由于单个错误,WRECK不会在屏幕上出现大量错误消息。
WRECK为modder提供了轻松更改项目修饰符,游戏UI字符串和用户提示的工具,这些工具有时非常有用。为此,它引入了三个新的可选模块:module_item_modifiers.py,module_ui_strings.py和module_user_hints.py,它们分别编译为Data / item_modifiers.txt,languages / en / ui.csv和languages / en / hints.csv文件。 。如果模块系统中缺少模块文件,则不会生成任何文件(使Warband回退到标准文件)。
高级WRECK功能,仅在与模块系统正确集成后才可用(参见下面的“集成”一章):
Vanilla编译器需要两组实体引用:ID _ * .py文件(icon_player)中包含的静态引用和在编译时计算的引用引用(“icon_player”)。这产生了许多问题。例如,不可能简单地添加一个新图标和一个将使用该图标的新方:modder必须添加一个新图标,编译模块以重新生成ID文件,然后才能添加新的一方。WRECK通过引入一个动态引用(icon.player)来解决这个问题,它可以在任何地方自由使用,取代了两种类型的vanilla引用。请注意,WRECK时坚持标准的Warband前缀,字符串被引用为s。<string_name>而不是str。<string_name>。这是与方案的唯一偏差,因为str是Python中的全局关键字。
全局变量和局部变量也可以使用这种语法,“:variable”变为l.variable,“$ variable”变为g.variable。
更重要的是,新的动态参考可以在数学表达式中自由使用。只要表达式可以在编译时计算,它将在编译时计算,计算出的值将用于生成的代码中。
为了进一步扩展此功能,实际上可以在代码块的表达式中使用包含运行时变量(本地,全局,寄存器)的数学表达式。对于这样的表达式,编译器将自动生成模块系统代码,该代码将计算数学表达式并将其插入到代码中,对于modder完全透明。请注意,出于显而易见的原因,不建议在作为this_or_next操作块一部分的条件操作中使用此功能。
Vanilla模块系统依赖于header_skills.py文件来正确声明与技能相关的常量,这使得改变游戏技能变得不必要,因为必须在header_skills.py中手动镜像对module_skills.py的任何更改。WRECK编译器自动并动态计算所有必需的常量。
可以使用动态引用(imod。<modifier>和imodbit。<modifier>)代替vanilla imod_ *常量。[/ li]
[li] WRECK将透明地生成skl_ *,从模块文件中知道_ * _ *,imod_ *和imodbit_ *常量以实现向后兼容性。
WRECK为相当高级的插件系统提供支持。现在可以创建插件文件,其可以包括所有类型的模块系统数据,将代码和数据条目注入现有模块系统,扩展操作语法并对模块数据执行任意处理。插件功能在下面更详细地描述。
模块系统已经取消了许多人为限制。WRECK支持数字,字符串和位置寄存器,分别高达reg127,s127和pos127。项目重量和max_ammo参数没有人为限制(对于弹药项目不是很有用,但对于食品和贸易商品可能非常好)。
提供了新的ATTR()和SKILLS()函数,用于module_troops.py文件中的部队定义。Modder可以使用ATTR(8,9,6,4,3 )代替str_8 | agi_9 | int_6 | cha_4 | level(3)和SKILLS(trade = 2,riding = 6)而不是knows_trade_2 | knows_riding_6,从而获得更好的可读性码。另外一个好处是,此语法不受header_troops.py中定义的常量的限制,因此可以轻松定义30以上的属性值和10以上的技能级别。
Warband Refined & Enhanced Compiler Kit (W#R#E.C.K.)
W#R#E.C.K. Description and Features
W#R#E.C.K. is designed as replacement for the module system compiler provided by Taleworlds, providing drastically improved performance, enhanced error reporting and a number of advanced features potentially useful in Warband mod development.
Basic W#R#E.C.K. features:
Compilation speed is several times higher than vanilla compiler.
A number of potential errors which are not detected by vanilla compiler are actually detected and reported by W#R#E.C.K. Also, unlike vanilla compiler, W#R#E.C.K. will not flood your screen with tons of error messages because of a single bug.
W#R#E.C.K. provides modder with the tools to easily change item modifiers, game UI strings and user hints, which sometimes is extremely useful. For that purpose, it introduces three new optional modules: module_item_modifiers.py, module_ui_strings.py and module_user_hints.py, which are compiled into Data/item_modifiers.txt, languages/en/ui.csv and languages/en/hints.csv files respectively. If module files are missing from your module system, no files will be generated (making Warband fallback to standard ones).
Advanced W#R#E.C.K. features, which only become available after proper integration with Module System (see "Integration" chapter below):
Vanilla compiler requires two sets of entity references: static references contained in ID_*.py files (icon_player) and quoted references ("icon_player") which are calculated at compile-time. This creates a number of problems. For example, it's impossible to simply add a new icon and a new party which will use that icon: modder must add a new icon, compile the module to regenerate the ID files, and only then he can add a new party. W#R#E.C.K. offers a solution to this problem by introducing a dynamic reference (icon.player) which can be used freely and everywhere, replacing both types of vanilla references. Note that while W#R#E.C.K. sticks to standard Warband prefixes, strings are referenced as s.<string_name> instead of str.<string_name>. This is the only deviation from the scheme, necessitated by the fact that str is a global keyword in Python.
Global and local variables can also use this syntax, with ":variable" becoming l.variable, and "$variable" becoming g.variable.
More than that, new dynamic references can be freely used in mathematical expressions. For as long as the expression can be calculated at compile time, it will be calculated at compile time and the calculated value will be used in the resulting code.
To further expand on this feature, it is actually possible to use mathematical expressions that include run-time variables (locals, globals, registers) in the expressions within a code block. For such expressions, compiler will auto-generate the module system code which will calculate the mathematical expression and insert it into the code, completely transparently for the modder. Note that for obvious reasons it is not recommended to use this feature inside conditional operations which are part of this_or_next operation blocks.
Vanilla module system relies on header_skills.py file to correctly declare skill-related constants, which makes it unnecessarily difficult to alter game skills as any changes to module_skills.py must be mirrored manually in header_skills.py as well. W#R#E.C.K. compiler automatically and dynamically calculates all necessary constants.
Dynamic references (imod.<modifier> and imodbit.<modifier>) are available to be used instead of vanilla imod_*constants.[/li]
[li]
W#R#E.C.K.
will transparently generate
skl_*
,
knows_*_*
,
imod_*
and
imodbit_*
constants from module files for backwards compatibility.
W#R#E.C.K. provides support for a fairly advanced plugin system. It is now possible to create plugin files which can include all types of module system data, inject code and data entries into the existing module system, extend operations syntax and perform arbitrary processing over module data. Plugin functionality is described in more detail below.
A number of artificial limitations have been lifted from the Module System. W#R#E.C.K. supports numeric, string and position registers up to reg127, s127 and pos127 respectively. There are no artificial limits on item weight and max_ammo parameters (not very useful for ammo items, but may be pretty nice for food and trade goods).
New ATTR() and SKILLS() functions are provided to be used in troop definitions in module_troops.py file. Modder can use ATTR(8, 9, 6, 4, 3) instead of str_8|agi_9|int_6|cha_4|level(3) and SKILLS(trade = 2, riding = 6) instead of knows_trade_2|knows_riding_6, resulting in better readable code. Additional benefit is that this syntax is not limited by the constants defined in header_troops.py, making it easy to define attributes values above 30 and skill levels above 10.
昵称:
邮箱:
内容: