Skip to content

Posts from Scripts

4.8 (8 ratings)
User Avatar
Auto-translated
Or is there an interceptor for outputting strings to the console?

Added 1 minute ago
RedHeavenHero
As far as I know, this is impossible.
And what is the purpose of this?
To erase an error that doesn't affect anything.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to Dyrman
User Avatar
Auto-translated
Dyrman
Or maybe there's an interceptor for outputting strings to the console?
The function _ERRORMESSAGE is responsible for this, which displays messages like (Script) ERROR
errormsg = _ERRORMESSAGE
function _ERRORMESSAGE(string)
if string ~= "Hitler kaput" then
errormsg(string)
end
end
This is if the output string is the same; otherwise, you need to equate
_ERRORMESSAGE = parse('')
for a while.
function DoNotShowErrorMessage()
local err = _ERRORMESSAGE
_ERRORMESSAGE = parse('') -- or _ERRORMESSAGE = function()end
sleep(1)
_ERRORMESSAGE = err
end
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
And if the error is caused by the game itself, like:
"attempt to call a nil value"
And the line needs to be removed only in one specific case.
_ERRORMESSAGE = "attempt to call a nil value" ?
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
In reply to Dyrman
User Avatar
Auto-translated
Dyrman
What if the error is generated by the game, like:
"attempt to call a nil value"
And the line needs to be removed only in one case.
_ERRORMESSAGE = "attempt to call a nil value" ?
Then the first option will work.
errormsg = _ERRORMESSAGE
function _ERRORMESSAGE(string)
if string ~= "attempt to call a nil value" then
errormsg(string)
end
end
Such an error could occur when passing a message to a function (...Box) with an argument.
For example, MessageBox(path..'a.txt','yes("'..hero..'")'). In this case, other tricks are needed, namely return parse('') at the end of this function (yes).
function yes(hero)
...
return parse('')
end
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
Auto-translated
RedHeavenHero

This kind of error could occur when passing a message to a function (...Box) with an argument.
For example, MessageBox(path..'a.txt','yes("'..hero..'")'). In this case, other tricks are needed, namely, return parse('') at the end of this function (yes).
function yes(hero)
...
return parse('')
end
Yes, that's it. Thank you.
Моды для HeroesV:
NHF 0.90 : NHF - группа в VK

Карты для HeroesV:
Путешествие , Условие крови , Рука судьбы.Часть 1: В поход , Рука судьбы.Часть 2: Отчаянье , Рука судьбы.Часть 3: Восхождение , Стойкость
Абсолютная власть , Иду на Вы! , Корона Ургаша , На задворках
Мир надо уничтожить... Чтобы создать свой...
User Avatar
Auto-translated
Does the random function work in combat scripts?

Added after 13 hours 36 minutes
Can the SetGameVar() function assign an array to a variable?
 Создается карта про эльфов: Воссоединение - готовность 71%
In reply to Spectral
User Avatar
Auto-translated
Spectral
Does the random function work in combat scripts?

Added after 13 hours 36 minutes
Can the SetGameVar() function assign an array to a variable?
No, and again, no. Random does not work in combat, and SetGameVar can only store strings.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
Auto-translated
RedHeavenHero
No, and once again, no. Random doesn't work in combat, and SetGameVar can only store strings.
I also confirmed this, which is very bad. And can SetGameVar() also accept numerical values?
 Создается карта про эльфов: Воссоединение - готовность 71%
User Avatar
Auto-translated
Hmm, I made a silly mistake. And does the mod not work either?
502 Bad Gateway
__________________________________
nginx/0.8.54
In reply to Warrior777
User Avatar
Auto-translated
Warrior777
Does the mod not work either?
The mod works.
 Создается карта про эльфов: Воссоединение - готовность 71%
User Avatar
Auto-translated
I need to create a script where the hero casts spells on enemy creatures at the beginning of the battle, but if the enemy has immunity, the script throws an error. I tried using an interceptor, but after that, the game freezes, and I can't finish the battle. What should I do?
 Создается карта про эльфов: Воссоединение - готовность 71%
In reply to Spectral
User Avatar
Auto-translated
Instead of UnitCastAimedSpell(unit, spell, target), use startThread(UnitCastAimedSpell, unit, spell, target). The error will still be there, but it won’t affect the script’s further execution.
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
User Avatar
Auto-translated
Gentlemen, does this method of displaying the game's difficulty in the console work? (I'm too lazy to test it myself)
dif = GetDifficulty();
print('difficulty', dif);
502 Bad Gateway
__________________________________
nginx/0.8.54
In reply to Warrior777
User Avatar
Auto-translated
Warrior777
Guys, does this method of displaying the game's difficulty in the console work? (I'm too lazy to test it myself)
dif = GetDifficulty ();
print ('difficulty' dif);
It works if you put two dots between 'difficulty' and dif.
And there's also that magical gray line. Are you using it?;)
message #100 on HW
Карты для Героев Меча и Магии 5
Одиночные: Завеса срывается, Посол, Последний рывок, Эхо Пустоты
Кампания: Империя Единорога

Существа NCF
Орден Порядка: 1
Нейтралы: 1 2 3 4
In reply to RedHeavenHero
User Avatar
Auto-translated
RedHeavenHero
It works if you put two periods between 'difficulty' and 'dif'.
And there's also that magical gray line. Are you using it?;)
message #100 on HW
Yes, I know about the periods. I just forgot.
What line are you talking about?
502 Bad Gateway
__________________________________
nginx/0.8.54

Statistics

Welcome our newest member: Emil