Current time: 22.04.2024, 23:51 Hello There, Guest! (LoginRegister)
Language: english | russian  

Post Reply 
Threaded Mode | Linear Mode
Школа ERM 2
» ERM 2.0 для ERA III
Author Message
daemon_n Offline
Administrators

Posts: 4338
Post: #211

(05.12.2021 19:45)Berserker Wrote:  
Quote:P.S. Всегда считал что !!co ускоряет действие циклов
Это микрооптимизация.

Там микро, сям микро - и вот уже макро96


Image: widget.png?style=banner2

Новейший Heroes 3 Launcher
05.12.2021 19:49
Visit this user's website Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16488
Post: #212

Лучше всего линейная логика. Реально, читаемее, меньше багов, легче расширить блоком else, дописать код после. Прыжки заставляют прыгать поток управление через блоки, с ними нужно больше внимания и концентрации. Ты постареешь, а код останется. И процессоры будут быстрее. Если только это не маленькая фнукция, которую будут вызывать в цикле десятки тысяч раз. Для этого можно замерить скорость выполнения через GetTimeMsec.


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

Posts: 1348
Post: #213

Berserker, можете пожалуйста подсказать кое-что касательно ERM2? Если у меня есть константа, объявленная во внешнем файле, я могу ее использовать в собитии карты?


Создал новый глобальный мод: WoG Ultra Edition
02.01.2022 23:50
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16488
Post: #214

Продублируй её в событии карты. Скрипты карты грузятся до глобальных скриптов.


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

Posts: 1348
Post: #215

Berserker, хорошо, спасибо! Достаточно только один раз продублировать, или надо это делать в каждом событии?


Создал новый глобальный мод: WoG Ultra Edition
03.01.2022 01:20
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16488
Post: #216

Один раз в самом приоритетном событии.


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

Posts: 1348
Post: #217

Понятно. Спасибо за ответы!


Создал новый глобальный мод: WoG Ultra Edition
03.01.2022 01:36
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1117
Post: #218

Questions about writing styles and formats

1. Do we use &(TRUE) instead of &1 for the meaning "flag 1 is 1"?, example:

2. We have sevral ways to create an array in ERA 3. Does any any of them requires initialization of any kind?


Latest ERA mods and scripts in development - My GitHub
25.02.2022 10:38
Find all posts by this user Quote this message in a reply
wessonsm Offline

Posts: 779
Post: #219

Archer30, синтаксис &(FALSE) будет работать неправильно, так как перекомпилируется в &0, а не &-1.
К тому же это не улучшит, а ухудшит читаемость скрипта - не будет видно сразу, что 1 - это флаг.
25.02.2022 10:48
Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1117
Post: #220

Dash1I forgot that (FALSE) is 0. Yea I agree &1 is more readable. Just daemon_n wrote it as &(TRUE) and I started to think the other way.


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

Posts: 4338
Post: #221

Archer30, unstandard decisionRolleyes


Image: widget.png?style=banner2

Новейший Heroes 3 Launcher
25.02.2022 11:31
Visit this user's website Find all posts by this user Quote this message in a reply
Archer30 Offline
Moderators

Posts: 1117
Post: #222

Berserker, thanks for the code!

There were not many times I struggle with erm syntax, but now it is definitely the moment. It seems like my knowledge is not enough to handle erm 4, lol!
A few questions I'd like to ask:

1. What is (@var)?
2. What's the reason for using y(ptr) here? Is it not true that mixing normal y and (var:y) could result in bad things?
3. What's wrong with my code when I try to execute the function with an array ID? I can't get to define the IF:N dialogue.



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

Posts: 16488
Post: #223

1) @ - get address operator. Compiles into index without variable type.

If (someVar) = y50, (@someVar) = 50.
If (someArr[20]:y) = y20..y39, then (@someArr[1]) = 21

2) Ptr = pointer. It means that one variable holds index of another variable.

We cannot iterate over 2 arrays at the same time using !!re normally.

For instance, over y20..y39 and y40..y59.

But we can store 40 into (somePtr) and increase it one by one, so that y(somePtr) refer to y40, y41, y42...

3) Call IF:N^title^; after setup.


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

Posts: 1117
Post: #224

Berserker, thank you so much!

About the second question, I mean. I read that (var:y) would be compile into classic y vars (y1, y2, etc) by ERA with a process. This process strickly forbiddon mixing y1, y2 with (var:y) (name:y) in the same funcion as there is a chance (var:y) (name:y) could be compiled to y1 y2 and overlap. Why is it not a concern in the case mixing (var:y) and y(ptr:y)?


Latest ERA mods and scripts in development - My GitHub
09.03.2022 18:16
Find all posts by this user Quote this message in a reply
wessonsm Offline

Posts: 779
Post: #225

Archer30, (ptr:y) это такая же переменная, как и все остальные, обозначение "ptr" используется для удобства и понимания.
Если (ptr:y) будет перекомпилировано в y10,
тогда y(ptr) перекомпилируется в yy10.
Смешивания не возникает, потому что мы в обоих случаях используем одну переменную y10.
Если я правильно понял вопрос.
09.03.2022 18:40
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