Wake of Gods Forum | Форум Во Имя Богов

Full Version: ERA II
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
Val, where is your DL:S command? Update must be right after it.
DL:S opens dialog, DL:C closes it. So it is after closing, I have no idea how to use this other way.
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
}
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.
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./
!!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:;
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.
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.
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.
Jim likes to experiment )
(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.
(07.01.2018 02:31)Berserker Wrote: [ -> ]При отвязке от карты появляются возможности для единообразного добавления скриптов на Lua, можно распространять ресурсы отдельно (не только скрипты), можно применять оптимизации (в 2.55 загрузка гораздо быстрее, так как ЕРМ остаётся тем же в большинстве случаев загрузки). +Часть багов связана именно с поддержкой событий карт.
Современные карты-моды распространяются в виде модов, поскольку и писать ЕРМ в событиях, мягко скажем, неудобно, и отлаживать в карте невозможно без рестарта.
а) легаси. Много мелкого легаси.
б) распространение ресурсов отдельно - минус, а не плюс.
в) ориентация на картомоды, которых считанные единицы, вместо карт с полутора снипплетами (отключение командиров etc), я полагаю, неверна.

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

Компромиссным вариантом была бы выгрузка скриптов (при их наличии) из файла карты с папку перед загрузкой
feanor, а утилита, которая извлекает из карты скрипты в папку будет компромиссом? Уже писал такой скрипт.
(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.
Reference URL's