Current time: 25.11.2024, 22:41 Hello There, Guest! (LoginRegister)
Language: english | russian  

Post Reply 
Threaded Mode | Linear Mode
Ваши вопросы по ERM-скриптам
Author Message
Berserker Online
Administrators

Posts: 16657
Post: #8761

1. VR:C does not allocate any memory. It's just a faster way to initialize array of y or v-vars.

SN:M is allocated dynamically (on demand) and freed afterwards. In Lua all arrays are allocated dynamically.
SN:M is slower, but it's real array with API and possibility to pass it to other functions.

2. It shuffles all array items so that each item has new random position.
like 1 2 3 4 may become 4 1 3 2 or 3 4 1 2 or even stay the same 1 2 3 4.

3. VR:C works with up to 16 arguments.
SN:M, em, allows to handle arrays of arbitrary size. SN:V can take up to 16 arguments and allows to start reading/writing from any index.


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

Posts: 1175
Post: #8762

wessonsm, my test might not be legit, sorry for the trouble, it looks just fine now.

Berserker, thanks! So basically all the array commands like Array_Push cannot be used on VR:C. VR:C is only prefered when we need a static array, right


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 25.03.2022 11:20 by Archer30.)
24.03.2022 21:08
Find all posts by this user Quote this message in a reply
wessonsm Offline

Posts: 792
Post: #8763

Archer30, I think, VR:C is not directly related to arrays. It's just the same as repeating !!VR:S multiple times.
If it's enough to use an array of y-variables like !#VA(var[10]:y), then you should.
In more complex cases, you may need to use SN:M.

The code of all functions like FU(Array_Push) can be found in 9999 era - stdlib.erm
25.03.2022 12:08
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8764

wessonsm, yup, I use quite a lot of array functions from Era Erm Framework in my scripts 148

And I found the reason I had issue with the position check function. It looks like in seige battles, Wallls haven't been placed at BF.

Script for testing:
To avoid placing a stack with BU:S at BF on the positions of walls, my suggestion is to make an array for the positions of walls. What do you think about it?


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 25.03.2022 17:12 by Archer30.)
25.03.2022 13:48
Find all posts by this user Quote this message in a reply
Berserker Online
Administrators

Posts: 16657
Post: #8765

SN:M or SN:V (vector) for UN:C like access to multiple array items.


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

Posts: 1022
Post: #8766

Здравствуйте wessonsm и Bes

wessonsm, очень Вам благодарен за этот чудесный рабочий код, спасибо от всего сердца 119

Bes спасибо Вам также за неплохой пример использования..

Плохо мне так всё даётся Dash1

P.S.
Quote:я по прежнему не понимаю смысла подобного скрипта
- пытаюсь создать боевые статы у героя при нажатии на значок опыта кнопкой мыши, силовой удар, критический удар, магический удар, броня, уклонение, блокировка, скорость и т. д. с просчётом всех данных кол-во атак героя + эксперт нападения + данные от существ, от артефактов, вторнавыков, от заклинаний и т. д. (наворот можно сказать почти бесполезный, когда и так все данные на ладони). Ну как-то так..

1. Как правильно это записать !!co&y9<>66:; или всё-таки так !!co&y9<>66; без двух точек.. У меня такой выход с функций не срабатывал и я оставил такой старинный !!FU:E; ?

2. Существует ли простенький вариант заблокировать действие духа уныния и часов недоброго часа в бою, чтобы во время битвы не удалять их у героя и не давать после окончания битвы снова?
(This post was last modified: 25.03.2022 14:21 by fatsawhorse.)
25.03.2022 14:16
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8767

fatsawhorse, co is for "the next item in the loop". It is only used in "re en" and has different meaning with FU:E. For example,


Any :; can be replaced with ; now.


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 25.03.2022 16:05 by Archer30.)
25.03.2022 16:01
Find all posts by this user Quote this message in a reply
Berserker Online
Administrators

Posts: 16657
Post: #8768

fatsawhorse, везде можно ":;" заменять на ";".


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

Posts: 1022
Post: #8769

Quote:!!IF:M^The end of the %i loop^; [You won't see "The end of the 2 loop" as it's been co and skipped]
- It turns out that only the first and third cycles will work here, and the second will fly by! 102

Archer30 thanks for the reply. I will know now.

Berserker спасибо Вам также за разъяснение.
25.03.2022 16:23
Find all posts by this user Quote this message in a reply
wessonsm Offline

Posts: 792
Post: #8770

Archer30, I haven't tested the script yet, but it looks like the function names don't match here:
!!FU(hench_IfHexIsFree) and !?FU(wss_IfHexIsFree)


fatsawhorse, в последних версиях Эры везде можно заменять ":;" на ";", но я не был уверен в этом для Эра 3.0.5, поэтому на всякий случай использовал старый синтаксис.
25.03.2022 16:29
Find all posts by this user Quote this message in a reply
fatsawhorse Offline

Posts: 1022
Post: #8771

Quote:fatsawhorse, в последних версиях Эры везде можно заменять ":;" на ";", но я не был уверен в этом для Эра 3.0.5, поэтому на всякий случай использовал старый синтаксис.
- а, вот оно что! Теперь мне ясно.. У меня же 3.0.5 эра и здесь ; выход не действует.. Надо скорее всего прописывать именно так :;, хотя я привык ставить именно так !!FU:E;

wessonsm благодарю за поправку..
25.03.2022 17:03
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8772

wessonsm, hi, sorry for messing up the names, I have the same function with different names. The conclusion is still valid though


Latest ERA mods and scripts in development - My GitHub
25.03.2022 17:13
Find all posts by this user Quote this message in a reply
wessonsm Offline

Posts: 792
Post: #8773

Archer30, looks like BU:O doesn't work properly in !?FU(OnSetupBattlefield);
Other than walls, common obstacles like rocks are also not detected.
The same is SoD function 0x004695F0 (SN:E4625904).
I would suggest using !?FU(OnBattlefieldVisible) or later triggers.

I also suggest making one change to the !?FU(wss_IfHexIsFree);
string
change to
This is due to the fact that ordinary (non-magical) obstacles can have one "magic" cell, which is available and does not affect the course of the battle, but is treated by BU:O as a magical obstacle (obstacle flag 1).
25.03.2022 20:05
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8774

wessonsm, I agree that !?FU(OnBattlefieldVisible) is a better timing for placing a stack as soon as entering the battlefield. Thanks for the suggested edits!


Latest ERA mods and scripts in development - My GitHub
26.03.2022 08:22
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1175
Post: #8775

Is there a way to add/remove a lock from an artifact slot of a hero?


Latest ERA mods and scripts in development - My GitHub
(This post was last modified: 26.03.2022 19:37 by Archer30.)
26.03.2022 19:37
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