[SOLVED] Error: Object reference not set to an instance of an object

RedTulip
Hey! It's me again. x) So sorry, my sister and I seem to be running into problems a lot. So, I'm moving around in the game and then when I head into this room, this error pops up on top of the room description: "Error running script: Error evaluating expression 'ToString(value) = rhs': Object reference not set to an instance of an object.".



So, it seems some reference I've made to an object is, for some reason, running the ToString function? Not sure. Anyways, here's the code of the room description the error pops up in:

if (GetBoolean(key, "shinyfalse")) {
msg ("You are in the midst of ruin and {object:wreckage}.{if key.parent = antique2:Underneath the rubble is a {object:key}.} To the {command:north}, {command:west} and {command:east}, there are gaps between the {object:wreckage} wide enough for you to pass.")
}
else {
msg ("You are in the midst of ruin and {object:wreckage}.{if key.parent = antique2:You notice something {object:key:shiny} underneath the rubble, but you can't be entirely certain what it is until you {command:examine shiny:examine it}.} To the {command:north}, {command:west} and {command:east}, there are gaps between the {object:wreckage} wide enough for you to pass.")
}


The shinyfalse is a flag. I think the error has something to do with the {if key.parent=antique2..., as the text in the if condition doesn't show up in the room description. I made sure not to surround antique2 with quotes, as I had read that Quest would evaluate it as a string if I did.

Thank you so much for any help you guys can provide, and I'm sorry if this question seems dumb or anything. <3

HegemonKhan
this:

ToString (value) = rhs

is unusual, especially the 'rhs'

is this your own code line somewhere in your game code? maybe it could be underlying quest engine code, but it seems unusual for that, as I've said.

I can't really help until I can see code on this, as that is what the error is mentioning. We may need to see your entire game code as well (if you want to keep it private, you can PM it to me or someone else to help you with it), as I think you know, code is very interconnected, the issue~problem may be else where in your game code then where you might think it is limited to being at.

also, the syntax should be more like this:

Object_name.Attribute_name = ToString (value)
~OR~
variable_name_string = ToString (value)

it possibly could~should be this:

rhs = ToString (value)

the 'ToString (value)' is an Expression, which goes: ON THE RIGHT SIDE OF THE EQUAL (or other operator, if it's an 'if' script) SIGN

the 'rhs' could be an a variable_name_string or an Object (but then it'd need an attached Attribute to it too, which as seen is missing), and these go: ON THE LEFT SIDE OF THE EQUAL (or other operator) SIGN

Object_name.Attribute_name = Value_or_Expression
~OR~
if (Object_name.Attribute_name OPERATOR Value_or_Expression) { scripts }

but not:

ToString (value) = rhs

this is wrong syntax, flip it around horizontally

RedTulip
Thanks for the quick reply! :) I attached the .aslx here. I have never used a ToString function (intentionally, anyway...) in the game, and also I did a search in the code and there doesn't seem to be any ToString(value) = rhs. :/

Edit: The room with the problem description is to the north (open door, first), and then the east.

HegemonKhan
hmm.. I can't figure it out... (and ya, it seems like it may be something with the internal quest engine coding), so wait for some of the better coders (such as the site staff and some users too) to help, as they know all of quest's code better than I do, and know coding better too.

It might have something to do with the room being 'dark', and thus the Object's can't be acted upon... as that's the feature of 'darkness', but you use the 'darkness' feature elsewhere with 'descriptions', so I'm not sure if those other areas are working fine for you, or if not.

also, are you sure that it is with the 'antique2' Object ??, as you've got similiar 'descriptions' for all of your 'antiqueX' Object's, try to debug ~ diagnose where the error exactly is (put in 'msg (1..2...3...etc)' Scripts to try to narrow down to the single code line of where the issue is at, find where exactly the code is failing at, vs what code is running~working fine)

RedTulip
Thanks for the help, anyways! Also, the player initially has a lantern, for debugging purposes, and I tested the script by removing the entire if condition ({if key.parent = antique2...}) and the error disappeared.

HegemonKhan
I don't think you ever created an Object (NAME) 'wreckage'...

hmm... so removing that 'if' script removed the error... hmm..

simple thing to check: spelling~typo, as 'antique', can be easily mispelled~typo'ed

RedTulip
Haha, yes, that'll be created later on. I'll check if making one fixes it.

Edit: Error's still there, so the wreckage object's not causing the problem.

HegemonKhan
maybe it has soemthing to do with the period~dot with the syntaxing...

as the period~dot can be both a sentence's ending and a code command for separating scripts ~ code lines ~ your text processor commands

I thought there might be a toggle option possibly under the 'game' Object, for how it deals with using the dot~period in regards to this dual nature of it.

RedTulip
Ah. Okay, tried turning off and then tested it. Error's still there. :/ Will study the code some more, something's missing. :((

RedTulip
Got it working! Yes x) In {if key1.parent = antique2...}, there aren't supposed to be spaces around the equality symbol, so {if key1.parent=antique2...} got it working.

HegemonKhan
I'm really stumped... hmm...

I'm sure the good coders here can quickly figure it out, but I'm just not able to do so, my apologies (sometimes I can debug people's issues, but not always)

-----

wow... a stupid spacing issue (quest is usually able to handle spacing, whereas I think many languages don't, so when the spacing causes a problem, we didn't realize it, until you just did now, hehe. GREAT JOB!).

so with the text processor commands, NO spacing (around the OPERATOR symbol~character, anyways)

(in normal quest scripting, you CAN have spaces around the OPERATOR symbol~character)

RedTulip
Yup. I can't believe it was just some spaces. xD Thanks so much for your help, by the way!

Silver
Yeah, I think spaces matter in the text processor where as they don't in scripting really.

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

Support

Forums