aleReimondo Posted February 7, 2012 Report Share Posted February 7, 2012 Hi!I want to add some custom modifications and extensions to String and other base methods (changes at javascript level).That changes must be visible at any page of the game and while playing the game.Where is the place to add the expression to load my script files ?thanks in advance,Ale.p.d. I have tried to inject scripts in a new page, but when loading another page in the game from main menu, the methods fail execution with error (shown in console)------------------------------------ERROR: Javascript error: s8/8AD.js line 436TypeError: "hello".printMe is not e afunction @s8/8ad.js:436ERROR: GUI: Error executing script s8/8AD.js: Scripting_LoadFile_EvalErrors------------------------------------When I query using console typeof "Hello".printMe it is returned "function" and it is correctly defined. Quote Link to comment Share on other sites More sharing options...
Ykkrosh Posted February 7, 2012 Report Share Posted February 7, 2012 Changing the standard global objects is generally a very bad idea in JS, so don't do that . It's particularly problematic in our GUI system since we have a separate global scope per GUI page, with some magic to resolve properties on the real global object when necessary, and SpiderMonkey's JIT optimisations interact in complex ways with global objects too, so it gets confusing and fragile. Just use a normal function instead. Quote Link to comment Share on other sites More sharing options...
aleReimondo Posted February 7, 2012 Author Report Share Posted February 7, 2012 I use normal functions, all normal functions and delegation; and all works w/o any problem on V8, IE, etc (without surprises, nor limitations and also fast).I see that design can impose us limitations to "protect execution success" and can be not safe/possible to run my frameworks here.IMO the safety at expense of "each page/stage a world" is a severe limit for scripting a game.Is there a simple way to load js code when booting top context? (at root)I am asking for a place to patch the engine to load my file into javascript at boot... as it was part of core js impl.thanks for your time,Ale.p.d.: I am too old to stop when someone say "dont´do that". So if it is possible, I will try; if it is not possible (at js level), it is also ok; I can try to run in one page. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.