Current time: 22.11.2024, 15:06 Hello There, Guest! (LoginRegister)
Language: english | russian  

Post Reply 
Threaded Mode | Linear Mode
ERA II
» WoG Era 2: Русская и Английская версии
Author Message
Valery Offline

Posts: 2196
Post: #2851

Yeah, thats why the TL. UN:R does simply not work if changes are done within dialog, tried everything. Is like updating battlefield from dialog, needs a special SN or UN:C
08.01.2018 04:18
Find all posts by this user Quote this message in a reply
Berserker Online
Administrators

Posts: 16657
Post: #2852

Val, where is your DL:S command? Update must be right after it.


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

Posts: 2196
Post: #2853

DL:S opens dialog, DL:C closes it. So it is after closing, I have no idea how to use this other way.
(This post was last modified: 08.01.2018 07:04 by Valery.)
08.01.2018 07:02
Find all posts by this user Quote this message in a reply
RoseKavalier Offline

Posts: 118
Post: #2854

In plugin I simply call 0x417380 (redraws everything on adventure map) after dialog is closed, it updates with no issues.
I don't know if you can call a function from ERM with arguments but it's basically:

Code:
__thiscall([0x6992B8], 1, 0) ~~~

__asm{
    MOV ECX, DWORD PTR DS : [0x6992B8]
    PUSH 0
    PUSH 1
    MOV EAX, 0x417380
    CALL EAX
}

I guess it may be the same function... ERM noobie 118

EDIT: according to WoG source, it's partial use of 0x417380 function so it may be missing something.

Code:
void RedrawMap(void)
{
  #include "templ.h"
  __asm{
    mov    ecx,0x6992B8
    mov    ecx,[ecx]
// ïåðåðèñîâûâàåò ýêðàí advanture
// ecx -> advManager
    mov    ecx,[ecx+0x44]
// âûëåòàåò, åñëè íóëü
    or     ecx,ecx
    je     l_not
   push   ecx
    push   1
    push   1
    push   0xFFFFFFFF
    mov    eax,0x4032E0
    call   eax
   pop    ecx
    push   1
    push   1
    push   0xFFFFFFFF
    mov    eax,0x403420
    call   eax
// ïåðåðèñîâûâàåò ïðàâîå íèæíåå îêíî êàðòû
    mov    ecx,0x6992B8
    mov    ecx,[ecx]
//    mov    ecx, -> advManager
    push   1
    push   1
    push   1
    mov    eax,0x415D40
    call   eax
  }
l_not:;  
  RETURNV
}
(This post was last modified: 08.01.2018 08:50 by RoseKavalier.)
08.01.2018 08:35
Find all posts by this user Quote this message in a reply
Berserker Online
Administrators

Posts: 16657
Post: #2855

Valery, DL:C simply sets variable to close dialog, but does not close immediately. I do not see any DL:S in your code (((

RoseKavalier, yep, thanks. In ERM it's !!UN:R1, but "right after close" is right after calling Dialog Show (!!DL:S) in ERM. Val is trying to call redraw IN EVENT HANDLER, not after dialog is closed.


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

Posts: 2196
Post: #2856

Well of course there is a DL:S because I need to open the dialog))

Here is short version of what is done when level is modified:


Then modify stats


And finally close:

So I modify stats, close dialog, but now in map to see any change I have to click somewhere, otherwise it shows same values as before. An update problem./
08.01.2018 16:43
Find all posts by this user Quote this message in a reply
Berserker Online
Administrators

Posts: 16657
Post: #2857

!!DL550:S1;
Insert update command right after it. It may be enclosed in condition. If SHOULD_UPDATE then update. Any global variable with suit.

!!DL:S
!!if (some update w-var is set)
    ; update!
!!en:;


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

Posts: 2196
Post: #2858

Now thats silly, it works. I can't still get the mechanics of why it works, but it works, all updated. Thanks a lot.

Final version of trainer uploaded.
(This post was last modified: 08.01.2018 17:08 by Valery.)
08.01.2018 17:05
Find all posts by this user Quote this message in a reply
Berserker Online
Administrators

Posts: 16657
Post: #2859

It's not silly, because !!DL:C does not close dialog, but only marks it for closing. Dialog is still on the screen. After all !?DL triggers execution WoG will close dialog. So you call update while dialog is still on the screen. Real updates can be performed after DL:S command. Here all !?DL triggers already executed, dialog is closed and you are free.


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

Posts: 2196
Post: #2860

I see (for me still doesn't make sense as the command to update is done before any action took place, but I don't know the internals). Is interesting that Jim didn't see this, then went into TL triggers which made the mod very unstable.
(This post was last modified: 08.01.2018 17:22 by Valery.)
08.01.2018 17:21
Find all posts by this user Quote this message in a reply
Berserker Online
Administrators

Posts: 16657
Post: #2861

Jim likes to experiment )


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

Posts: 7107
Post: #2862

(08.01.2018 17:05)Valery Wrote:  Now thats silly, it works. I can't still get the mechanics of why it works, but it works, all updated.
Because your script is paused when you display the dialog. It resumes after the dialog is closed.


When all gods have burnt to ashes in eternity of sorrow,
Demons gonna tear your soul because there is no tomorrow.
08.01.2018 19:50
Find all posts by this user Quote this message in a reply
feanor Offline

Posts: 624
Post: #2863

(07.01.2018 02:31)Berserker Wrote:  При отвязке от карты появляются возможности для единообразного добавления скриптов на Lua, можно распространять ресурсы отдельно (не только скрипты), можно применять оптимизации (в 2.55 загрузка гораздо быстрее, так как ЕРМ остаётся тем же в большинстве случаев загрузки). +Часть багов связана именно с поддержкой событий карт.
Современные карты-моды распространяются в виде модов, поскольку и писать ЕРМ в событиях, мягко скажем, неудобно, и отлаживать в карте невозможно без рестарта.
а) легаси. Много мелкого легаси.
б) распространение ресурсов отдельно - минус, а не плюс.
в) ориентация на картомоды, которых считанные единицы, вместо карт с полутора снипплетами (отключение командиров etc), я полагаю, неверна.

Ну и принуждение к удобству..ну такое.

Компромиссным вариантом была бы выгрузка скриптов (при их наличии) из файла карты с папку перед загрузкой
08.01.2018 21:04
Find all posts by this user Quote this message in a reply
Berserker Online
Administrators

Posts: 16657
Post: #2864

feanor, а утилита, которая извлекает из карты скрипты в папку будет компромиссом? Уже писал такой скрипт.


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

Posts: 2196
Post: #2865

(08.01.2018 19:50)gamecreator Wrote:  Because your script is paused when you display the dialog. It resumes after the dialog is closed.

yes I did a test and now I see what you mean. Before I thought that this won't work:

!?CM0;
!!UN:R2; update resources bar
!!OW:R0/6/d5000; add resources

and needs to be

!?CM0;
!!OW:R0/6/d5000; add resources
!!UN:R2; update resources bar

But in fact it works. Somehow it looks weird to me that it is being updated before script is activated but there is the evidence.
09.01.2018 04:02
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