Members | Sign In
All Forums > Mission Scripting

Mission editing help "When enemy's value is 0."

posted Jul 19, 2012 05:42:04 by Charlie
Hello again, i'm having a problem where when i set this command "<if_fleet_count comparator="EQUALS" value="0.0" />" Or in the mission editor it says "Ship count = 0.0 when counting all enemies" However when the enemies are all destroyed, the event still does not trigger. I have all the variables needed set to 1. Thanks for any help.
page   1
6 replies
Hissatsu said Jul 19, 2012 13:25:36
Hmm, in the official mission help file it says it will check all fleets when fleet number is not specified.

CONDITION: if_fleet_count (tests an indexed fleet's membership count against a condition)
VALID: text
ATTRIBUTE: comparator
VALID: signed floating point value
ATTRIBUTE: fleetnumber
VALID: 0-99

if you omit the fleetnumber, this command will count every enemy in the game

I only made an editor, i didnt have time or patience to check every single mission statement to actually work as intended - even though, i found some problems and shared what i found, even found a grave problem with game's > and < comparison, outlined here

One single wild idea - try to manualy (through text editor) edit the line to:
<if_fleet_count comparator="EQUALS" value="0" />

That removes the .0 from the 0. If it works then - this might mean another bug in the mission scripting, that 0 != 0.0 (integer zero != real zero)
Charlie said Jul 19, 2012 20:55:50
We're making progress, starting to get the hang of the editor. Thx

GregKurlinski said Jul 31, 2012 03:35:54
I have had better luck with "<" 1 instead of trying to figure out 0 vs 0.0
Hissatsu said Jul 31, 2012 07:12:21
Yeah its fun how 1.9 <= 1.1 is true, 2.6 = 2 is true, but 0.0 = 0 seems to be.... false?
ArpieBowman said Oct 02, 2012 22:02:45
(With apologies to everyone who has heard this a million times):

This is because computers are crazy-specific about logic to the point of being dumber than humans. We're far more flexible.

Computer logic: Since 0 is an integer and 0.0 is a float, they are not the same thing, therefore they are not "equal" to one another.
(They have the same numeric value, but they are different KINDS of zeros, in the computer's picky mind.)

That's why you have to use the < and <= when using anything with a decimal (a "floating point" number.)

(I had to have this explained to me over and over again for almost a month before it clicked.)

Hissatsu said Oct 03, 2012 07:39:43
Yeah, i know that zeroes are not the same in the memory, int and float one. However, for these purposes conversions exist. When you do a string to int comparison, for example, "0" = 0, the language is supposed to either throw "cannot compare different types" or convert either string to int, or int to string, and then compare them.

There could be a different problem here - precision. For example, some huge real number may not be interpretable by a single-precision floating point number. So in that case if we store this huge real in a single float, and then compare it to this number, you wont get an equality, because there would be a difference in decimal.

However, this should not happen with zero AT ALL. Zero is zero, both in integer and float notations.

So there is absolutely no logic for this to happen, except a situation of wrong coding (bug).
Login below to reply: