Wintermute Engine > Not a bug

Declaring and setting globals in same statement unreliable?

(1/2) > >>

Kaz:
No complaint, this engine rocks, and nothing invented by humans can be perfect. Here is a weird one.

I have a script that does this:

--- Code: ---else
  {
  Game.TakeItem("LetterRhiannon");
  global gGotLetterRhiannon = true;
  }

--- End code ---
Rhiannon's letter goes to inventory as it should but occasionally - not on every playing - the global doesn't get set. The player complains that "the letter is still there". I have a savegame from a player to attest. I can see the letter in inventory, but the debugger tells me that the global is in a null state.
I believe I'm right that I can declare and set a global in the same statement, and the majority of times the game is played, both instructions are executed. It sounds like a bug, because usually it works and occasionally it doesn't.
Should I have used

--- Code: ---else
  {
  Game.TakeItem("LetterRhiannon");
  global gGotLetterRhiannon;
  gGotLetterRhiannon = true;
  }

--- End code ---
instead, as a best practice principle anyway?

Cheers

Noel

Mnemonic:
I'm quite sure the problem is elsewhere. What is the *actual* code? It's in some event handler, I suppose, is there more code in the handler? Please post the exact script.

Kaz:
Mnem,

Thanks for having a look at this but I don't think there's any point sending any other code. There's only one place where the letter goes to inventory and there's only one place where the global gets set or not. The letter is in inventory, so it has to happen in that sequence. If the 'else' is entered, the letter gets taken, so the global should get set. But sometimes it's null.

Just one of those things I guess.

Suggest we classify it as 'can't reproduce'.

Noel

Mnemonic:
You should know that I usually have a good reason for asking the things I'm asking about.
And naturally, I can't diagnose or fix problems I don't have enough information about.

Kaz:
Acknowledged.

Navigation

[0] Message Index

[#] Next page

Go to full version