george wrote:I've heard people talking about a javascript eval function. Could you explain to a novice why that doesn't do the job?
Gladly.
Basically, JS.eval takes a string and converts it into regular JavaScript.
Example:
JS.eval ("alert('Hello, world!')")
This would make a popup message saying 'Hello, world!'
However, if you wanted to do something more complex, like this for example:
function randomFunction(param1, param2) {
ASLEvent ("OutputText", "Param1: " + param1 + ", Param2: " + param2);
}
// This basically means that if you use the JavaScript function 'randomFunction("hello", "world")', Quest will print 'Param1: hello, Param2: world'
That wouldn't be possible in a library currently, as you would have to have a way to put it all into a string, but the only way to do that right now is to remove the line breaks. Imagine if you have a lot of line breaks though. That would take a while -- not to mention attempting to edit one huge line of JavaScript!
Of course, it is possible if you create a new object in the library and give it a JS attribute or something, but that's not very efficient.
Does that make any sense to you?