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

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

Posts: 5459
Post: #2881

Katarina, можно... вопрос лишь упрётся в смену описания...
если очень горит, постараюсь нарыть тот самый кусок кода, который когда-то создал Дьякон для Гавани
01.08.2014 17:18
Visit this user's website Find all posts by this user Quote this message in a reply
Katarina Offline

Posts: 37
Post: #2882

Не к спеху, но если что-то есть - было бы неплохо.
01.08.2014 19:15
Find all posts by this user Quote this message in a reply
igrik Offline

Posts: 2819
Post: #2883

Первый раз использую эровские переменные типа !!SN:W^[моя_переменная]^/0; Не перенамудрил ли я? Можно ли данный код сделать короче чтоле, но не используя функций и переменных типа "v" и флагов, т.е. максимально непересекаемо с другими скриптами и модами.
Скрипт - при нападении на нейтралов, оковы войны не действуют, и герой может сбежать


game bug fixes extended.dll || My Plugins || My GitHub
(This post was last modified: 13.08.2014 02:03 by igrik.)
13.08.2014 01:50
Visit this user's website Find all posts by this user Quote this message in a reply
Algor Away
Administrators

Posts: 3881
Post: #2884

(13.08.2014 01:50)igrik Wrote:  Не перенамудрил ли я? Можно ли данный код сделать короче чтоле, но не используя функций и переменных типа "v" и флагов, т.е. максимально непересекаемо с другими скриптами и модами.
Перенамудрил. Можно.

  1. ZVSE
  2. !?BG0;
  3. !!BG:A?y1;
  4. !!BA:H1/?y2;
  5. !!FU|y1<>4/y2>=0:E;
  6. !!HE-10:A2/125/?y3/?y4 A3/125/y4/1;
  7. !!SN:W^spheres^/y4;
  8. !?BA1;
  9. !!SN:W^spheres^/?y1 W^spheres^/0;
  10. !!HE-10&y1>0:A4/125;
  11. !!HE-10&y1>1:A4/125;
  12. !!HE-10&y1>2:A4/125;
  13. !!HE-10&y1>3:A4/125;
  14. !!HE-10&y1>4:A4/125;


BattleHeroes Rus/Eng | ERA scripts (+ReMagic) Rus/Eng
13.08.2014 03:10
Visit this user's website Find all posts by this user Quote this message in a reply
igrik Offline

Posts: 2819
Post: #2885

Да уж, перенамудрил так перенамудрил 148. Спасибо
Наверное так? !!SN:W^spheres^/?y1 W^spheres^/0;


game bug fixes extended.dll || My Plugins || My GitHub
(This post was last modified: 13.08.2014 10:31 by igrik.)
13.08.2014 10:30
Visit this user's website Find all posts by this user Quote this message in a reply
Algor Away
Administrators

Posts: 3881
Post: #2886

(13.08.2014 10:30)igrik Wrote:  Да уж, перенамудрил так перенамудрил 148. Спасибо
Наверное так? !!SN:W^spheres^/?y1 W^spheres^/0;

угу, так точно, обкопипастился (

UPD: ох, блин... а почему "spheres" то? "okovy" же. Надо было все-таки после пива спать ложиться, а не по форуму лазить...


BattleHeroes Rus/Eng | ERA scripts (+ReMagic) Rus/Eng
13.08.2014 12:24
Visit this user's website Find all posts by this user Quote this message in a reply
igrik Offline

Posts: 2819
Post: #2887

Quote:Надо было все-таки после пива спать ложиться, а не по форуму лазить...
ох как я тебя понимаю 118


game bug fixes extended.dll || My Plugins || My GitHub
13.08.2014 14:17
Visit this user's website Find all posts by this user Quote this message in a reply
Valery Offline

Posts: 2196
Post: #2888

Prisons in random maps are a plague. So far I have a script removing them but the reset of the hero levels/stats/skills is more complicate.

I need to make an ini file (like the one from call to arms), set inside all heroes initial levels then read from it values. Can anyone give me a clue how those ini files are made? A short example will help me to understand, thanks.
18.08.2014 02:14
Find all posts by this user Quote this message in a reply
Bes Offline

Posts: 5459
Post: #2889

for example,restore defaul sex hero...

  1. !!HE-1:N?y9;
  2. !!UN:J9/1/-1; Data path
  3. !!VRz-1:+^DefNames.ini^;
  4. !!VRz-2:S^defaultsex^; set ini section name to read
  5. !!UN:N6/z1/y9/-2/-1; get text-value to z1 from ini-option y9
  6. !!VRv2:Vz1; convert text to number (don't fogget this operation)
  7. !!HE-1:R2/v2;

ini file looks as...
Code:
[defaultsex]
0=0
1=1
2=0
3=1
4=0
...
152=0
153=1
154=0
18.08.2014 11:40
Visit this user's website Find all posts by this user Quote this message in a reply
Valery Offline

Posts: 2196
Post: #2890

bes, and how to make writable options into ini file, is possible?

For example player can set in ini file if script will run:

[player options]
Remove relics: 0 (will not) / 1 (will do)

Or must be like this?

[player options]
;remove relics 0/no, 1/yes
0=0
(This post was last modified: 19.08.2014 02:17 by Valery.)
19.08.2014 02:15
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16734
Post: #2891

Code:
[player options]
Remove relics=1

era.dll
function ReadStrFromIni (Key, SectionName, FilePath, Res: pchar): boolean; stdcall;
function WriteStrToIni (Key, Value, SectionName, FilePath: pchar): boolean; stdcall;
  1. !!SN:L^era.dll^/?y1 Ay1/^ReadStrFromIni^/?y2 Ay1/^WriteStrToIni^/?y3;
  2. ; y2 - reading func, y3 - writing func
  3. !!SN:Ey2/1/^remove relics^/^player options^/^Data\val_settings.ini^/?z2;
  4. ; v1 <> 0 on success and z2 will be "1"
  5. !!SN:Ey3/1/^bers age^/^24^/^player options^/^Data\val_settings.ini^;
Just don't forget that writable ini should be placed in real Data/Maps/etc folder, not in mods one. If you are planning to use ini only for reading then you can place it in Mods\ModName folder.


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

Posts: 5459
Post: #2892

Code:
[Player options]
;remove relics 0/no, 1/yes
77=0

  1. !!VRy1:S1; remove relics 0/no, 1/yes
  2. !!UN:J9/1/-3; Data path
  3. !!VRz-3:+^val_settings.ini^;
  4. !!VRz-2:S^Player options^; set target section from ini
  5. !!VRz-1:S^77^; set relicts option
  6. !!UN:N5/z-1/y1/-2/-3; write value


имхо, нет нужды вводить текстовые параметры в секциях (в частном случае), ибо и числовыми вполне можно обозначить всё что угодно... тем более запись в ini через UN:N5 короче в плане кода, чем через ERA-команды
19.08.2014 13:18
Visit this user's website Find all posts by this user Quote this message in a reply
Valery Offline

Posts: 2196
Post: #2893

Ok, made my first ini and is working. But as I have no clue how it works, I must ask: is there anything more to add? On reload game, on instructions, PI? Is this OK?
if I use same word more than once in ini, will the code read the correct one?

Ini file
Code:
[Player settings]

;The pillars will replace the objects listed below. Change values between 0 and 10 to set your custom replacement ratio for each object. (0=none, 10=maximum)

Den of Thieves=10
Learning Stones=10
Creature Banks=0
Crypts=0
Schools of Magic=0
Creature Generators=10
Taverns=10
Obelisks=3
Prisons=10

;The following value will automatically activate/deactivate (0/OFF, 1/ON) the watcher for all the game length. The watcher allows to the player to know what the other pillars offer.
;The premonition lasts 7 days. If option is off, the player will have to find the watcher by his own. Default value is off.

Watcher=1

Script:
  1. !?FU33465124;
  2. ;set options from ini to v1-v10
  3. !!VRvx16:Vzx16;
  4. !#SN:L^era.dll^/?y1 Ay1/^ReadStrFromIni^/?y2;
  5. ;
  6. !#SN:Ey2/1/^Den of Thieves^/^Player settings^/^\Pillars.ini^/?z1;
  7. !#SN:Ey2/1/^Learning Stones^/^Player settings^/^\Pillars.ini^/?z2;
  8. !#SN:Ey2/1/^Creature Banks^/^Player settings^/^\Pillars.ini^/?z3;
  9. !#SN:Ey2/1/^Crypts^/^Player settings^/^\Pillars.ini^/?z4;
  10. !#SN:Ey2/1/^Schools of Magic^/^Player settings^/^\Pillars.ini^/?z5;
  11. !#SN:Ey2/1/^Creature Generators^/^Player settings^/^\Pillars.ini^/?z6;
  12. !#SN:Ey2/1/^Taverns^/^Player settings^/^\Pillars.ini^/?z7;
  13. !#SN:Ey2/1/^Obelisks^/^Player settings^/^\Pillars.ini^/?z8;
  14. !#SN:Ey2/1/^Prisons^/^Player settings^/^\Pillars.ini^/?z9;
  15. !#SN:Ey2/1/^Watcher^/^Player settings^/^\Pillars.ini^/?z10;
  16. !#DO33465124/1/10/1:P;
  17. ;now set the replacement percentage
  18. !#SN:W^R97percentage^/v1; den of thieves
  19. !#SN:W^R100percentage^/v2; learning stones
  20. !#SN:W^R16percentage^/v3; creature banks
  21. !#SN:W^R85percentage^/v4; Crypts
  22. !#SN:W^R47percentage^/v5; Schools of magic
  23. !#SN:W^R17percentage^/v6; Creature generators
  24. !#SN:W^R95percentage^/v7; Taverns
  25. !#SN:W^R57percentage^/v8; Obelisks
  26. !#SN:W^R62percentage^/v9; Prisons
  27. !#VRv10&v10=1:S7;
  28. !#SN:W^R99counter^/v10; Watcher


Once the ini made, I had to delete the previous erm code which went through each option. Economized 300 script lines!
(This post was last modified: 20.08.2014 00:40 by Valery.)
19.08.2014 21:30
Find all posts by this user Quote this message in a reply
Berserker Offline
Administrators

Posts: 16734
Post: #2894

Don't use v1 if you can.
\Pillars.ini => Pillars.ini

It's enough.


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

Posts: 2196
Post: #2895

Ok for v1. Without the slash, the ini file isn't found if in Mod folder. I don't want it in data folder, for easier location, players are lazy..
20.08.2014 00:56
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-2025 MyBB Group