I don't get this one at all
mrangel
31 Aug 2017, 11:26Weird issue with my random map generator. I'm checking pairs of adjacent rooms to see if I should add exits between them. But first, I want to see if there's already an exit there.
The code I have is:
ex = GetExitByName(loc, d)
if (ex <> null) {
debugmsg ("shuffle", " Exit "+ex+" already exists")
}
else {
... lots of code here ....
}
That looks pretty sensible. But…
Error running script: Error compiling expression 'ex <> null': CompareElement: Operation 'NotEqual' is not defined for types 'Double' and 'Null'
What am I doing wrong?
mrangel
31 Aug 2017, 11:31OK ... server timeout, have to reload the editor… and that code now works fine. I haven't changed it.
Really hate those kind of bugs :p
The Pixie
31 Aug 2017, 11:50Is it possible you used e
instead of ex
? e
is a constant, 2.71828182845905, which is a double, and would give that error.
mrangel
31 Aug 2017, 13:15Hmm… the last thing I did was change the variable name. If it's somehow not saved the very last keypress when I hit "play", that would make sense.
Thanks :)
Surprised that something like Quest has a constant for e… can't think of a case where it would be used in a game.
The Pixie
31 Aug 2017, 14:12I think it must be built in to something Quest uses. I have been messing with Quest for 6 years and I do not think I have even used double (but I have called an exit e
before, and it took a long time to work out what was going on).

DarkLizerd
31 Aug 2017, 16:39Should it be "null" or "Null"???
jmnevil54
31 Aug 2017, 16:54Well, in my code "The Pixie" uses "null". Don't know if that helps.

K.V.
31 Aug 2017, 16:59Instead of if (ex <> null) {
Use if (not ex = null) {
I think that if ex
is not an integer, it will throw an error using greater than or less than.
The Pixie
31 Aug 2017, 18:51Actually it will throw an error if it is an integer (or double, which was the issue) whether you use <>
or =
.

K.V.
31 Aug 2017, 20:04Oh... because an integer can't be null. It would be 0. (Right?)
(And a double integer would be 0.0 and never null?)