Troubleshooting / Debugging: Issues and Solutions

(filler for getting my edited post/thread, updated/posted)


@ Everyone:

purpose of this thread: to get a 'running' list of various strange/weird/quirky/irritating issues and (hopefully if able) solutions, so we can look here to possibly save us tons of time trying to figure out how to fix the issues/errors with our code not working.

For example, I keep forgetting that (with quest v550) I can't do the 'attr' syntax with Dictionaries, and I spend tons of time trying to troubleshoot the error, not realizing that it's just an error due to using the 'attr' syntax, which doesn't work with Dictionary Attributes (in quest v550), until tons of wasted time later (trying to troubleshoot my code design, when it's just me in using the non-working 'attr' syntax with Dictionary Attributes), as I try to troubleshoot the non-recognized error and thus why my code isn't working, lol.

Please post any quirky/strange/weird/irritating troubleshooting/Debugging issues, along with quest version, and (if/when able) their solutions (and label it as fixed for what version/s)

(this is NOT for simple typos-mistakes, nor any faulty code logic/design, this is for various quest issues that effect everyone)


  1. (see below, quest v550)
// this syntax WORKS for Dictionary Attributes:

<NAME_OF_DICTIONARY_ATTRIBUTE type="NAME_OF_TYPE_OF_DICTIONARY_ATTRIBUTE">
  // CONTENT
</NAME_OF_DICTIONARY_ATTRIBUTE>

// this syntax does NOT work for Dictionary Attributes:

<attr name="NAME_OF_DICTIONARY_ATTRIBUTE" type="NAME_OF_TYPE_OF_DICTIONARY_ATTRIBUTE">
  // CONTENT
</attr>

// I don't know if Pixie fixed this with the newer versions of quest (can someone let me know?)

  1. I was not aware of that. Another way to put that is that you cannot have a space in the attribute name if it is a dictionary or list, but you can for strings, numbers, scripts and objects.

  2. This is not an error, it is doing what it should. It evaulates both conditions, and then does the AND on them. Some languages support a feature called short-circuit evaluation which is what you want here, but not Quest.


In some languages if ("1" = 1) { will automatically cast the second variable to the same type as the first, and be true. In others, comparing different types is always false. In Quest it's a fatal error, which I've only seen in strongly-typed languages.

If you only pass one argument to IsRegexMatch, it will give the error Unexpected character: ". Error message completely unrelated to the actual error.

Some languages support a feature called short-circuit evaluation which is what you want here, but not Quest.

To be more precise, evaluation is short-circuited, but the expression is validated first.
So if (function1(o) and function2(o)) { will only execute function2 if the first one is true. But (I think) if the second condition references a function that doesn't exist, it will error out before executing either.


@ Pixie and MrAngel:

since you saw my #2 before I edited it out:

I actually got it to work fine, the problem was some (more/hidden: unknown initially) stupid mistake(s) on my part, and not what I thought was a quest issue

// this WORKS:
// (pseudocode, more skeletal example, as I'm lazy, lol)

my_variable = split ("red;blue;yellow", ";")

if (TypeOf (my_variable) = "string" and DictionaryContains (DICT, my_variable)) {
  // scripting
} else if (TypeOf (my_variable) = "stringlist") {
  // scripting
} else {
  // scripting
}

In some languages if ("1" = 1) { will automatically cast the second variable to the same type as the first, and be true. In others, comparing different types is always false. In Quest it's a fatal error, which I've only seen in strongly-typed languages.

I consider that a bug, and it might get fixed one day. As a temporary fix, there is an Equal functions.


Deleting Library did not remove it completely from my project

I recently loaded the ClockLib.aslx library; and it had a bug or two so I deleted it from my project. However, I am now getting an "Error running script: Object reference not set to an instance of an object." error every time I input any action. I know that the Clock library captures every action so that it can increment the time, but I cannot figure out how it did it or find the object/code that was affected. Can a deleted library leave remains of its code (maybe overridden functions) in the project?


Hello.

Did you change game_clock.clockmsg or anything like that? (Just taking a stab in the dark.)


If you post a sample of the code, we can do our best to find something for you.


I didn't. Could the process of loading the ClockLib libary update other libraries' functions?


Never mind. I figured it out. It was unrelated to ClockLib. I had added a timer object right around the same time as I loaded the ClockLib, and the error was in the timer. Thanks for your quick response, and I apologize for any time you spent on this issue.


Log in to post a reply.

Support

Forums