#Create global constants (accessible for e.g. from client and server scripts)
15 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
use global and make sure you put it in startup and set the priority to highest at the top of the script
//priority: 1000
global.test = 'test'
actually i'm not sure you have to use global
I'm not sure to understand what are test?
the example i provided makes a global constant named test, which outputs a string that says test.
of course, it can be anything you want, just replace test after global. and replace the output
putting //priority: number at the top of the script makes it prioritized. kubejs loads the file with the highest number priority first within a script folder
Actually, I have this:
startup_scripts/constants/ingots.js
// priority: 1000
global.REPLACED = {};
global.REPLACERS = {};
/* Some code to fill REPLACED and REPLACERS here */
client_scripts/hide.js
// priority: 0
onEvent("jei.hide.items", event => {
for (const item of Object.values(REPLACED))
for (const id of item)
if (!Object.values(REPLACERS).includes(id)) {
event.hide(id);
console.info(`Hiding ${id}`);
}
});
And in client.txt, this error: Error occurred while handling event 'jei.hide.items': ReferenceError: "REPLACED" is not defined.
you need to call it using global still
oh okay
if (!Object.values(global.REPLACERS).includes(id)) {
Okay thank you very much 😄
@feral tulip Unresolved thread still hasn't been closed! If your question was answered, please close this post with </ticket close:1054771505520717835> command!
@feral tulip Unresolved thread still hasn't been closed! If your question was answered, please close this post with </ticket close:1054771505520717835> command!
Ticket closed!