#how do I import another file in one file

4 messages · Page 1 of 1 (latest)

flat kernel
#

======the first file======
let multiblock={
pattern:[
[
' ',
' @ ',
' '
],
[
'aba',
'bcb',
'aba'
]
],
keys:{
a:{block:'assemblylinemachines:silt'},
b:{block:'minecraft:fire'},
c:{block:soulBlock}
}
}

export{multiblock}

======the secone file======
import {soul_steel_ingot_multiblock} from './multiblock/soul_steel_ingot.js'

======log======
[23:28:40] [ERROR] ! import {soul_steel_ingot_multiblock} from './multiblock/soul_steel_ingot.js':1: Error loading KubeJS script: server_scripts:recipes/spirit/soul_engulfing.js': identifier is a reserved word: import (server_scripts:recipes/spirit/soul_engulfing.js#1)

frigid dragonBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

plucky notchBOT
#

You can write your code in a codeblock by typing it between the codeblock delimiters:

```js :arrow_left:

ServerEvents.recipes(event => {
event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})

``` :arrow_left:

As an example, :arrow_up: will look like this:

ServerEvents.recipes(event => {
  event.smelting('minecraft:glass', '#forge:sand').xp(.1)
})
#

How to use global?
global is an object accessible in all types of scripts.
It's useful if you want to use a variable between all script types.
Here's a basic example:

global.myVariable = 5
console.log(global.myVariable + 8) //13

Note that you can't define them using let or const.

let global.myVariable = 5 //this will result an error