Error Meassage, need a hint

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
Mabuse
Posts: 2239
Joined: November 6th, 2007, 1:38 pm

Error Meassage, need a hint

Post by Mabuse »

What may be the cause this error, just in general.
Screenshot (267).png
The best bet is your own, good Taste.
User avatar
Ravana
Forum Moderator
Posts: 3067
Joined: January 29th, 2012, 12:49 am
Location: Estonia
Contact:

Re: Error Meassage, need a hint

Post by Ravana »

Something about string and number conversion. For better debugging I would add logging in one of the lines mentioned in stacktrace.
User avatar
Pentarctagon
Project Manager
Posts: 5592
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Error Meassage, need a hint

Post by Pentarctagon »

It's a pretty terrible error message, but stoi is the name of a c++ function for converting a string to an int. So it tried to convert a string value to an int value and that conversion failed.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
Mabuse
Posts: 2239
Joined: November 6th, 2007, 1:38 pm

Re: Error Meassage, need a hint

Post by Mabuse »

ok, thanks, will see if something like that happens when the message is displayed
The best bet is your own, good Taste.
Mabuse
Posts: 2239
Joined: November 6th, 2007, 1:38 pm

Re: Error Meassage, need a hint

Post by Mabuse »

Pentarctagon wrote: July 5th, 2023, 4:13 am It's a pretty terrible error message, but stoi is the name of a c++ function for converting a string to an int. So it tried to convert a string value to an int value and that conversion failed.
btw, is there any way to suppress these messages from popping up that can be controlled via the scn?

the message pops up when the last leader of a group of leaders get killed, and among these leaders "canrecruit" ability is switched each turn via store_unit and storing these informations in variables, i guess when the last leader get killed there is some unclean code which causes this.

but may its als something else, there are also other events involed when these leaders are killed,

however everything works fine (beside he message pops up), its just that the meassage clutter up the whole screen and last a very long time whch is pretty annoying
The best bet is your own, good Taste.
User avatar
Spannerbag
Posts: 553
Joined: December 18th, 2016, 6:14 pm
Location: Yes

Re: Error Meassage, need a hint

Post by Spannerbag »

Mabuse wrote: July 6th, 2023, 1:19 pm ...but may its als something else, there are also other events involed when these leaders are killed,...
FWIW if you haven't looked at the logs yet, there's sometimes something in there that helps?
Just a thought :)

Cheers!
-- Spannerbag
SP Campaigns: After EI (v1.14) Leafsea Burning (v1.17, v1.16)
I suspect the universe is simpler than we think and stranger than we can know.
Also, I fear that beyond a certain point more intelligence does not necessarily benefit a species...
User avatar
Pentarctagon
Project Manager
Posts: 5592
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: Error Meassage, need a hint

Post by Pentarctagon »

Mabuse wrote: July 6th, 2023, 1:19 pm
Pentarctagon wrote: July 5th, 2023, 4:13 am It's a pretty terrible error message, but stoi is the name of a c++ function for converting a string to an int. So it tried to convert a string value to an int value and that conversion failed.
btw, is there any way to suppress these messages from popping up that can be controlled via the scn?

the message pops up when the last leader of a group of leaders get killed, and among these leaders "canrecruit" ability is switched each turn via store_unit and storing these informations in variables, i guess when the last leader get killed there is some unclean code which causes this.

but may its als something else, there are also other events involed when these leaders are killed,

however everything works fine (beside he message pops up), its just that the meassage clutter up the whole screen and last a very long time whch is pretty annoying
There's the ctrl+x hotkey as well as the number of chat lines preference, but nothing that can be done via code.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
beetlenaut
Developer
Posts: 2829
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: Error Meassage, need a hint

Post by beetlenaut »

Mabuse wrote: July 6th, 2023, 1:19 pm btw, is there any way to suppress these messages from popping up that can be controlled via the scn?
There is an exception being thrown, so you probably shouldn't be attempting to leave it like that even if your code does what you want at the moment. This should be fixable in your code. There is a place where the engine expects a number, but you are giving it an empty string. Maybe one of your tags is missing a required key. (Technically, you could also be giving the engine a string that starts with text, but that seems unlikely.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Mabuse
Posts: 2239
Joined: November 6th, 2007, 1:38 pm

Re: Error Meassage, need a hint

Post by Mabuse »

beetlenaut wrote: July 6th, 2023, 6:32 pm
Mabuse wrote: July 6th, 2023, 1:19 pm btw, is there any way to suppress these messages from popping up that can be controlled via the scn?
There is an exception being thrown, so you probably shouldn't be attempting to leave it like that even if your code does what you want at the moment. This should be fixable in your code. There is a place where the engine expects a number, but you are giving it an empty string. Maybe one of your tags is missing a required key. (Technically, you could also be giving the engine a string that starts with text, but that seems unlikely.)
yes. you are right about that the exeptions shouldnt be ignored.

i tracked down the error and it was as ususal a trivial typo. that would have still ofc caused things not to work like intended.
the mechanism (switching leaders) was not the cause, instead it was a spawned unit and one of its attributes wasnt declared as a string.

thank you all for your help :)
The best bet is your own, good Taste.
Post Reply