~ Forums of Enroth ~
Would you like to react to this message? Create an account in a few clicks or log in to continue.

~ Forums of Enroth ~

The Enroth diehard fan community
 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  
Latest topics
» Songs of Silence (HoMM like game)
Advanced Dialogue Boxes in Project Ironfist Icon_minitimeby Blake01 2024-03-27, 16:52

» Heroes Orchestra's 5th Birthday concerts with Paul Romero
Advanced Dialogue Boxes in Project Ironfist Icon_minitimeby rrravyn 2024-03-23, 22:45

» WARNING - The dreaded moment is here: Heroes 6 servers shutting down
Advanced Dialogue Boxes in Project Ironfist Icon_minitimeby Sir Albe 2024-03-22, 07:15

» fheroes2 General Announcements
Advanced Dialogue Boxes in Project Ironfist Icon_minitimeby sirDranik 2024-03-17, 23:35

» Photo Gallery
Advanced Dialogue Boxes in Project Ironfist Icon_minitimeby Sir Albe 2024-03-07, 06:57

» Polskie powitanie
Advanced Dialogue Boxes in Project Ironfist Icon_minitimeby rrravyn 2024-03-05, 04:02

» Heroes II localisation: how to make no-CD patch.
Advanced Dialogue Boxes in Project Ironfist Icon_minitimeby kiku 2024-02-19, 02:43

Poll
Global announcements should be:
Everlasting, 1 for each project.
Advanced Dialogue Boxes in Project Ironfist Redbar110%Advanced Dialogue Boxes in Project Ironfist Redbar12
 0% [ 0 ]
Temporary, when there is something new to announce.
Advanced Dialogue Boxes in Project Ironfist Redbar11100%Advanced Dialogue Boxes in Project Ironfist Redbar12
 100% [ 6 ]
Holalala... No idea where the Ultimate artifact is.
Advanced Dialogue Boxes in Project Ironfist Redbar110%Advanced Dialogue Boxes in Project Ironfist Redbar12
 0% [ 0 ]
Total Votes : 6
Most Viewed Topics
H3SW: General Graphics discussion
Ragoon's Graphics For HoMM3SW
Introduce yourself
H3SW General Discussion
H3SW Map List: Work in progress
H3SW: Dwelling Development
Forum Admins Feed
The Floody Land
Enrothian Fan Art
Heroes III: The Succession Wars v0.8.1 Beta

 

 Advanced Dialogue Boxes in Project Ironfist

Go down 
3 posters
AuthorMessage
DarkAtom
Pikeman
Pikeman
DarkAtom


Messages : 47
Quality Points : 6
Registration Date : 2018-02-27

Advanced Dialogue Boxes in Project Ironfist Empty
PostSubject: Advanced Dialogue Boxes in Project Ironfist   Advanced Dialogue Boxes in Project Ironfist Icon_minitime2018-07-03, 04:32

I wasn't able to find this information on the wiki, so I tried a lot of scripts (regarding the dialogue boxes) myself, and this is what I found:

The command described in the wiki is actually provided by the AdvMessageBox.lua module. But the actual command, without the module, is explained here:

Syntax:
AdvancedMessageBox(text, dialogtype, position1, position2, img1type, img1arg, img2type, img2arg, writeOr, a10)

text: A string or a variable that contains a string to be displayed
dialogtype: An integer (will be explained below)
position1 and position2: integers, but I still didn't fully discover them; for now, put -1 for both of them to get a centered window
imgtype and imgarg: The image parameters will be explained below.
writeOr: If you set this to DIALOG_OR (1) then an 'or' text will appear in the middle of the box, between the 2 pictures. If only one picture is used, the 'or' text is displayed on top of it. If anything else is passed for this parameter, the "or" will not be shown.
a10: As for the last parameter, I never found a use for it. Leave this set to 0, just to be safe.

Dialogue types:

  • 0 or anything below 0 (DIALOG_EMPTY): A window with no buttons, can't get rid of it
  • 1 (DIALOG_OKAY): A window with an OK button
  • 2 (DIALOG_YES_NO): A window with Yes/No buttons
  • 3: A window with a Cancel button
  • 4: A window with no buttons, can get rid of it by clicking anywhere (this is probably for right-clicks)
  • 5: Same as 1
  • 6: Same as 3
  • 7: A window with 2 'Learn' buttons (like in the level-up screen)
  • 8: A window with a 'Learn' button on the left and nothing on the right
  • 9 and above: Same as 0


Image types:

  • -1 (IMAGE_EMPTY): No image
  • 0 (IMAGE_WOOD): Wood
  • 1 (IMAGE_MERCURY): Mercury
  • 2 (IMAGE_ORE): Ore
  • 3 (IMAGE_SULFUR): Sulfur
  • 4 (IMAGE_CRYSTALS): Crystal
  • 5 (IMAGE_GEMS): Gems
  • 6 (IMAGE_GOLD): Gold
  • 7 (IMAGE_GROUP_ARTIFACTS): Artifact
  • 8 (IMAGE_GROUP_SPELLS): Spell
  • 9 (IMAGE_GROUP_PLAYERS): Player color
  • 10 (IMAGE_LUCK): Good Luck
  • 11 (IMAGE_BADLUCK): Bad Luck
  • 12 (IMAGE_GOOD_MORALE): Good Morale
  • 13 (IMAGE_BAD_MORALE): Bad Morale
  • 14 (IMAGE_EXP): Experience
  • 15 (IMAGE_GROUP_HERO): Hero Portrait
  • 16: Not used (if you use it, game will freeze/crash)
  • 17 (IMAGE_GROUP_SECONDARY_SKILLS): Secondary Skill
  • 18 (IMAGE_GROUP_UNIT): Creature
  • 19-24: Same as -1
  • 25 (IMAGE_GROUP_PRIMARY_SKILLS): Primary Skill
  • 26+: Same as 16


Image subtypes (the number in the list represents the type for which the subtype applies)

  • -1: Put 0 to be safe
  • 0: Quantity (if you put 0 it will not show any number)
  • 1: Quantity (if you put 0 it will not show any number)
  • 2: Quantity (if you put 0 it will not show any number)
  • 3: Quantity (if you put 0 it will not show any number)
  • 4: Quantity (if you put 0 it will not show any number)
  • 5: Quantity (if you put 0 it will not show any number)
  • 6: Quantity (if you put 0 it will not show any number)
  • 7: Which artifact (use artifact name from the wiki)
  • 8: Which spell (use spell name from the wiki)
  • 9: Which color (blue-0, green-1, red-2, yellow-3, orange-4, purple-5)
  • 10: Doesn't matter
  • 11: Doesn't matter
  • 12: Doesn't matter
  • 13: Doesn't matter
  • 14: Quantity (works with negatives as well)***
  • 15: Which portrait (start from 0, it's the same order as when you scroll through them in the editor)**
  • 16: As I said above, game crashes, so don't use it
  • 17: Which skill * (look at the asterisk below)
  • 18: Which creature (take their ID from \data\creatures.xml)
  • 19-24: Put 0 to be safe
  • 25: 0-3 (Attack, Defense, Spell Power, Knowledge) (100-103 displays a +1 skill)
  • 26+: Don't use it


*count the skills in the order from the wiki starting from 0 and stop at the one desired. Then multiply by 3 to get the basic picture. Add 1 for advanced, or 2 for expert  Smile
**for hero portraits: to display town captains, use 90-95 (knight, barbarian, sorceress, warlock, wizard, necromancer)
***-1 shows no number, the rest of the numbers show exactly as intended

One more thing I have to mention: If you choose image type resource (0-6), you can set the subtype as negative and it will show the qty/day thing like from the mines. So if I set it to -6, for example, the message will show 6/day.
UPDATE: If you want to show negative values (like when taking resources), put the subtype -x-100000, where x is the value. So -100050 would show -50. If you put exactly -100000, it shows 100k/day, not -0.

UPDATE II: If you enclose text between curly braces {} then the text becomes golden.

For now (Ironfist 1.3.0), none of the dialog types return anything, so it only makes sense to use types 1/5 and 3/6.

I hope this was helpful, please reply if you find anything incorrect information or if you find something new.


Last edited by DarkAtom on 2019-07-19, 05:16; edited 14 times in total
Back to top Go down
Darmani
Master Modder
Master Modder
Darmani


Messages : 288
Quality Points : 47
Registration Date : 2014-12-27

Advanced Dialogue Boxes in Project Ironfist Empty
PostSubject: Re: Advanced Dialogue Boxes in Project Ironfist   Advanced Dialogue Boxes in Project Ironfist Icon_minitime2018-09-04, 18:19

Woah; this is awesome. Nice work! Thanks for the reminder that we need to finish our project to document this.
Back to top Go down
Unknown_Hero
Mage
Mage
Unknown_Hero


Messages : 778
Quality Points : 78
Registration Date : 2015-09-06

Advanced Dialogue Boxes in Project Ironfist Empty
PostSubject: Re: Advanced Dialogue Boxes in Project Ironfist   Advanced Dialogue Boxes in Project Ironfist Icon_minitime2018-12-25, 08:08

Thanks for your clarifications DarkAtom. Smile

I used your hint to display +1 for the hero's primary skills with the Advanced Message Box in a script for the Unknown Mod.

Code:
text = "Bla, bla...";
dialogtype = 1;
img1type = 25;
img1arg = 102; -- why "2" to "102" only for this?
img2type = 25;
img2arg = 3; -- and not for this? "103" will crash the program!!!
AdvancedMessageBox(text, dialogtype, -1, -1, img1type, img1arg, img2type, img2arg, -1, 0);

Here, the value "102" for "img1arg" displays +1 for the hero's Spell Power and +1 for the hero's Knowledge (with "img2arg = 3").

It is not necessary to indicate "103" for "img2arg", and if "103" is used, it causes the program to crash.

On the other hand, the possible value seems to be limited to "+1", it's not possible to display "+2" or "+3" or any other value.

Unknown Mod - Spoiler:

With the hope that it can help. Smile
Back to top Go down
DarkAtom
Pikeman
Pikeman
DarkAtom


Messages : 47
Quality Points : 6
Registration Date : 2018-02-27

Advanced Dialogue Boxes in Project Ironfist Empty
PostSubject: Re: Advanced Dialogue Boxes in Project Ironfist   Advanced Dialogue Boxes in Project Ironfist Icon_minitime2018-12-25, 09:34

Unknown_Hero wrote:
Thanks for your clarifications DarkAtom. Smile

I used your hint to display +1 for the hero's primary skills with the Advanced Message Box in a script for the Unknown Mod.

Code:
text = "Bla, bla...";
dialogtype = 1;
img1type = 25;
img1arg = 102; -- why "2" to "102" only for this?
img2type = 25;
img2arg = 3; -- and not for this? "103" will crash the program!!!
AdvancedMessageBox(text, dialogtype, -1, -1, img1type, img1arg, img2type, img2arg, -1, 0);

Here, the value "102" for "img1arg" displays +1 for the hero's Spell Power and +1 for the hero's Knowledge (with "img2arg = 3").

It is not necessary to indicate "103" for "img2arg", and if "103" is used, it causes the program to crash.

On the other hand, the possible value seems to be limited to "+1", it's not possible to display "+2" or "+3" or any other value.

Unknown Mod - Spoiler:

With the hope that it can help. Smile

Hmmm... I never tried this, but I guess that it doesn't make sense to have a +1 picture and then one without a +1.
Back to top Go down
Unknown_Hero
Mage
Mage
Unknown_Hero


Messages : 778
Quality Points : 78
Registration Date : 2015-09-06

Advanced Dialogue Boxes in Project Ironfist Empty
PostSubject: Re: Advanced Dialogue Boxes in Project Ironfist   Advanced Dialogue Boxes in Project Ironfist Icon_minitime2018-12-26, 02:06

I think that in the original version of the game the Advanced Message Box is simply not intended to display several primary skills at the same time and the value is never greater than 1, that's why there are these limitations and quirks.

The Ironfist team should be able to improve this. Smile
Back to top Go down
DarkAtom
Pikeman
Pikeman
DarkAtom


Messages : 47
Quality Points : 6
Registration Date : 2018-02-27

Advanced Dialogue Boxes in Project Ironfist Empty
PostSubject: Re: Advanced Dialogue Boxes in Project Ironfist   Advanced Dialogue Boxes in Project Ironfist Icon_minitime2018-12-30, 00:58

I added the constants as well, they make script code a lot more readable.
Back to top Go down
Darmani
Master Modder
Master Modder
Darmani


Messages : 288
Quality Points : 47
Registration Date : 2014-12-27

Advanced Dialogue Boxes in Project Ironfist Empty
PostSubject: Re: Advanced Dialogue Boxes in Project Ironfist   Advanced Dialogue Boxes in Project Ironfist Icon_minitime2019-07-18, 16:08

I have created a wiki article documenting this function, merging information in this blog post with independent efforts by team member Matt Jones: http://projectironfist.pbworks.com/w/page/134600181/AdvancedMessageBox%20Documentation

The main thing added to this is information about the position parameters.

Thanks a lot to DarkAtom for writing this up.
Back to top Go down
DarkAtom
Pikeman
Pikeman
DarkAtom


Messages : 47
Quality Points : 6
Registration Date : 2018-02-27

Advanced Dialogue Boxes in Project Ironfist Empty
PostSubject: Re: Advanced Dialogue Boxes in Project Ironfist   Advanced Dialogue Boxes in Project Ironfist Icon_minitime2019-07-19, 04:35

Darmani wrote:
I have created a wiki article documenting this function, merging information in this blog post with independent efforts by team member Matt Jones: http://projectironfist.pbworks.com/w/page/134600181/AdvancedMessageBox%20Documentation

The main thing added to this is information about the position parameters.

Thanks a lot to DarkAtom for writing this up.

Thank you, @Darmani!

Found this gem in the decompiled source code:
Code:

// HEROES2W.c, line 35891
if ( !gbRemoteOn )
    a10 = 0;
  if ( a10 <= 1 || a10 >= 20000 )
    giDialogTimeout = a10;
  else
    giDialogTimeout = KBTickCount() + a10;

Is it some sort of delay used for multiplayer?
Back to top Go down
Darmani
Master Modder
Master Modder
Darmani


Messages : 288
Quality Points : 47
Registration Date : 2014-12-27

Advanced Dialogue Boxes in Project Ironfist Empty
PostSubject: Re: Advanced Dialogue Boxes in Project Ironfist   Advanced Dialogue Boxes in Project Ironfist Icon_minitime2019-08-15, 08:01

It appears that one of the dialog box modes is intended for the "Waiting to Connect" dialog and friends.
Back to top Go down
Sponsored content





Advanced Dialogue Boxes in Project Ironfist Empty
PostSubject: Re: Advanced Dialogue Boxes in Project Ironfist   Advanced Dialogue Boxes in Project Ironfist Icon_minitime

Back to top Go down
 
Advanced Dialogue Boxes in Project Ironfist
Back to top 
Page 1 of 1
 Similar topics
-
» DOS Project Ironfist version.
» Old version of Project Ironfist for old OS.
» Project Ironfist announcements
» Project Ironfist Scripting Examples Page
» Project Ironfist Scripting Documentation Page

Permissions in this forum:You cannot reply to topics in this forum
~ Forums of Enroth ~ :: Modding Guild :: Heroes of Might and Magic II: Project Ironfist :: Modding and Mapmaking-
Jump to: