Members | Sign In
All Forums > Mission Scripting
avatar

Severe bug in Artemis's mission script parser

posted May 14, 2012 20:14:39 by Hissatsu
Greetings!

After spending about half an hour fighting Artemis that was crashing on me for no apparent reason, I found out the following:

if_variable statement does a truncation on both the variable and the value before doing the comparison.

This means that:
* after set_variable to 1.9 if_variable <= 1.1 will be true
* after set_variable to 2.6 if_variable = 2 will be true
* after set variable to 3.75 if_variable !=3 will be false
* after set_variable to random float 1..3, if_variable =1 will be true in 49.99% cases

And so on.

Since you can set variable to float, and you can even set it to random float, I doubt this behavior was intended. And it is very, very misleading, especially since you never expect it to be the culrpit.
[Last edited May 14, 2012 20:23:53]
page   1
5 replies
avatar
lordrahvin said Oct 03, 2012 02:55:21
How do you set it to a random float?
Daredevil Cosmic Cowboys, TNS Hyperion, Weapons Officer
1st Fleet of Southern California Sector.

avatar
Hissatsu said Oct 03, 2012 07:41:15
Well, you just do. Here's the syntax:

COMMAND: set_variable (makes or sets a named value)
ATTRIBUTE: name
VALID: text

-EITHER-
ATTRIBUTE: value
VALID: 0 to big number

-OR-
ATTRIBUTE: randomIntHigh
VALID: number
ATTRIBUTE: randomIntLow
VALID: number lower than randomIntHigh

-OR-
ATTRIBUTE: randomFloatHigh
VALID: number
ATTRIBUTE: randomFloatLow
VALID: number lower than randomFloatHigh

avatar
lordrahvin said Oct 03, 2012 08:31:35
Thank you.

I guess I just never realized. I feel kind of silly now, considering the workarounds I've been working with.



I still don't understand the nature of this error in your original post, but I think I'll only need random integers anyway.
[Last edited Oct 03, 2012 08:32:32]
Daredevil Cosmic Cowboys, TNS Hyperion, Weapons Officer
1st Fleet of Southern California Sector.

avatar
Hissatsu said Oct 03, 2012 10:24:32
It's good to be always learning :)

The nature of this error is most likely that comparisons are made with truncated variables (however the fact that 0.0 != 0 would contradict that). But that's for Thom to fix it, and unfortunately he seems to not care about this one :(

It's not really a problem for float random numbers (which by the way are useless completely in the current state) but for setting variables to something like chapter 1 part 1 (1.1) or chapter 1 part 2 (1.2) which could be very useful if it worked, but right now you just cant use it (have to use something like 102 where 1 is chapter and 02 is part)
avatar
GregKurlinski said Oct 03, 2012 17:14:42
Yeah, I spent a few days tring to get my Chapter=1.1 to work... not knowing exactly what the problem was.
Login below to reply: