Skip to content
User Avatar
#3741
Auto-translated
Hello. I wrote the following script:
MainHero = "TestHero";
FirstQuestion = 0;

function TestQuestion( MainHero )
if MainHero == "TestHero" then
if ( GetHeroStat("TestHero", STAT_MOVE_POINTS) <= 99 ) then
if FirstQuestion == 0 then
FirstQuestion = 1;
MessageBox(GetMapDataPath().."TestQuestionInfo.txt");
end;
QuestionBox({GetMapDataPath().."TestWork.txt"; TestWork_mp=100*GetHeroLevel("TestHero")}, "RunRun");
end;
end;
end;

function RunRun()
if GetHeroStat("TestHero", STAT_MANA_POINTS) >= 8 then
ChangeHeroStat("TestHero", STAT_MOVE_POINTS, 100*GetHeroLevel("TestHero"));
ChangeHeroStat("TestHero", STAT_MANA_POINTS, -8);
elseif GetHeroStat("TestHero", STAT_MANA_POINTS) < 8 then
MessageBox(GetMapDataPath().."TestWorkNoMana.txt");
end;
end;

Trigger( NEW_DAY_TRIGGER, "TestQuestion" );

If I agree in the QuestionBox, everything works and there are no errors, but for some reason, if I refuse (i.e., choose the Cancel answer), the console gives me the following error:
"(Script) Error: '=' expected;
last token read: '/ at line 1 in string "DoStringScript"
Script failed, unknown error"

Why is this happening? This isn't the complete script because only one function is automatically launched (another one, I'm launching this one manually), but could the problem be here?

Line 1 in this script looks like this, and it definitely shouldn't be causing an error:
---------------;;;;;;;;;;;;;;;===============