Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 3.5 - WoG and Beyond > Thread: ERM help and discussion
Thread: ERM help and discussion This Popular Thread is 407 pages long: 1 50 100 150 ... 171 172 173 174 175 ... 200 250 300 350 400 407 · «PREV / NEXT»
Felipe
Felipe


Known Hero
Editing Heroes Without Limits
posted December 10, 2012 03:08 AM

Placing creatures

I am trying to place creatures. I used:

!?PI;
!!UN:I0/0/0/54/0; [Place pikeman at coordinates 0/0/0]

But the game crashes
When I use:
!?PI;
!!UN:I0/0/0/100/0; [Place learning stone]

It works correctly, but I don't want learning stones. I want creatures.
Why it doesn`t work?

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
djkiwi
djkiwi


Hired Hero
posted December 10, 2012 04:52 AM

Quote:
!!UN:A#/$/#1/#2 {/#3/#4/#5/#6/#7/#8/#9/#10/#11/#12/#13/#14};
EDIT Ok i got it now!
!!UN:A13/Artifact-to-combine-to/artifacts-to-combine/2/3;

Now how do i create a new artifact to combine them to, if i try putting them on 171 it doesnt work because its out of range..

Eg if i want to combine Stoic Watchmen, Bird of Perception, And Emblem of Cogniance it will combine Emblem and Bird to Stoic instead of those 3 to a 4th one.. how do i create a new artifact with its own stats, description, name, attributes and skils to use as the 1st number??

that and how do i make an item when equipped give all his monsters an additional strike (and take it away when unequipped)
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 10, 2012 05:54 AM
Edited by JimV at 06:15, 10 Dec 2012.

I like to work on interesting ERM problems, but I am afraid my patience for repeating things which are already in ERM Help is just about gone - as proved by these replies:

Artu - it is true that I have been using ERM for several years now, and know much more than when I started, but as a beginner my recourse when I made an error was to go back to ERM Help and search it for answers. I have never asked anyone else to do my ERM research for me on this or any other forum. It is also true that ERM is not my first or second computer language, however, and that is an advantage.

Felipe - placing a group of Pikemen on an empty tile at 0/0/0 does not cause a crash on my system, so your problem is not in the command itself and you must look elsewhere. Note that after placing creatures on the map, you should set up their properties.  I use MO for this.  Example (from "Stargate Atlantis"):

!!UN:I118/120/1/54/129; put 40 savage EEs @ 118/120/1
!!MO118/120/1:G40 R10/1 U1;

My test program for the Pikeman placement:

ZVSE

* TestPlacePM000, JHV, Dec. 9, 2012

!?CM0; check for Sleep/Wake button
!!CM:I?y1;
!!FU&y1<>6:E; exit if not RMB on Sleep/Wake
!!CM:R0;
!!UN:I0/0/0/54/0;

P.S. See my comment third from the top on page 171 about the three ways of setting up map features at the start of the game.

djkiwi - you can either use the "blank" WoG artifacts or use OxFea's emerald plugin (see his recent post) to add new artifact numbers beyond those.  See the ERM Help MA:X (and BM:F) receiver for adding double strike (note if a creature already has double strike you cannot give it triple strike except by equipping the Barbarian Lord's Axe of Ferocity and then only to melee fighters, not shooters).  See "80 wog - jv scripts.erm" for an example of adding combat abilities if an artifact is equipped.  You should probably read all of ERM Help and practice on the tutorial scripts before attempting something that advanced, but that is up to you.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Siegfried
Siegfried


Famous Hero
posted December 10, 2012 09:01 AM

Quote:
I like to work on interesting ERM problems, but I am afraid my patience for repeating things which are already in ERM Help is just about gone - as proved by these replies:



I can very well understand you. But you can not expect anyone to be like you. I think you are some kind of software developer (like me), so you naturally have a much different approach to resolving programming problems than any non-programmer. So please be patient :)

You are right, most of these questions can be answered by looking into the erm help. That is easy if you know for what you have to search for. If you do not have an idea it is difficult. Then the erm help may be easy understandable by you, maybe not by others. Just take these aspects into account.

So my suggestion here would be, if you find questions like this, try to answer regarding these aspects. Like "look in erm help under Instructions - HE:B0" (for example). If then someone does not understand the help there you (or anyone else) may give additional help. This shortens your involvement and may help train a beginner to find his way.

Something similar is true for questions which could be answered by reading or searching the forum. Here it would be useful if the answer either contains the search keys or the links to the answer pages. Those questions do not have to be answered again and again. But directing someone to where the answer may be found will be necessary as long as WoG exists :)

There is, i think, a Chinese saying: "give a man a fish and you help him for one day. Teach him to fish and you will help him for the rest of his life". Maybe it's similar here: "Give someone an answer and you help him for the next few minutes. Teach him to read and understand erm help and you help him much much longer".

Generally we all appreciate your work here, your help and knowledge. And i know, doing the same things again and again is boring. Just be patient. This is not at all meant as an offense. Just relax and accept that there are non-programmers who want to do modding too. I personally am very thankful for every single bit of help.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 10, 2012 09:34 AM
Edited by Salamandre at 10:26, 10 Dec 2012.

JimV advice to read all erm help is the only solution, because even simple scripts require multiple receivers thus often there is no "look here". Now I agree that hints should be done when is possible and identify the one day scripter request from the dedicated fan, to save time and energy. While erm is not so hard to understand-up to some point-, it still requires a LOT of time to spend and not everything will work as in manual. Some will be discouraged, others will keep trying if they have a strong idea behind.

An example of why Artu should read first:

From erm help, triggers column
!?PI

Post Instruction.
This trigger works out a bit later than instruction are executed but after the majority of settings are done for the map.
The other specific thing here is that this trigger works out ONLY if you start a new game but not if you load a saved game (so the same way as instructions do).
Example:

ZVSE

!#IF:M^Instr^;
!?PI;
!!IF:M^Post Instr^;

If you start this map, you will have two messages: "Instr" and then "Post Instr". When the first message appears, almost no settings are done for the map and when the second message appears, the most settings are done already. If you load a saved game, you will have no messages at all.


Quote:

i wrote this:
!?PI;
!!HE139:B2/16;
!#HE139:X1/118;                      
!#HE139:A3/1000/1/1;
!#HE139:S23/1;
!#HE139:S17/0;
!#HE139:F2/1/1/1;
!#VRz739:S^Increases the Attack and Defense skills of any Pixies or Sprites
for each level attained after first level.^;
!#UN:G2/139/1/224;
!#UN:G2/139/2/z739;


As you see, you mix instructions (!#) with post instructions (PI)
The game will process first instructions, then  post instructions, then timers. Instructions do not need a trigger (!?), while post instructions need it. While in your example there is no harm, it could be in others if you don't get the mechanics.

The correct is:

ZVSE

*Instructions, are processed first
!#HE139:X1/118;                      
!#HE139:A3/1000/1/1;
!#HE139:S23/1;
!#HE139:S17/0;
!#HE139:F2/1/1/1;
!#VRz739:S^Increases the Attack and Defense skills of any Pixies or Sprites
for each level attained after first level.^;
!#UN:G2/139/1/224;
!#UN:G2/139/2/z739;

Now post instructions
!?PI;
!!HE139:B2/16;


Note: I am a total noob in computers language which means erm is approachable by anyone with a bit of patience.

____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
djkiwi
djkiwi


Hired Hero
posted December 10, 2012 01:27 PM

Thank you all very much, i see what you're saying.
Im a webdeveloper so my approach was use code snippets to start to understand this language like i do with every language. But now i see thats not an option and i have to dive in deep.

With the awesomeness of the map i made, i cant but learn erm and make it awesome beyond what i could've imagined in the first place. Tyvm for poiting me in the right direction
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Siegfried
Siegfried


Famous Hero
posted December 10, 2012 01:40 PM bonus applied by Corribus on 29 Dec 2012.

I think, here we have one of the basic misunderstandings of erm. Generally in computer languages we have a construct called block. this looks like:

here_we_start
{
  do_something
  do_more
  do_even_more
}

So the instruction time is identified by its position within the block, which itself is identified by its starter, the opening tag (here just '{') and the end tag (here just '}').

This is different in erm. In erm we do have only a minimal block building. Any block starts with any trigger. A trigger is identified by its starting sequence '!?' or sometimes '!$'. So anything starting with this starts its own block. But: Any lines starting with '!#' always belong to their own block, regardless of their position in the code. This is different from other computer languages and has to be understood before you begin to do some real erm coding.

"Mixing" the '!!' and '!#' instruction do not really mix them. This mixing is only visually. The erm interpreter does not mix them. Perhaps for understanding it may be useful to imagine this:

First, the erm interpreter gets through all erm files and collects all lines starting with '!#'. This builds the first code block. This code is executed first. Then the interpreter gets through all erm files again and collects all lines not beginning with '!#'. This builds the second code. Here nothing is executed.

This is somewhat simplified, but may be enough for the first understanding. For simplicity i've left out any comment handling.

Now the map is built and (mostly) set up.

Now the erm interpreter comes again: It generates its first trigger: !?PI. After the map being built anything in erm is about generating triggers. Nothing else exists. For any trigger, which is generated by the erm interpreter, there may be some code. This is somewhat similar to the event handling in f.ex. JavaScript. If you have a handler code, it is executed, when the event occurs. Erm triggers are like events.

Moreover, any code starting with the matching evant handler (called trigger in erm language) is executed. They are all concatenated and executed one after the other. So if you have let's say 100 event handlers of type !?BA0, which is start of battle event, all 100 of them are executed, one after the other.

I'm mixing up here the terms "trigger" and "event", because they are basically the same.

Maybe this concept should be understood first by newbies

And now for the advanced:

In modern programming frameworks we have a concept that lets us stop events bubbling through all event handlers. This we do not have in erm. Any event always bubbles through all event handlers. So if you need some marker to let an event handler do nothing you have to deal with that marker yourself, For example you could set some variable for it.

And here comes the complicated part: Variable scoping. This is the "experts" part

We have a quite large set of global variables. These are available at any time. But they are global, and so shared between all event handlers. All the vXXX variables are such global variables.

Next we have trigger local variables. They are local for every trigger (event). But: If you have your 100 !?BA0 event handlers, they all share this same set of trigger local variables. All the event handlers are executed one after the other, but they share their trigger local variables. These are the y-XXX variables.

Last we have function local variables. These are the yXXX variables. They are generated at start of a function and destroyed after the function ends. I'm not really sure about this here, but if you have 2 functions with the same number, they are executed one after the other, but they do not share their function local variables (this needs some more investigation though).

A common typo here is to use some y-XXX variables within a function. These are not function local, but trigger local. So if you do so, you modify the variable possibly used elsewhere in that trigger. If you f.ex. set such a variable in the trigger like:

!?BA0;
!!VRy-1:S0
!!FU100;

and then alter that variable in FU100:

!?FU100;
!!VRy-1:S1;

Then after returning to the trigger, y-1 has the new value of 1. This is why you have to be very careful with variable scoping. If you know what you're doing this can be very useful. If not, this can be very harmful.

Functions are event handlers (triggers) like any other, too. The difference is just that the erm interpreter never generates FU events. You have to generate them by yourself (by "calling" a function). And here comes the next what needs further investigation: Du functions have their own y-XXX trigger local variables? They would be shared by functions with the same number but not with other triggers.

Interestingly (and consequently) the '!#' instructions do run within their own implicit trigger, so they f.ex. do have their own set of yXXX variables.

I know this is hard to read and to understand. But once you get it erm scripting becomes much easier and much more logical. And if some of the experts here (Salamandre, JimV) have any corrections and/or additions), ...

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
OxFEA
OxFEA


Promising
Famous Hero
feanor on DF2.ru
posted December 10, 2012 01:49 PM

Quote:
Functions are event handlers (triggers) like any other, too.

And triggers are functions, too. Any trigger can be processed with !?FU receiver with 30000+ ID.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 10, 2012 01:53 PM

Siegfried, when I say he mixes instructions with receivers I only wanted to point he does not understand yet how it works. As I said in his example there was no harm caused. But for him, it is better to understand and not mix them (visually or not).
____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 10, 2012 02:50 PM

I feel sorry for causing hurt feelings with impatient replies.  The preceeding comments contain a lot of good and useful advice.  If only they were written down all in one place, with examples and tutorials and HTML links ... oh, wait.  Sorry again, I couldn't help myself. And I exaggerate - OxFea's comment is not currently in ERM Help.  Also, no doubt repetition of what is in ERM Help here in different words may be useful to some.

I am not a software developer, just a broken-down turbine engineer.  Also, when links are obscure (i.e., not in the "Links" sticky thread) and I know them or can find them quickly I post them, otherwise I feel it should be the job of the inquirer to track them down, not mine - just as I feel it should be the job of beginning ERM scripters to read ERM Help for themselves.  Maybe the reason for this is that I am old enough to remember the days when, if you wanted to use a new computer program, you had to read the manual, as there was no interactive Help or easy interface.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Siegfried
Siegfried


Famous Hero
posted December 10, 2012 03:58 PM

Quote:

And triggers are functions, too. Any trigger can be processed with !?FU receiver with 30000+ ID.

True for ERA, false for plain WoG

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Siegfried
Siegfried


Famous Hero
posted December 10, 2012 04:04 PM

Quote:
Siegfried, when I say he mixes instructions with receivers I only wanted to point he does not understand yet how it works. As I said in his example there was no harm caused. But for him, it is better to understand and not mix them (visually or not).

It was not meant as criticism, just wanted to point out some basic concepts which should be understood before doing more than trivial erm scripting. Maybe it's too much, i don't know. I was always used to ask "why" for every- and anything. So here my question would be "why not mix?".

O.k., and now back to work  

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Salamandre
Salamandre


Admirable
Omnipresent Hero
Wog refugee
posted December 10, 2012 04:14 PM

The order of scripts must be user friendly. You can mix but then for you and for other modders will be hard to read. People sent me in the past scripts to review and my first complaint was the havoc in the order (which I associate to ignorance). It is painful to search for receivers in instructions, then PI in middle of instructions, see instructions in middle of a function etc.
____________
Era II mods and utilities

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 10, 2012 04:16 PM

Quote:
Quote:

And triggers are functions, too. Any trigger can be processed with !?FU receiver with 30000+ ID.

True for ERA, false for plain WoG


True for WoG (used in the "Dress Code" script which works in "The Dragon Slaughter" under WoG 3.58f).

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Siegfried
Siegfried


Famous Hero
posted December 10, 2012 05:51 PM

Quote:

True for WoG (used in the "Dress Code" script which works in "The Dragon Slaughter" under WoG 3.58f).

That is interesting. Didn't know that. Good to know.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Honorable
Supreme Hero
posted December 10, 2012 05:51 PM

In 3.58f there is a check, not allowing function with ID > 30000.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 10, 2012 06:41 PM
Edited by JimV at 19:01, 10 Dec 2012.

Here is my use in "Dress Code":

!!VRy6:Sy3*-1; y6=negative of artifact number y3
!!HEv505:Ay6; remove all artifact y3's
* HE:A- does not call AE0, so do so manually via FU30315 (thanx Solitaire345)
!!UN:Cv504/4/y3; (set v998 with artifact number)
!!DO30315/1/y5/1:P; (y5 = number of equipped y3 artifacts)

I have used "Dress Code" in "Before the Rings III", "The Dragon Slaughter", and several other WoG 3.58f maps.  These maps have custom-scripted artifacts (such as the WoG Artifact Boost), so it is necessary to call AE0 manually to get their effects removed when removing artifacts via HE:A-.

I credit Sol because his post here in this thread was the first time I saw it, although it might have been common knowledge on Russian forums.

I recall testing this with custom artifacts and verifying that it worked.  However, in light of The Bersy Rule I had better test again.

Edit - I tested in my old WoG 3.58f folder (copied over from two previous laptops), using the following test script:

ZVSE

* TestCallAE0, JHV, Dec. 10, 2012

* get address for AE0(v998) argument
!#UN:V?v1/?v2; WoG/ERM versions
!#VRv504&v1=358:S41849532; address to set to v998 for WoG 3.58f
!#VRv504&v1>=359:S41916772; address to set to v998 for Era 1.8
!#IF&v1<358|v1>400:M^WoG version not recognized, Dress Code script may not work!^;


!?CM0; check for Sleep/Wake button
!!CM:I?y1;
!!FU&y1<>6:E; exit if not RMB on Sleep/Wake
!!CM:R0;
!!UN:Cv504/4/0;
!!FU30315:P;

!?AE0&1000;
!!IF:M^Artifact %V998 removed.^;

Result:  I get the IF:M message when I right-click the Sleep/Wake Hero button. So !!FU30315 triggers AE0 under WoG 3.58f. (The tricky part was finding a way to set v998 - VRv998 prior to the call does not work and using x1 or x2 to pass the value does not work - it appears the triggering changes v998 and resets the arguments.)

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Honorable
Supreme Hero
posted December 10, 2012 07:24 PM

Seems that Slava missed check for function call, but I was talking about processing ( not calling) trigger, which is obviously !?FU instead of !?AE.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
JimV
JimV


Responsible
Supreme Hero
posted December 10, 2012 09:33 PM
Edited by JimV at 21:43, 10 Dec 2012.

I assumed that was the case, as otherwise The Bersy Rule would have been violated, but we were talking about using function calls to activate triggers, not creating new functions.  Since this can be useful as in the example case, I prefer to believe that Slava allowed it deliberately.

Edit - sorry, I see OxFea did refer to !?FU, but I think he mispoke (or mis-typed) as I can see no benefit to using !?FU in place of !?AE0 and a big penalty as scripters could unknowingly interfere with triggers if WoG allowed !?FU numbers in that range. I assumed he meant the ability to activate triggers via !!FU which is beneficial in some cases.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Bersy
Bersy


Honorable
Supreme Hero
posted December 11, 2012 05:21 PM

I didn't read the whole topic, just saw feanor's post, sorry.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This Popular Thread is 407 pages long: 1 50 100 150 ... 171 172 173 174 175 ... 200 250 300 350 400 407 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.5659 seconds