Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by riceje7

I was wondering how i would go about passing the current ig or ig.game namespace to another javascript method at the global level outside of any module. I need to load it into this this js sandbox console so my players have access to its properties. i have to do so by loading a .js file into the console btu when i do i get an error saying ig is not defined. any ideas?

1 decade ago by Joncom

Can&039;t you do just that, pass your #ig.game variable directly in?

// Some Function That Expects ig.game
function test(game) {

    game.spawnEntity(EntityPlayer);

}

// Pass in game.
test(ig.game);

1 decade ago by riceje7

I am trying to, in the external .js file i have a variable var atom = { os: ig.game}; that is being loaded by way of appending a script tag with the external .js file as the src, to the body of the document. which is supposed to make the code in the file available to the sandbox console. However i get an error saying `atom` is not defined. if i look in the network tab in the chrome developer console it shows the external .js file being loaded so im not sure what i'm doing wrong.

1 decade ago by riceje7

Nevermind i figured it out I was using the console in iframe mode which cuts off the console from accessing the browsers cache of js information. thanks for the help though
Page 1 of 1
« first « previous next › last »