const {dimension} = event;
dimension.runCommandAsync(`say test world init`);
});```
I don't think I have the event -> object part correct. some events and objects have descriptions on the wiki but this one doesn't.
https://jaylydev.github.io/scriptapi-docs/latest/classes/_minecraft_server_1_14_0.WorldInitializeAfterEventSignal.html
is there a way to get the dimension or a player or something I can run commands off of from the initialize event?
#hello world on server initialize?
1 messages · Page 1 of 1 (latest)
afterEvents.worldInitialize doesnt have any property in there
you can just do world.getAllPlayers() for players
world.afterEvents.worldInitialize.subscribe(() => {
for (const player of world.getAllPlayers()) {
player.sendMessage("Hello, World!")
};
})```
I'm trying to run a function ultimately
why worldinitialize though? 🤔
oh
I can do on player join too, I was just curious if I could only do it once
which function is it
custom, it sets up scoreboard dummys
if its for scoreboard
then you prob dont even need dimension
world had scoreboard property
is world part of the world initialize event?
i'm still iffy on how to get those out of the event
const {world} = event;
world.runCommandAsync(`say test world init`);
});```
?
no you just do it like world.runCommand()
assuming youve already imported world from module
its basically what js import { world } from "@minecraft/server";
those are for
https://jaylydev.github.io/scriptapi-docs/latest/classes/_minecraft_server_1_14_0.World.html Is this not comprehensive?
you can use world everywhere
I get the autofill in here but it isn't in the script api doccumentation
ough wait
i just realized world doesnt have runCommand
at this point you could just do js world.getDimension("overworld")
this returns overworld dimension you can use to run command
wait, are you using command to make scoreboard? or just a function
just a function
for future readers EDIT: the say command only works on reload but the function still runs even on startup. I don't think chat gets messages this early
world.getDimension("overworld").runCommand("say test world runcommand");
world.getDimension("overworld").runCommand("function setup");
🙂