Current time: 23.04.2024, 02:43 Hello There, Guest! (LoginRegister)
Language: english | russian  

Post Reply 
Threaded Mode | Linear Mode
Ваши вопросы по ERM-скриптам
Author Message
Archer30 Offline
Moderators

Posts: 1117
Post: #8131

Berserker, thanks! Now I understand.

Although I wish I read about OB:T earlier...


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 04.06.2021 04:31 by Archer30.)
04.06.2021 04:10
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16488
Post: #8132

Archer30, right, OB:T is safe too, forgotten.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
04.06.2021 04:52
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1117
Post: #8133

Hi! Is it possible to use SN:W variables or name variables in json? Do I have to use normal v, x, y variables for integers?

Tried with %i(jsonkey) %(name:y), %(name), no luck, just got the text instead of the value I need.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 07.06.2021 03:50 by Archer30.)
07.06.2021 03:27
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16488
Post: #8134

Nope. It's strongly not recommended to use any variables in json. It's a temporary deprecated feature for old mods.
Pass named parameters to json instead.

!!SN:T^key^/?(translation:z)/^parameter1_name^/^parameter1_value^/.../.../^parameterN_name^/^parameterN_value^;

in json value: "You know, parameter_1 value is @parameter1_value@".

Code:
Version 2.6.2
------------------------
[+] Added localization support for ERM scripts. All Lang\*.json files are loaded and merged into single dictionary of key => value pairs with language data.
Json files must be saved in UTF-8 encoding with preferably Unix line endings (#10 = 0x0A). The format is the following:

{
  "unique global key": "translation",
  "another key": "another translation"
}

During file loading text is converted from UTF-8 (Unicode, i.e Russian, Polish, Chinese and any other language is supported) into ANSI-encoding, used by player's operational system, ex. Windows-1251.
Thus you may ship the translation, other people may open and edit it without loss and characters, not representable on particular PC, will be replaced with "?".

Real example:

{
  "eqs.this_day_savegame_name": "@day@_@player@",
  "eqs.end_turn_autosave_name": "@day@_@player@_End",
  "eqs.quicksave_name":         "@day@_@player@_Quick",
  "eqs.saved_msg":              "Saved!",
  "eqs.quicksaved_msg":         "Quicksaved!"
}

It's recommended to prefix each key with string, unique for mod or author, like "pm." for "Phoenix Mod".

Translations may have parameters in the form of "@parameter name@". Those parameters are replaced with actual values during translation.
New ERM command !!SN:T is used to translate strings by key.
!!SN:T(key)/?(z-variable to place result to)/(parameter name 1)/(parameter value 1)/(parameter name 2)/(parameter value 2)...;

Example:

!!OW:R-1/6/?y1; y1 - player's gold amount
!!SN:T^test.gold_amount_report^/?z2/^gold^/y1;
!!IF:M^%Z2^; prints "You have 12850 gold left. Not bad!"

my test.json:

{
  "test.gold_amount_report": "You have @gold@ gold left. Not bad!"
}


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
07.06.2021 03:59
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1117
Post: #8135

Berserker, thanks! I thought json was advanced? Besides json, we have only erm/ert to use. They both have some disadvantages that I wouldn't consider using 102


Latest ERA mods and scripts in development - My GitHub
07.06.2021 04:37
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16488
Post: #8136

What do you mean "advanced"? Json is data format, while translated string value supports arbitrary substituted parameters, which is widely used practice. In all languages we do not interpret variables inside translated string. We pass any variable as named parameter instead. Thus we can change the code freely without touching the translation and nice versa.

SN:T..../^param_name^/i^some_var^/^param_name2^/s^some_var^;


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
07.06.2021 16:00
Find all posts by this user Quote this message in a reply
fatsawhorse Offline

Posts: 1012
Post: #8137

Здравствуйте..

Не знаю, стоит ли спрашивать подсказки или помощи, так как очевидно, что ответа не дождусь, как мне уже здесь сказали, что здесь, словно в сказке «золотая рыбка» с лимитом желаний Bad
Но всё равно попробую спросить, может какая-нибудь добрая душа поможет разобраться:

1. Как заставить появиться в гильдии магов во всех городах заклинание «Гром титанов», если это вообще возможно?
Это !#SS57:H0/65 H1/65 H2/80 H3/65 H4/65 H5/65 H6/65 H7/65 H8/65; работает только для установки шанса появления, а вот чтобы эта магия сама появилась в городских гильдиях – не знаю что тут надо сделать!

Может как-то через эту команду делается: !!CAx/y/z:G4/57/3; - тут переменная не понятная мне и ошибка всегда выходит, а магия не появляется!

2. Как можно посчитать кол-во захваченных замков, например у красного игрока?
Я пробовал, таким образом, но здесь какая-то бессмыслица выходит!
Скрипт
Достоверен ли этот расчёт или есть проще и правильнее?

Ещё конечно найти бы человечка, который потом помог бы один скрипт написать за оплату!

Заранее благодарю?
(This post was last modified: 09.06.2021 19:02 by fatsawhorse.)
09.06.2021 18:46
Find all posts by this user Quote this message in a reply
XEPOMAHT Offline
Moderators

Posts: 2270
Post: #8138

(09.06.2021 18:46)fatsawhorse Wrote:  1. Как заставить появиться в гильдии магов во всех городах заклинание «Гром титанов», если это вообще возможно?

Оно запрещено к появлению в гильдии магов.

(09.06.2021 18:46)fatsawhorse Wrote:  2. Как можно посчитать кол-во захваченных замков, например у красного игрока?

Просто считываешь значение из Структура_игрока.Количество_городов. Считать все города с помощью ERM вовсе необязательно.
09.06.2021 20:38
Find all posts by this user Quote this message in a reply
fatsawhorse Offline

Posts: 1012
Post: #8139

Здравствуйте XEPOMAHT

Quote:Оно запрещено к появлению в гильдии магов.
- честно, я не знал.. Жаль.. Bad Спасибо за ответ.

Quote:Просто считываешь значение из Структура_игрока.Количество_городов. Считать все города с помощью ERM вовсе необязательно.
- был бы рад чуть подробнее уточнить это..?
09.06.2021 20:44
Find all posts by this user Quote this message in a reply
XEPOMAHT Offline
Moderators

Posts: 2270
Post: #8140

(09.06.2021 20:44)fatsawhorse Wrote:  
Quote:Просто считываешь значение из Структура_игрока.Количество_городов. Считать все города с помощью ERM вовсе необязательно.
- был бы рад чуть подробнее уточнить это..?

В хелпе найдите и прочитайте о команде !!OW:W#1/$1
(This post was last modified: 09.06.2021 20:57 by XEPOMAHT.)
09.06.2021 20:56
Find all posts by this user Quote this message in a reply
fatsawhorse Offline

Posts: 1012
Post: #8141

Quote:В хелпе найдите и прочитайте о команде !!OW:W#1/$1
- понял.. Спасибо..
09.06.2021 21:00
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1117
Post: #8142

Quote:What do you mean "advanced"?

Berserker, by that, I mean...modern and recommended? In ERA 3 we no longer use x y v or even w variables, we use names variables since names are much better in readiness. I thought json was part of your "upgrade" plan. Json is naturally better than ert/erm for strings. But with name variables, I still have to write extra erm lines. 102

____


New question:

Can someone help with the UN:C addresses for the name and description of the building Ballista Yard (Stronghold) please?


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 11.06.2021 03:21 by Archer30.)
10.06.2021 21:38
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16488
Post: #8143

You have to explicitly pass named values to translation, right.


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
10.06.2021 23:49
Find all posts by this user Quote this message in a reply
Shiva Offline

Posts: 122
Post: #8144

Здравствуйте, подскажите пожалуйста как редактировать заклинания в Heroes 3 era? Через MMArchive (sptraits.txt) или с помощью скриптов.
13.06.2021 21:44
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16488
Post: #8145

Что именно менять?


Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов
Поддержать проект
13.06.2021 22:11
Find all posts by this user Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Forum Jump:

Powered by MyBB Copyright © 2002-2024 MyBB Group