#How to create multiple script file ?

1 messages · Page 1 of 1 (latest)

meager harness
#
{
    "format_version": 2,
    "header": {
        "name": "Système de Heal V2",
        "description": "Heal someone",
        "min_engine_version": [
            1,
            20,
            0
        ],
        "uuid": "022f9ea9-aa7f-4553-b297-2e15ca90509e",
        "version": [
            1,
            0,
            0
        ]
    },
    "modules": [
        {
            "type": "data",
            "uuid": "adef59ee-7cdc-4650-afc0-fb693fb201ec",
            "version": [
                1,
                0,
                0
            ]
        },
        {
            "type": "script",
            "language": "javascript",
            "uuid": "fe23f5cc-da90-478c-915a-c8fb900de67d",
            "entry": "scripts/index.js",
            "version": "1.0.0-beta"
        }
    ],
    "dependencies": [
        {
            "module_name": "@minecraft/server",
            "version": "1.3.0-beta"
        },
        {
            "module_name": "@minecraft/server-ui",
            "version": "1.1.0-beta"
        }
    ]
}```

This is my "manifest.json"
hexed gull
#

the manifest can only link to one file so you need import all the other files from that main file that is run by your manifest

meager harness
#

But when I execute a command, all the command didn't worked and didn't are recognise

hexed gull
#

import "./gui.js"

meager harness
#
import "./gui.js"
import 'scripts/heal.js'
import 'scripts/tp.js'
import 'scripts/furnace.js'
import 'scripts/feed.js'
import 'scripts/help.js'```

Like that ?
hexed gull
#

yes you should just to need change scripts to . So it get the correct file path

meager harness
#

Oh okay, so like that :

import "./gui.js"
import './heal.js'
import './tp.js'
import './furnace.js'
import './feed.js'
import './help.js'```
hexed gull
#

yes

meager harness
# hexed gull yes

[2023-06-23 17:28:57:820 ERROR] [Scripting] Plugin [Système de Heal V2 - 1.0.0] - [index.js] ran with error: [ReferenceError: Module [gui.js] not found. Native module error or file not found.]

#

I have this error on my consol now

hexed gull
#

you don’t have a file called gui that was just my example so you don’t need that import

meager harness
#

Oh, sorry, I understand now