~ 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
» [H3SW v0.8.2] Witch Hunt
Massive Test of Project Ironfist Script System Icon_minitimeby GodRage Yesterday at 22:56

» 5Kings1Ring
Massive Test of Project Ironfist Script System Icon_minitimeby GodRage Yesterday at 22:54

» Polskie powitanie
Massive Test of Project Ironfist Script System Icon_minitimeby rrravyn 2024-11-15, 09:53

» loading simplification
Massive Test of Project Ironfist Script System Icon_minitimeby badtoper 2024-11-15, 04:37

» Easier Troop Management Between Garrison and Hero in Town
Massive Test of Project Ironfist Script System Icon_minitimeby badtoper 2024-11-15, 04:05

» Improvements for Hero Management and Turn Confirmation
Massive Test of Project Ironfist Script System Icon_minitimeby badtoper 2024-11-15, 01:57

» [H3SW v0.8.2] Desert Isle
Massive Test of Project Ironfist Script System Icon_minitimeby Sir Albe 2024-10-31, 07:56

Poll
Global announcements should be:
Everlasting, 1 for each project.
Massive Test of Project Ironfist Script System Redbar110%Massive Test of Project Ironfist Script System Redbar12
 0% [ 0 ]
Temporary, when there is something new to announce.
Massive Test of Project Ironfist Script System Redbar11100%Massive Test of Project Ironfist Script System Redbar12
 100% [ 6 ]
Holalala... No idea where the Ultimate artifact is.
Massive Test of Project Ironfist Script System Redbar110%Massive Test of Project Ironfist Script System 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
The Floody Land
Forum Admins Feed
Enrothian Fan Art
Heroes III: The Succession Wars v0.8.2 Beta

 

 Massive Test of Project Ironfist Script System

Go down 
2 posters
AuthorMessage
Unknown_Hero
Mage
Mage
Unknown_Hero


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

Massive Test of Project Ironfist Script System Empty
PostSubject: Massive Test of Project Ironfist Script System   Massive Test of Project Ironfist Script System Icon_minitime2017-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... Massive Test of Project Ironfist Script System 3621766935
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
Darmani


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

Massive Test of Project Ironfist Script System Empty
PostSubject: Re: Massive Test of Project Ironfist Script System   Massive Test of Project Ironfist Script System Icon_minitime2017-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
Mage
Mage
Unknown_Hero


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

Massive Test of Project Ironfist Script System Empty
PostSubject: Re: Massive Test of Project Ironfist Script System   Massive Test of Project Ironfist Script System Icon_minitime2017-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
Unknown_Hero
Mage
Mage
Unknown_Hero


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

Massive Test of Project Ironfist Script System Empty
PostSubject: Re: Massive Test of Project Ironfist Script System   Massive Test of Project Ironfist Script System Icon_minitime2018-09-05, 04:37

I think I found the bug with the expression "RESOURCE_CRYSTAL", for example used as follows:

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

Go to: https://github.com/jkoppel/project-ironfist/blob/master/src/cpp/shared/scripting/consts.cpp

Line 323: lua_setconst(L, "RESOURCE_CRYSTALS", RESOURCE_CRYSTAL);

There is an extra "S" at the end of "RESOURCE_CRYSTAL", it should be: lua_setconst(L, "RESOURCE_CRYSTAL", RESOURCE_CRYSTAL);
Back to top Go down
Sponsored content





Massive Test of Project Ironfist Script System Empty
PostSubject: Re: Massive Test of Project Ironfist Script System   Massive Test of Project Ironfist Script System Icon_minitime

Back to top Go down
 
Massive Test of Project Ironfist Script System
Back to top 
Page 1 of 1
 Similar topics
-
» [Ironfist ver 1.2.1+][Script System] OnUnitRecruit(creatureid)
» [Ironfist ver 1.2.1+][Script System] OnLocationVisit(type, x, y)
» DOS Project Ironfist version.
» Project Ironfist won't run after installation
» Old version of Project Ironfist for old OS.

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: