Outerra forum

Anteworld - Outerra Game => Modding: Importer, Tools & Utilities => JavaScript development => Topic started by: SteelRat on March 31, 2015, 03:31:14 pm

Title: console metod - $con.exec(str)
Post by: SteelRat on March 31, 2015, 03:31:14 pm
The script is invoked from the console
Code: [Select]
/*
Spawn logic object
*/

// Test block
var obj = "ptm/Logic/Logic";
var initCode = 'this.log_inf("Object logic created");';
$con.exec(".load ptm/initPtm.js"); // error: Unexpected token ILLEGAL
print("createLogic loaded");

//var win = open("ptm/createLogic.html");

I can't understand why the error!
Title: Re: console metod - $con.exec(str)
Post by: cameni on March 31, 2015, 04:14:35 pm
I'm not getting any such error, so probably an error in ptm/initPtm.js?
Title: Re: console metod - $con.exec(str)
Post by: SteelRat on March 31, 2015, 04:27:22 pm
Found a bug but did not understand anything.
The error was in the called file.

It works without errors
Code: [Select]
$con.exec("var $world = $eview.$query_interface('ot::js::world.get')");
$con.exec("var logic = $world.create_instance(obj, #(pos 10), #rot, false)");

And error
Code: [Select]
var $world = $eview.$query_interface("ot::js::world.get");
var logic = $world.create_instance(obj, #(pos 10), #rot, false);