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 ... 126 127 128 129 130 ... 150 200 250 300 350 400 407 · «PREV / NEXT»
JimV
JimV


Responsible
Supreme Hero
posted January 07, 2012 04:41 AM

Maybe this is unnecessary, but I have uploaded a copy of the uncompiled documents here (Era 1.93 Manual - English translation):

http://www.box.com/s/ebc16p3lujk35zv6ur38

(Same site as the Phoenix Mod translation, done previously.)

The manual is not final yet, as far as I know.  I just emailed it to Bersy yesterday, and revisions may be needed - so this might be a good time to look at it and make suggestions.  Also, with the uncompiled documents, people can make their own revisions and additions.

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


Admirable
Omnipresent Hero
Wog refugee
posted January 07, 2012 05:56 AM

Thank you, got it.

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


Honorable
Supreme Hero
posted January 07, 2012 10:58 AM

I was not sure to answer Jim's great letter while Salamandre cannot even open compiled variant.

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


Admirable
Omnipresent Hero
Wog refugee
posted January 07, 2012 05:10 PM

Is there any fix for moving stacks greater than 32767 in hero screen?
I can move them only with slide bar, or they vanish...

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


Responsible
Supreme Hero
posted January 07, 2012 06:35 PM

If you only want to move the stack (not split or combine it), then an ERM script could be used to disable the standard function and replace it using HE:C commands.  It might be possible to do something similar for splitting or combining, but that would be more complicated, and the price would be doubled.

A binary patch to the program code would be a more ideal solution, of course.

Incidentally, if I understand correctly that a stack of greater than 32677 will disappear if moved from one slot to another in the Hero Screen, then this is a new issue in Era.  I just moved 83,000 of The Doctor's Storm Elementals from one slot to another in TDS.

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


Admirable
Omnipresent Hero
Wog refugee
posted January 07, 2012 07:40 PM
Edited by Salamandre at 19:42, 07 Jan 2012.

I don,'t know, Bersy found some adress which stores the slot clicked but I don't know how to use it (!!UN:C6911880/4/?). So far all I can is to warn the player:

!?CM5;
!!CM:I?y1;
!!FU&y1<39/y1>43:E;  [open hero screen]
!!IF:V125/1;

!?CM2&125;
!!CM:I?y11 F?y12;
!!FU|y11<68/y11>73/y12<>0:E; exit if no slot clicked and left click
!!VRy11:-68; get slot ID
!!HE-1:C0/y11/?y12/?y13; get creature ID and quantity
!!IF&y12=49/y13>32000:M^Attention, stacks bigger than 32000 should be moved/split only using the slide bar!^;
!!IF:V125/0;

Will do same in town screen.

Alex Sp fixed map objects restrictions by patch, guess something similar could be done for stacks. Reading in exe is not my strength.

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


Responsible
Supreme Hero
posted January 07, 2012 08:47 PM
Edited by JimV at 20:59, 07 Jan 2012.

This works for me in WoG 3.58f.  (Under Era I could simplify it using the !!SN:Q command to exit CM2 trigger-processing in the second and third CM2 triggers, I think.)  It could be improved by adding your check for count>32677 in the third CM2 and exiting when the normal process is safe.

Note:  I tested without wogification (as I normally do), so there might be WoG scripts which conflict with this in some way - if so, the interference could be fixed, at extra cost.

The script switches the contents of two troop slots.  Either slot could have troops or be empty.


ZVSE

* troop slot mover, JHV, Jan. 7, 2011

* uses unclaimed flags 452-453 and v3411-v3414

!#IF:V452/0 V453/0;

!?CM2&453; click on Hero screen [CM2&453 must be before CM2&452]
!!IF:V453/0; re-enable third CM2

!?CM2&452; click on Hero screen [CM2&452 must be before CM2&-453]
!!CM:R0; no clicks will be responded to until move finished
!!CM:F?v1 I?v2; get flag and clicked object values
!!FU|v1<>0/v2<68/v2>74:E; exit if not left-click or not creature slot
!!IF:M^First slot will be switched with this slot.^;
!!VRv2:-68; now v2=slot # from 0 to 6
!!HE-1:C0/v2/?y1/?y2/?y3/2; y1=type, y2=number, y3=experience
!!HE-1:C0/v3414/y1/y2/y3/2; move second slot to first
!!HE-1:C0/v2/v3411/v3412/v3413/2; move first slot to second
!!IF:V452/0 V453/1; enable first CM2, disable second and third CM2
!!UN:R3/-1; redraw Hero Screen

!?CM2&-453; click on Hero screen
!!CM:F?v1 I?v3414; get flag and clicked object values
!!FU|v1<>0/v3414<68/v3414>74:E; exit if not left-click or not creature slot
!!IF:M^Select Slot to be switched with this slot (LMB).^;
!!VRv3414:-68; now v3414=slot # from 0 to 6
!!HE-1:C0/v3414/?v3411/?v3412/?v3413/2; v3411=type, v3412=no., v3413=experience
!!IF:V452/1; set flag for next click to be handled by second CM2
!!CM:R0;

Edit--changed LC for Left-Click in comment above to LMB for Left Mouse Button.

Re-edit--it just occurred to that this interferes with the ability to double-click a slot to get to the experience screen.  So it needs more work:  a test to see if the same slot is clicked twice instead of two different slots, before doing the switch.  This might require the use of my favorite new trigger, TL0, under Era, at triple the cost.

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


Honorable
Supreme Hero
posted January 07, 2012 09:31 PM

!!UN:C6911880/4/[]
Selected slot id (-1..6), yellow border.

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


Responsible
Supreme Hero
posted January 07, 2012 09:51 PM

Thanks again to Bersy, for the information and not making this a triple edit.

I was going to add another edit to my last comment, to say that a double Ctrl-Left-Click will bring up the Creature Screen, with the above script in effect.  That is, the Heroes program treats a Ctrl-click the same as a regular click in the Heroes Screen, but the above script does not respond to a Ctrl-click.  (Although there are custom scripts in TDS which do respond to a Ctrl-click on a Troop Slot in the Heroes Screen.)

The script could be further improved by high-lighting the selected troop slots, using Bersy's information.

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


Admirable
Omnipresent Hero
Wog refugee
posted January 07, 2012 09:52 PM

Thanks, I added the check for quantity but it does not want to really exit if no slots was clicked in CM&452. If we click for example to tactics icon instead of troop slot, then on troop slot, it will clone the stack.

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


Responsible
Supreme Hero
posted January 07, 2012 10:18 PM
Edited by JimV at 22:19, 07 Jan 2012.

Sorry, I will refund your payment.

The critical thing in doing scripts like this is understanding what I call "program flow" - that is, knowing where the program will go next, to execute script commands.

ZVSE

* troop slot mover, JHV, Jan. 7, 2011

*** Note: use Ctrl-Left-Click for normal slot functions

* uses unclaimed flags 452-454 and v3411-v3414

!#IF:V452/0 V453/0 V454/0;

!?CM2&453; click on Hero screen [CM2&453 must be before CM2&452]
!!IF:V453/0 V454/0; re-enable third CM2

!?CM2&452; click on Hero screen [CM2&452 must be before CM2&-454]
!!CM:R0; no clicks will be responded to until move finished
!!CM:F?v1 I?v2; get flag and clicked object values
!!FU|v1<>0/v2<68/v2>74:E; exit if not left-click or not creature slot
!!IF:M^First slot will be switched with this slot.^;
!!VRv2:-68; now v2=slot # from 0 to 6
!!HE-1:C0/v2/?y1/?y2/?y3/2; y1=type, y2=number, y3=experience
!!HE-1:C0/v3414/y1/y2/y3/2; move second slot to first
!!HE-1:C0/v2/v3411/v3412/v3413/2; move first slot to second
!!IF:V452/0 V453/1; enable first CM2, disable second CM2
!!UN:R3/-1; redraw Hero Screen

!?CM2&-454; click on Hero screen
!!CM:F?v1 I?v3414; get flag and clicked object values
!!FU|v1<>0/v3414<68/v3414>74:E; exit if not left-click or not creature slot
!!IF:M^Select Slot to be switched with this slot (LMB).^;
!!VRv3414:-68; now v3414=slot # from 0 to 6
!!HE-1:C0/v3414/?v3411/?v3412/?v3413/2; v3411=type, v3412=no., v3413=experience
!!IF:V452/1 V454/1; set flag for next click to be handled by second CM2
!!CM:R0;

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


Admirable
Omnipresent Hero
Wog refugee
posted January 07, 2012 10:44 PM
Edited by Salamandre at 23:09, 07 Jan 2012.

I will test it asap. Now, I am having weird issues with the other script, which controls negative experience. In all TDS games when adding or moving high quantities of troops, experience went negative, so was easy to fix. But now, in my map test, after a certain game delay, or regardless a specific number, when adding troops, experience get back from ACE to <>1000, so script will not work. I have to play with numbers until I get negative experience.

In don't know how the bug is misscalculated but for example:



Adding the demons together will create a stack with 1382 exp. With each demon removing, the exp result is lowered by 1-2. So I have no way to add the 600 demons to the big stack and get lower than 0 and no way to keep ACE. Have to wait next week and get a bigger join stack. Or just cheat, and it is exactly what I will do.

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


Responsible
Supreme Hero
posted January 08, 2012 12:20 AM

From the description of the latest Negative Experience script (Creature Experience Overflow script), which is given in a post dated December 15:

"... Also, before trying to split a troop which has too much experience to split without overflow, right-clicking the troop slot will give it -100 experience (only if its total experience is over the limit of 2.147 billion), so that it can be split and then the split troops can be restored by right-clicking."

However, this will not work for your example:

If you right-click the slot of 44002 Demons (whose total experience is about 44002*98000 = 4.312 billion, which is greater than the biggest 4-byte integer of (2^31)-1 = 2.147 billion) (I am using the USA billion = 10^9), this will convert their experience to -100 per creature, or a total of 44002*(-100) = -4,400,200.

The other slot has a total experience of about 607*98000 = 59,486,000, so adding the two together will still give a positive experience.

For that case you would need to revise the script, to use -2000 instead of -100.

Then stack one, after being right-clicked, would have a total of 44002*(-2000) = -88,004,000, so adding the two together would produce a negative experience, and then right-clicking the combined slot would convert the negative experience to level 10.

Of course, if you had a slot with over one million troops, -2000 would be too big (in absolute value) because it would overflow from negative to positive in the total experience.  I wanted to avoid that possibility in my initial choice of the -100 value, but I see now that -2000 will handle more cases of your kind - or -4000 if you do not expect stack size to exceed 500,000.  Whatever amount of negative experience (for the right-click function) is used, there will be some cases which it can not handle.  A more complete version of the slot-moving script from my previous comment, which could handle splits and combinations, could handle anything, but might be more cumbersome for the user - as the above script is.

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


Admirable
Omnipresent Hero
Wog refugee
posted January 08, 2012 12:44 AM
Edited by Salamandre at 00:54, 08 Jan 2012.

you mean this?

!?CM2; click on Hero screen
!!CM:F?v1 I?v2; get flag and clicked object values
!!FU|v1<>4/v2<68/v2>74:E; exit if not ctrl-left-click or not creature slot
!!VRv2:-68; now v2=slot # from 0 to 6
!!HE-1:C0/v2/d/?y2/?y3/2; y2=no., y3=experience
!!VRe-2:Sy2;
!!VRe-3:Sy3;
!!VRe-1:Se-2*e-3:1024;
!!VRv1:Se-1;
!!FU&v1<2097152:E;
!!HE-1:C0/v2/d/d/-100/2; set exp negative so it can be restored after a split **change -100 to -2000 will do the trick? It says only split, what about combine?
!!CM:R0;

To note that I do not expect stack of demons bigger than 60k-70k maximum, I did maximum farming. All other stacks will stay below 6000.

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


Responsible
Supreme Hero
posted January 08, 2012 01:15 AM
Edited by JimV at 01:30, 08 Jan 2012.

I am getting very slow-witted in my old age*.  The solution with the existing script is of course to right-click both stacks, converting them both to -100 (per creature) experience, combine them into one stack, and then right-click that stack.  Under that scenario, you could combine two stacks of one million each, which you could not do with a -2000 value.  So the -100 is better overall, I think, although -2000 would allow one less step in your specific case.

I took a walk to think about a new script to combine or split stacks, perhaps with a special DL for it, under Era ... but then thought of the above.  To bad, a special DL would have been interesting to work on.

*(I also had a similar brain-glitch when discussing the UN:Q command recently - I should have noted that it hardly matters whether it is considered cheating or not when it is used to *lose* a game, as there is no score for a loser anyway.)

Edit--no, my second brain-glitch was the above, because right-clicking will not change the second stack to negative because it isn't big enough.  So yes, the change should be as you posted.  The -100 is good for combining two big stacks, not one big and one small.

P.S. I see that it is actually a Ctrl-left-click, not a right-click - brain-glitch number three.  I couldn't use a right-click (without some extra effort) since the other right-click function would interfere with it in that case.

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


Admirable
Omnipresent Hero
Wog refugee
posted January 08, 2012 01:51 AM
Edited by Salamandre at 01:53, 08 Jan 2012.

Maybe I will use an alternate "cheat" version to the script, which is flagged to trigger after player got any stack bigger than 30000, means after month 13-14. The script will replace the existing, and if clicked on demons, set them to ACE. Seems to me that a lot of clicks, set to negative both stacks, then re-click to set to positive would not be so easy to get for everybody. And what prevents the player to do this early game, if he has no gold to upgrade, thus cheat?  If experience could be gained from battle, I would not care much, but it can't and was tested that way. Thanks, now more clear for me.

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


Responsible
Supreme Hero
posted January 08, 2012 02:48 AM

The Creature Experience Overflow script was designed for conditions of creature experience gained through battles, as in TDS.  In general, scripts designed for one set of conditions may not work well under other conditions, and only the map-maker knows what conditions will apply, which is why I continually recommend that map-makers who wish to use ERM scripts learn how to script them for themselves, starting by reading all of ERM Help (which I know works because it is how I learned).  (I say this for the benefit of non-regulars, since regulars are only too well aware of my opinions.)

Here is a final (for today, anyway) version of the script to switch slots, without the IF:M messages.  It works for me both under WoG 4.58f and Era 1.8.  (It is of course only a sample to demonstrate feasibility.)

ZVSE

* troop slot mover, JHV, Jan. 7, 2011

*** Note: use Alt-left-click for standard left-click slot functions

* uses unclaimed flags 452-454 and v3411-v3414

!#IF:V452/0 V453/0 V453/0;

!?CM2&453; click on Hero screen [CM2&453 must be before CM2&452]
!!IF:V453/0 V454/0; re-enable third CM2

!?CM2&452; click on Hero screen [CM2&452 must be before CM2&-454]
!!CM:R0; no clicks will be responded to until move finished
!!CM:F?v1 I?v2 S?v3; get flag and clicked object values
!!FU|v1<>0/v2<68/v2>74/v3<>12:E; exit if not left-click push or not creature slot
*!IF:M^First slot will be switched with this slot.^;
!!VRv2:-68; now v2=slot # from 0 to 6
!!HE-1:C0/v2/?y1/?y2/?y3/2; y1=type, y2=number, y3=experience
!!HE-1:C0/v3414/y1/y2/y3/2; move second slot to first
!!HE-1:C0/v2/v3411/v3412/v3413/2; move first slot to second
!!IF:V452/0 V453/1; enable first CM2, disable second CM2
!!UN:R3/-1; redraw Hero Screen

!?CM2&-454; click on Hero screen
!!CM:F?v1 I?v3414 S?v3; get flag and clicked object values
!!FU|v1<>0/v3414<68/v3414>74/v3<>12:E; exit if not left-click push or not creature slot
*!IF:M^Select Slot to be switched with this slot (LMB).^;
!!VRv3414:-68; now v3414=slot # from 0 to 6
!!HE-1:C0/v3414/?v3411/?v3412/?v3413/2; v3411=type, v3412=no., v3413=experience
!!IF:V452/1 V454/1; set flag for next click to be handled by second CM2
!!CM:R0;

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


Responsible
Supreme Hero
posted January 08, 2012 04:00 AM

If I understand correctly, there is no experience gained in battles in your map, and experience is purchased or earned some other way or ways.

If that is the case, I think the easiest way to eliminate all experience-overflow problems is to scale back the level values by a factor of about 100, using:

EA:L$;  Set/get an experience scale and limit.
 This sets the stack experience needed for a creature to reach rank 10, and from this number the experience needed for each rank up to 10 is also derived and automatically calculated by the game (as a percentage of this total).
Example:
********
!!EA141:L30000; [Set rank 10 experience for Mummies to 30000 points]

For example, set Horned Demons to 980 for level 10, rather than 98,000.  Then 44022*980 = 43 million, well below the overflow value of 2.174 billion.  There should be no need for any experience-checking script at all.

The levels could be reset by getting the standard values and dividing them by 100 in a DO-function (x16=creature type), called in an instruction (!#) at the start of a game.

Any scripts which use specific values of experience points (e.g., buying experience points at a training object) would have to be modified accordingly.  Scripts which work with level values (0-10) instead of experience points would not have to be changed.

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


Admirable
Omnipresent Hero
Wog refugee
posted January 08, 2012 04:19 AM

Very good idea, thanks.

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


Honorable
Supreme Hero
posted January 08, 2012 09:43 PM

http://pastebin.com/LwsAMK3n
No exp/quantity problem while moving/joining/exchanging stacks in hero screen. All actions are done through ERM, exp is calculated using floating point variables.

!?CM2;
!!CM:I?y1 F?y2 S?y5;
!!FU|y2<>0/y5<>12/y1<68/y1>74:E; exit if not LMB or not slots

!!UN:C6911880/4/?y3; y3 - source slot
!!VRy4:Sy1-68; y4 - destination slot
!!FU|y3=y4/y3=-1:E; exit if same slot or no selection

!!CM:R0;

!!HE-1:C0/y3/?y10/?y11/?y12 C0/y4/?y20/?y21/?y22;
!!EX-1/y3:R?y13/?y14/?y15/?y16;
!!EX-1/y4:R?y23/?y24/?y25/?y26;

; y10..y16 - source info
; y20..y26 - destination info

!!if&y20=-1:; if no destination stack
 ; no exp and quantity
 !!VRy21:S0;
 !!VRy22:S0;
!!en:;

!!if&y10=y20:; join operation
 !!VRy21:+y11;

 ; fix all exp bugs
 !!VRe1:Sy11*y12; e1 - source stack exp
 !!VRe2:Sy21*y22; e2 - destination stack exp
 !!VRe2:+e1; e2 - joined stack exp
 !!VRe1:Sy11+y21; e1 - joined number of creatures
 !!VRe2::e1; e2 - resulting exp per creature
 !!VRe2&e2>1000000000:S1000000000; fix limit
 !!VRy22:Se2; convert float to integer

 ; combine artifacts:
 ; > artifacts present?
 !!VRy23:+y13;
 !!VRy23&y23>0:S1;

 ; > number of arts
 !!VRy26:*y23; 0 arts if no arts
 !!VRy16:*y13;
 !!VRy26:+y16;

 ; > artifact number
 !!VRy24&y23=0:Sy14;

 ; > option
 !!VRy25&y13=1/y23=0:Sy15;

 ; assign destination and erase source
 !!HE-1:C0/y3/-1/0/0/2 C0/y4/y20/y21/y22/2;
 !!EX-1/y3:Ry13/y14/y15/y16;
 !!EX-1/y4:Ry23/y24/y25/y26;
!!el:; move operation
 !!HE-1:C0/y3/y20/y21/y22/2 C0/y4/y10/y11/y12/2;
 !!EX-1/y3:Ry23/y24/y25/y26;
 !!EX-1/y4:Ry13/y14/y15/y16;
!!en:;

!!UN:C6911880/4/-1; disable selection
!!UN:R3/-1;

 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 ... 126 127 128 129 130 ... 150 200 250 300 350 400 407 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.7693 seconds