#XenonCode.com gives different results than ingame

1 messages · Page 1 of 1 (latest)

main mica
#

Comparing a 0..1 number to 0 seems to give strange results.

Code for copy-paste test:
init
var $test = -0.9
print($test)
if $test == 0
print("test is 0")
else
print("test not 0")

lethal cloud
#

strange...have you tried == 0.0?

main mica
#

Just checked, same result.

lethal cloud
#

Not good...i hope this is just a strange case here and not normal in all other. Up now i do not had a problem with using 1 and 0 as boolean. But these had no decimal places... And i hope we get in future real boolean too 😉

main mica
#

I guess it's just a version difference between the game and the website.

lethal cloud
main mica
#

Yeah, the game is alright.

fervent hedge
#

The standalone xenoncode cli is also correct

earnest tinsel
#

thats weird

jade heath
#

Small compilation issue with the executable used on xenoncode.com
It's fixed

stiff siren
#

well, still something wrong on website.

terminate called after throwing an instance of 'XenonCode::ParseError'
what(): Invalid first word 'start' in the global scope in ./main.xc:9
timeout: the monitored command dumped core
Aborted

var $end :text

function @coord ($x:number, $y:number, $z:number) :text
    var $stringcoord = ".x{" & $x:text & "}.y{" & $y:text & "}.z{" & $z:text & "}"
    return $stringcoord
    
init
    $start = @coord(20,20,20)
    $end = @coord(10,10,20)
    
    print(text("From ({},{},{}) to ({},{},{}) we get:",$start.x,$start.y,$start.z,$end.x,$end.y,$end.z))
    print(text("Distance = {}",sqrt(pow(($end.x-$start.x),2) + pow(($end.y-$start.y),2) + pow(($end.z-$start.z),2))))```
#

This same code was running fine just 20 minutes ago.

#

It's like it's not seeing the $ in $start

#

and now it works... seems pasting a block of code it doesn't parse correctly. Have to paste one line at a time.

jade heath
stiff siren
#

yeah, seems discord is replacing some tabs with their space equivalent.

#

I had a similar issue once dealing with pasting scripting code in here on another channel for streamer I moderated for.

#

pasting the full block and reinserting the tabs fixed it.