I don't get this one at all

Weird 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?


OK ... 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


Is it possible you used e instead of ex? e is a constant, 2.71828182845905, which is a double, and would give that error.


Hmm… 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.


I 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).


Should it be "null" or "Null"???


Well, in my code "The Pixie" uses "null". Don't know if that helps.


K.V.

Instead 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.


Actually it will throw an error if it is an integer (or double, which was the issue) whether you use <> or =.


K.V.

Oh... because an integer can't be null. It would be 0. (Right?)

(And a double integer would be 0.0 and never null?)


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums