~ Forums of Enroth ~

An Enroth diehard fan community
 
HomeHome  ChatChat  FAQFAQ  SearchSearch  RegisterRegister  Log inLog in  
Latest topics
» [EN, RU][Offline] HoMM1 Tournament of the Landless 2017 (Турнир Безземельных)
by Orzie 2017-08-17, 01:32

» How autoborder/autofixer works...
by Unknown_Hero 2017-08-15, 23:31

» Navigation secondary skill - Too short to disembark
by Unknown_Hero 2017-08-13, 22:08

» [EN, RU][Offline] HoMM1 Trade Guild Tourney 2017 (Турнир Торговой Гильдии)
by Orzie 2017-08-12, 16:27

» Happy Birthdays and Congrats!
by Dr Slash 2017-08-10, 11:10

» The Symphony of Heroes - Paul Romero with ochestra concert
by Sir Albe 2017-08-10, 04:08

» Change to the Arena (PoL)
by Unknown_Hero 2017-08-08, 22:07

Poll
"Wait" in HoMM2?
Yes
80%
 80% [ 44 ]
No
20%
 20% [ 11 ]
Total Votes : 55
Most Viewed Topics
H3SW: General Graphics discussion
Ragoon's Graphics For HoMM3SW
H3SW General Discussion
H3SW: Dwelling Development
H3SW Map List: Work in progress
Dervish Faction General Concept
Enrothian Fan Art
H3SW Recruitment Point - Enroth Needs You!
Серия книг "Земли Меча и Магии"
Heroes of Might and Magic 3: The Succession Wars - General info

Share | 
 

 Massive Test of Project Ironfist Script System

View previous topic View next topic Go down 
AuthorMessage
Unknown_Hero
Minotaur
Minotaur
avatar

Messages : 332
Quality Points : 37
Registration Date : 2015-09-06

PostSubject: Massive Test of Project Ironfist Script System   2017-03-05, 23:56

@Darmani

I observed strange behavior and inconsistencies in the way to use MessageBox(msg) while I used it to display values while I was doing script tests.

So, I decided to test MessageBox(msg)... ...and then, everything else...
It was quite long to check, but it had to be done.
Here is what I tried, what I observed, and the bugs I found.

The script includes comments and sometimes some suggestions.
I will also create separate threads for additional suggestions.

TestScri version 20170305

I hope you will enjoy it!!! Very Happy

*

This script has been tested with Ironfist version 1.2.1+ (version of December 15, 2016).
Script Name: TestScri.mx2.lua
Script version: 20170305.
Map Name: TestScri.mx2

The purpose of this script is to test the robustness of the script system in different ways, and even with "unexpected ways" to see how the program reacts.
The majority of combat-related instructions have not been tested in this version of the script.

Remove/add the '--t' at the start of the lines in the TestScri.mx2.lua file to test different combinations.
Back to top Go down
Darmani
Master Modder
Master Modder
avatar

Messages : 167
Quality Points : 30
Registration Date : 2014-12-27

PostSubject: Re: Massive Test of Project Ironfist Script System   2017-03-13, 07:25

Thanks for doing this! Can you point out exactly what problems you found? I didn't read the entire script, but I looked at the last few parts (e.g.: your test of OnNewDay), and everything you wrote sounded like expected behavior.
Back to top Go down
Unknown_Hero
Minotaur
Minotaur
avatar

Messages : 332
Quality Points : 37
Registration Date : 2015-09-06

PostSubject: Re: Massive Test of Project Ironfist Script System   2017-03-14, 07:05

Here are some comments from the test.

Massive Test.

player = GetPlayer(0);
hero = GetHero(player, 0);
hero1 = GetHero(player, 1);
TakeArtifact(hero1, ARTIFACT_ULTIMATE_SWORD_OF_DOMINION);
MessageBox("Break after hero1 take Ultimate Sword of Dominion.");  --< it half worked, the artifact is removed but the hero keeps the bonus.

MessageBox(GetResource(GetPlayer(1), RESOURCE_CRYSTAL));  --< it does not work and stops the script.
MessageBox("Crystal ok.");

SetResource(GetPlayer(0), RESOURCE_CRYSTAL, 100);  --< it does not work and stops the script.
MessageBox("Crystal ok.");

GiveResource(GetPlayer(0), RESOURCE_CRYSTAL, 100);  --< it does not work and stops the script.
MessageBox("Crystal ok.");

SetNumGuildSpells(GetTown(GetTownIdFromPos(6, 7)), 2, 3);
--< it does not work correctly, the spells are displayed even if the level of the Mage Guild is not built in the town.
--< my goal here was to set the number of spells available in the third level of the Mage Guild (3 spells available for the third level),
--< but without the spells being visible as long as the third level of the Mage Guild is not built.

InputBox("What day is it?");  --< it does not work and stops the script.

dayUser = InputBox("What day is it?");  --< it does not work and stops the script.
MessageBox("According to you, it's "..dayUser..".");

BIG BUG: If you move Ector, per example, one square to the east before moving Dimitri to (10, 9), the function OnHeroMove(x, y) is not activated when Dimitri moves to (10, 9).

hero = GetHero(GetPlayer(0), 1);
TakeTroop(hero, CREATURE_RANGER, GetResource(GetPlayer(1), RESOURCE_CRYSTAL));  --< it does not work and stops the script.
MessageBox("Rangers removed.");

MessageBox(os.time());  --< it works.
MessageBox(math.random());  --< it works.
MessageBox(math.random(10));  --< it works.
MessageBox(math.random(10, 30));  --< it works.
MessageBox(math.randomseed(os.time()));  --< it does not work and stops the script.

MessageBox("The hero 25 InPool Knowledge value after the Minor Scroll of Knowledge is removed is with GetPrimarySkill(GetHeroInPool(25), PRIMARY_SKILL_KNOWLEDGE)");
MessageBox(GetPrimarySkill(GetHeroInPool(25), PRIMARY_SKILL_KNOWLEDGE));
--< it does not work, certainly the artifact is removed (see above in function OnMapStart()), but the value of Knowledge is not updated.

MessageBox("The hero 0 ForHire of current player Knowledge value after the Minor Scroll of Knowledge is removed is with GetPrimarySkill(GetHeroForHire(GetCurrentPlayer(), 0), PRIMARY_SKILL_KNOWLEDGE)");
MessageBox(GetPrimarySkill(GetHeroForHire(GetCurrentPlayer(), 0), PRIMARY_SKILL_KNOWLEDGE));
--< it does not work, certainly the artifact is removed (see above in function OnMapStart()), but the value of Knowledge is not updated.

MessageBox("Gives Medal of Valor with GetCurrentHero()");
GrantArtifact(GetCurrentHero(), ARTIFACT_MEDAL_OF_VALOR);
MessageBox("Medal of Valor is ok.");
--< it works.
MessageBox("Has the current Hero the artifact with HasArtifact(GetCurrentHero(), ARTIFACT_MEDAL_OF_VALOR)");
MessageBox(HasArtifact(GetCurrentHero(), ARTIFACT_MEDAL_OF_VALOR));
--< it does not work and stops the script.

MessageBox("Gives Medal of Valor with GetHero(GetCurrentPlayer(), 0)");
GrantArtifact(GetHero(GetCurrentPlayer(), 0), ARTIFACT_MEDAL_OF_VALOR);
MessageBox("Medal of Valor is ok.");
--< it works.
MessageBox("Has the Hero 0 of the current Player the artifact with HasArtifact(GetHero(GetCurrentPlayer(), 0), ARTIFACT_MEDAL_OF_VALOR)");
MessageBox(HasArtifact(GetHero(GetCurrentPlayer(), 0), ARTIFACT_MEDAL_OF_VALOR));
--< it does not work and stops the script.

MessageBox("The number of free slots for artifacts of the current Hero is with CountEmptyArtifactSlots(GetCurrentHero())");
MessageBox(CountEmptyArtifactSlots(GetCurrentHero()));
--< it does not work and stops the script.

MessageBox("The number of free slots for artifacts of the Hero 0 of the current Player is with CountEmptyArtifactSlots(GetHero(GetCurrentPlayer(), n)) and 0");
MessageBox(CountEmptyArtifactSlots(GetHero(GetCurrentPlayer(), 0)));
--< it does not work and stops the script.

MessageBox("The number of free slots for artifacts of the Hero is with GetHeroInPool(n) and 25");
MessageBox(CountEmptyArtifactSlots(GetHeroInPool(25)));
--< it does not work and stops the script.

function OnTownOpen(name)
 if name == "Beaufort" then
   MessageBox("The current town is Beaufort.");  --< it does not work.
 end  --< it's done this way at the Scripting Examples page and also in the Sorrow's End script.
end;

BuildInTown(GetTown(0), BUILDING_SPECIAL_GROWTH);
--< it works, but the town's list at right of the screen is not updated (the small cross that indicates that a building has already been built this turn is not displayed).

BuildInTown(GetTownByName("Beaufort"), BUILDING_SPECIAL_GROWTH);
--< it works, but the town's list at right of the screen is not updated (the small cross that indicates that a building has already been built this turn is not displayed).

BuildInTown(GetPlayerTown(GetCurrentPlayer(), 0), BUILDING_SPECIAL_GROWTH);
--< it works, but the town's list at right of the screen is not updated (the small cross that indicates that a building has already been built this turn is not displayed).

BuildInTown(GetPlayerTown(GetPlayer(0), 0), BUILDING_SPECIAL_GROWTH);
--< it works, but the town's list at right of the screen is not updated (the small cross that indicates that a building has already been built this turn is not displayed).

SetTownFaction(0, 2);
--< it does not work and crashes the program.

SetTownFaction(GetTownIdFromPos(6, 7), 2);
--< it does not work and crashes the program.

SetTownFaction(GetTown(GetTownIdFromPos(6, 7)), 2);
--< it does not work completely, the town's list at right of the screen is not updated (the sprite of the new town is not displayed).
--< the town sprite on the adventure map is never updated.

SetTownFaction(GetTown(GetTownIdFromPos(6, 7)), 6);
--< the town's list at right of the screen is not updated (the sprite of the new town is not displayed).
--< a right click on the targeted Knight castle sprite on the adventure map or a right click on the targeted castle in the town's list at right of the screen displays a Knight town sprite.
--< make a double click on the targeted Knight castle sprite on the adventure map or make a double click on the targeted castle in the town's list at right of the screen or if a hero enters the castle, it crashes the program.
--< an Unexpected Program Termination window is displayed: "ResMgr::PointToFile failure! ThisFileId:-427116783 LastFileId:-427116783 LastFileName:townbkg6.icn".

SetTownOwner(0, 1);
--< it does not work completely, the minimap is not updated, the town's list at right of the screen is not updated (the sprite of the town is not removed).
--< the troops in garrison are removed.

SetTownOwner(0, 2);
--< there are only two players, make a click on the minimap crashes the program.

SetTownOwner(GetTownIdFromPos(6, 7), 1);
--< it does not work completely, the minimap is not updated, the town's list at right of the screen is not updated (the sprite of the town is not removed).
--< the troops in garrison are removed.

SetTownOwner(GetTown(GetTownIdFromPos(6, 7)), 1);
--< it does not work and stops the script.

MessageBox(GetCreatureCost(CREATURE_RANGER));  --< it always displays "0".

MessageBox(GetCreatureCost(2));  --< it always displays "0".

MessageBox(GetCreatureCost(20));  --< it always displays "0".

costRanger = GetCreatureCost(CREATURE_RANGER);
MessageBox(costRanger);  --< it always displays "0".

costRanger = GetCreatureCost(2);
MessageBox(costRanger);  --< it always displays "0".

New tests.

MessageBox("Text displayed for all types of locations visited.");
--< it works, it displays the message box for all types of locations visited (very nice).
--< when the hero embarks in a boat, the message box is displayed after the hero is embarked.
--< it also displays the message box when the hero disembarks from a boat, is this normal?
--< and this time, the message box is displayed before the hero lands.

*

Do you plan to make this works?

"\n" for new line
"\t" for horizontal tab

Example:

MessageBox("Hello\nWorld!!!\tIt's me here!");

This will display:
Hello
World!!!
    It's me here!

***** Updated on March 14, 2017 *****

-- You enter the tent and find an old woman staring into a glowing gem. "I have learned much in the way of scrying. Let me share a secret." With that, she leans into your ear and whispers the keyword for the %s border guard
--< the point "." is missing at the end of the new text for the Traveller's Tent (...border guard.).
Back to top Go down
 
Massive Test of Project Ironfist Script System
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» CEF MM Citations for the Great War Project
» Project Runway
» New DNA Test for DU or Agent Orange Exposure
» Calls to DNA test "Madeleine McCann in Cyprus
» One Woman in India dies every hour due to the dowry system

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: