#Script API General

1 messages · Page 122 of 1

sour sedge
amber granite
#

Yao

#

It s simple as that ☠️ damn

#

Damn damn damn

midnight ridge
stray spoke
sour sedge
#

I think every person on this server has felt dumb at some point. Coding can be pretty humbling

#

And a lot of the "rules" with Mojang api don't make obvious sense

stray spoke
#

I only love coding because I always talk inside my head so solving code problems and making logics is kinda satisfying for me

#

Tbh I don't have someone to talk to everyday, I'm alone, I'm always talking to myself, bored, so I code

#

So I don't know if it's right that I chose BSIT as my career course, is it my passion to code, or is it just me being bored and lonely

#

That I just stuck myself in the phone everyday doing coding

#

And my only happiness is when I created something amazing for the first time even if its small

#

Because nothing in my life has something special to be happy about except this coding

#

Dam what am I saying

amber granite
#

Whenever i see it i feel so f dumb

#

Like they fix 10issues/second

#

And write big texts in small amount of time

#

I need like 10 days ro do this simple thing

amber granite
sour sedge
#

Eh I've even taught C++. A long time ago. A lot of the blowhards knew the least.

Learning means constantly having to face "I don't know" and "that doesn't seem to make any sense". So does debugging.

#

And it's always hard esp at the start.

#

My course got everyone to learn a really unfamiliar difficult language as the first subject bc so many people came to it with C and thought they knew everything. This way, they would be humbled and learn. I did.

#

So I always want to encourage people who are starting out. And even people who know C++ might not know why their custom skin isn't loading (I didn't til I searched).

amber granite
#

Bro c is nothing compared to c++

sour sedge
#

Not bro, but yeah, I know. Object oriented was a whole new game.

amber granite
#

Yeah

#
  • i found something interesting in c++
#

Whenever u ask experienced person about thing, it tell u that the behaviour in underfined or something

#

Like
i++ + i ;

#

Or something it tells u it have undefined behaviour due to the c++ different compilers

#

Like there is gcc and clang

#

And another one

#

It s uncertain unlike other programming language

#

And u need to think twice before coding anything

sour sedge
#

Yeah it's to do with optimisation, you have to code very carefully and precisely because the compiler will not make checks. If you don't tell it exactly what it wants, you'll get undefined behaviour, and then the compiler is free to interpret that however it wants - because you weren't precise enough.

It really is a high-level portable assembly language, the object oriented and so forth provides a bit of abstraction but it's really pretty close to the metal. (Does make it more efficient than the java language though.)

i++ + i isn't valid code because the C++ standard says this is between two sequence points (I believe it's a bit more complicated now) - so there's no particular order set out to compile between these points (in this statement). Which comes first? The incrementing of i++ or the adding of i to itself?

The precision is because C++ must map onto all hardware with a guarantee that it will run the same every time with defined behaviour, with exactly what you've told it to do. If you give it things that don't make sense, and it had to guarantee it would have the same defined behaviour regardless of compiler, it would have to emulate on some hardware, insert runtime checks, interfere with some of the bare-metal optimisations. So it doesn't hold your hand. Different languages have different purposes. I still appreciate python even though it's crap for big projects, because it makes everything so easy. But there's a reason Cython is so common in libraries, because Python is not that fast.

#

...sorry, that's kinda off topic, i do be yapping.

#

Eh, anyway, good luck with the server! Gotta go.

amber granite
#

Thx

fast wind
#

Is there a way to save a value into a stackable item like a dynamic property?

weary umbra
#

can we use async in customCommands?

wicked girder
#

Whats the best way to detect in the player interact with block event if they are placing a block or just interacting?

weary umbra
warm mason
#

so, u can't

weary umbra
#

I used system.run(async () => {})

warm mason
wicked girder
#

yes but thats the issue, they both run when placing a block

#

I want to check if they are placing a block in the interact event so I have a system the only runs on interaction and not placing a block

wicked girder
#

Best I can think of is just making a list of interactable blocks and checking if it's in that list

#

But I'd rather not

#

There is a lot

#

Thought maybe check if the item is placeable on the block but that would also be a lot

warm mason
#

playerPlaceBlock fires before playerInteractWithBlock, so you could use that to check

#
/** @type {WeakMap<import('@minecraft/server').Player, Number>} */
const PlayerPlacedLastBlockTick = new WeakMap();

world.afterEvents.playerPlaceBlock.subscribe(data => {
    PlayerPlacedLastBlockTick.set(data.player, system.currentTick);
});

world.afterEvents.playerInteractWithBlock.subscribe(data => {
    if (PlayerPlacedLastBlockTick.get(data.player) == system.currentTick) console.warn('Placing');
    else console.warn('Interacting');
});

@wicked girder

wicked girder
#

Hm

#

Alright I'll try that here in a bit thanks

wicked girder
warm mason
weary umbra
#

What tf is this event? packSettingChange

#

How does it work and what does it do

weary umbra
#

still dont get it how is that usefull

wicked girder
#

oh you use after events

#

that wont do

wary edge
weary umbra
#

ohhh now I get it

#

nvm its helpful lol

weary umbra
#

is there away to grow sapling with script?

wheat condor
#

What's the component to add armor to mobs?

thorn flicker
#

you need to use the replaceItem command

#

because you can only get the equippable component on players

thorn flicker
wary edge
weary umbra
#

like crops you can set there permutation

wheat condor
weary umbra
wheat condor
#

also i think you have to grab it from bds server since there isnt no feature mentioned in minecraft place syntax]

wheat condor
#

that was 1 year ago'

thorn flicker
weary umbra
wary edge
weary umbra
#

but it doesnt let me placing the tree even though there is something onto of the location

wary edge
#

What is the error?

#

do placeFeature(feature, locaiton, true) and wrap it in trycatch to get the error

weary umbra
#

[Scripting][error]-Error: minecraft:oak_tree_feature could not be placed. The following features had failures:
minecraft:tree_feature: Trunk could not be placed
at <anonymous> (growFeature.js:44)

wary edge
#

There's the issue, seems like will need to modify the feature to allow it to be placed there

wary edge
weary umbra
wary edge
#

Up to you.

weary umbra
#

If I change the default one does it apply to every tree type?

#

I get an error

[Entity][error]-Missing identifier in spawn rule file

[Entity][error]- Failed to load spawn rules

wary edge
#

That has nothing to do with the Features.

wheat condor
weary umbra
weary umbra
wheat condor
#

Trees can’t grow if they are near another one

weary umbra
wary edge
weary umbra
#

So you cant modify it

wary edge
weary umbra
#

how so? Is there any docs about features?

wheat condor
empty yoke
#

Does anyone know why rotation during teleport() doesn't work?

stray spoke
#

Is it only me that finds (arg, arg)=>{..} satisfying

lethal bramble
mystic harness
#

is it possible now to see whats inside a player's echest

hidden perch
#

is it possible to make ridden enttiy moves using applyImpulse?

terse pulsar
#
entity.applyDamage(trueDamage, { cause: "entityAttack"})
#

Im using It correctly?

#

trueDamage is a var

last latch
#

Wdym it’s Not json UI and it doesn’t lag when you stop the loop

wheat condor
cursive fog
#

Does anyone know what is the class of vector3?

stray spoke
#

isn't it like {x: ?, y: ?, z: ?}

cursive fog
stray spoke
#

It doesn't need imports

#

It's basically like an interface (template object)

#

Means you need to type it as {x: int, y: int, z: int}.
While vector2 is just {x: int, y: int}.
int is number type value

amber granite
#

Hi guys , so i applied the "min_engine" solution in the player.entity.json , but now the skins get showen but player dosen't get animated

#

How to fix it plz ☠️

cursive fog
cursive fog
#

hi guys how do you keep a function running repeatedly?

snow knoll
cursive fog
snow knoll
sage portal
#

isn't this what tick.json is for?

#

oh wait I'm in the scripting channel lol, thought this was just add-ons

empty yoke
stray spoke
knotty salmon
empty yoke
knotty salmon
empty yoke
# empty yoke

Now I'm trying again in game to see if it actually doesn't work

empty yoke
# empty yoke

It doesn't work, I'm trying but the rotation doesn't seem to have any effect.

cursive fog
empty yoke
stray spoke
warm mason
#

Horrifying tests

warm mason
#

I saw a ping

#

Hmm

amber granite
#

Guys is it possible to override border block behaviour?

viral wigeon
#

he scammed you if he charged more than $15 for that

wicked girder
#

is it possible to check if a player has chat open or not?

inland merlin
#

userBusy maybe?

#

Loop

cursive fog
cursive fog
#

how do i stop system.runInterval?

stray spoke
#

put the interval on a variable first then use system.clearRun(variable name)

For example:

const rep = system.runInterval(()=>{
  world.sendMessage("Hello")
},20)

system.clearRun(rep)
cursive fog
#

ohh

#

alr thanks

stray spoke
#

For example with condition:

let i = 0
const rep = system.runInterval(()=>{
  i++
  world.sendMessage("Hello")
  if(i > 5) system.clearRun(rep)
},20)
cursive fog
stray spoke
cursive fog
# stray spoke Depends on the logic of your code, what is it that you type
world.afterEvents.itemUse.subscribe(ev => {
    const { source: player, itemStack } = ev
    if (itemStack.typeId !== gun) return
    const shoot = system.runInterval(() => {
        shootProjectile('arrow', player.dimension, player.getHeadLocation(), player.getViewDirection(), {
            power: 10,
            uncertainty: 0 + recoil,
            owner: player
        })
    }, 2)
    recoil + 2

    world.afterEvents.itemStopUse.subscribe(ev => {
        const { source: player, itemStack } = ev
        if (itemStack.typeId !== gun) return
        system.clearRun(shoot)
        if (recoil > 2) recoil = 0

    })
})
#

kinda like this

#

if it gets to system.clearRun will it clear on all player

#

because its directly linked to system ehh

stray spoke
#

Scope variable must be public to be able to call it on itemStopUse

#

If your purpose is to stop the repeating function on itenStopUse, you gotta adjust to other methods

cursive fog
stray spoke
#

yeah, it will error that variable shoot is undefined

#

I have suggestions tho

cursive fog
cursive fog
#

@stray spoke ye btw dw its alr infact thats what i intend

stray spoke
#

My suggested formula is

On item use -> Activate run interval "shoot" -> if player has tag "stop" -> clearRun "shoot" and clear tag "stop"

On item stop use -> player add tag "stop"

warm mason
#

the variable in the correct scope

#

buut

stray spoke
#

My apologies

warm mason
#

Using an event within an event is very bad unless you use unsubscribe later.

stray spoke
#

Yeah I don't really do that also, unless if I put it in export function and use it on main

cursive fog
#

btw guys just asking how do you export (if thats what its called) a function from other js

warm mason
# cursive fog btw guys just asking how do you export (if thats what its called) a function fro...
MDN Web Docs

The export declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the import declaration or dynamic import. The value of an imported binding is subject to change in the module that exports it — when a module updates the value of a binding that it exports, the update will be ...

stray spoke
#

Do yall think I can use custom command registry event ingame, or it's just for startup

#

For example I'll activate adding custom commands if I itemUse

warm mason
stray spoke
#

Alright thanks

cursive fog
#

@warm mason pardon me but how do you define an item on setDynamicProperty

warm mason
#

They only support string, number, boolean and Vector3

cursive fog
warm mason
cursive fog
warm mason
#

It doesn't say that it can save ItemStack

#

Or

#

Wait

#

Do you mean how to set a dp on an item?

cursive fog
warm mason
#

Oh

#

Well ItemStack.setDynamicProperty

#

As usually

cursive fog
warm mason
#

And if u make any changes in ItemStack u need to set it back to the inventory

cursive fog
#

so where do i define the item i wanna put dynamic property

warm mason
cursive fog
warm mason
cursive fog
# warm mason Show code
import { world, system, Dimension, ItemStack } from "@minecraft/server"
import { shootProjectile } from 'bullet.js'

const gun = "vdg:akm"
let recoil = 1
const item = "vdg:akm"

ItemStack.setDynamicProperty('vd:akammo', 30)


world.afterEvents.itemUse.subscribe(ev => {
    const { source: player, itemStack } = ev
    if (itemStack.typeId !== gun) return
    if ('vd:akammo' != 0) return
    const shoot = system.runInterval(() => {
        shootProjectile('arrow', player.dimension, player.getHeadLocation(), player.getViewDirection(), {
            power: 10,
            uncertainty: 0 + recoil,
            owner: player
        })
    }, 2)
    recoil + 2
    'vd:akammo' - 1
    world.afterEvents.itemStopUse.subscribe(ev => {
        const { source: player, itemStack } = ev
        if (itemStack.typeId !== gun) return
        system.clearRun(shoot)
        if (recoil > 2) recoil = 0

    })
})
#

idk i tried making an item const

warm mason
#

You need an instance to use it

#

Like

#
const item = new ItemStack("stick");
item.setDynamicProperty("id", 123);
cursive fog
#

oh

cursive fog
cursive fog
#
const gun = "vdg:akm"
let recoil = 1
const item = new ItemStack("vdg:akm");
item.setDynamicProperty("vd:akammo", 30);
warm mason
cursive fog
stray spoke
mystic harness
#

can i add glint to an item without actually enchanting it in the first place

warm mason
mystic harness
#

oh okay thanks

lilac glacier
#
import { system, world } from "@minecraft/server";

system.afterEvents.scriptEventReceive.subscribe((event) => {
    const { id, sourceEntity } = event;
    if (id !== "jockey:riding" || !sourceEntity || !sourceEntity.isValid) {
        return;
    }

    try {
        const viewDirection = sourceEntity.getViewDirection();

        const horizontalStrength = 1.5; 
        const verticalStrength = 0.5;   

        const impulseVector = {
            x: viewDirection.x * horizontalStrength,
            y: verticalStrength,
            z: viewDirection.z * horizontalStrength
        };

        sourceEntity.applyImpulse(impulseVector);

    } catch (error) {
        console.warn(`Error in jockey:riding: ${error}`);
    }
});```

im trying to do a script where it only makes the entity  move on the ground by the applied impulse but instead,  when you trigger the event using /scriptevent it launches the entity in mid air for a bit. 

any solutions?
wheat condor
wheat condor
stray spoke
#

Could just type it as abbreviation

#

verStr and horStr or sum

lilac glacier
wheat condor
#

There is a VerticalStrength and you are asking why the entity is getting moved up

lilac glacier
#

💀

stray spoke
#

what I've said is just to make coding less typing and concise atleast

#

It doesn't relate to the api

silver agate
#

How can i use a const/let from other file? I want to make a let checker that checks if its raining, and I need onWeatherChange event to update the let to the actual weather, but how can I use this let on another file?

stray spoke
#

You gotta use export and importit to the file uouwant to use it

#

for example

//test.js
export const word = "Hello" 

Then in hour main.js

import {word} from 'path/to/test.js' //replace this

console.log(word)
silver agate
silver agate
silver agate
#

Ok

#

Ty

fast wind
#

How can I get the name that the player sees when selecting the item?

amber granite
silver agate
#

Another doubt: can I put more than one world after/before Event into 1 file?

warm mason
snow knoll
#

You'd probably reach a word limit before that

wheat condor
prisma shard
snow knoll
prisma shard
#

ok

snow knoll
#

Which includes situations like 2 entirely different types of events on the same file

last latch
viral wigeon
#

Maybe you think that cuz u would do the same

#

Take advatange of someone who doesn't know how easy it is to fix those errors and charge hella money

#

You right in one thing and is that is more ethical than a scamm

#

But scamm also can be taken as taking advantage of someone bc they dont know the real value of something

#

It's like someone has a diamond worth millions and you convince him that it's a fake diamond to buy it cheaper

#

It's a scamm

last latch
viral wigeon
last latch
#

You said it is a scam and at the same time it is not a scam

viral wigeon
#

I didnt say it was not

#

I said its more ethical than a scamm

#

lol

#

Diferrent things

last latch
#

So what is it if not a scam

viral wigeon
#

It is a scamm

last latch
#

A scam cannot be more ethical than scam

#

Scam is one thing

viral wigeon
#

It's in the middle of both

last latch
#

Same as everything else

#

It’s like saying diamonds is a scam

#

Like 90% was bought by one company

viral wigeon
#

The scamm occurs when u try to hide the truth about it's value

last latch
#

Not a scam just overpriced

last latch
#

Diamonds are cheap

#

Their value has been increased by one company

#

And yet people buy it and are happy

#

Same about Rolexes cars and basically everything

#

Same as me charging marketplace 25 euros an hour and not 15 dollars for one project

round bone
silver agate
amber granite
#

Hillo guys so i gotta ask

#

What is the msot effecient way to make an area forbidden to enter by certain players

#

Like border block does

round bone
#

Is your area a regular hexahedron?

amber granite
#

Cube

#

Cubic area

silver agate
#

“Cubic area” /j

#

A square you mean

amber granite
#

☠️ damn i mean hexahedron volume

silver agate
#

Volume? Wasnt that area?

#

Y is useless in this case, so i think you must look within area things

amber granite
#

Man don't ragebait me ☠️

#

Jk

amber granite
silver agate
amber granite
#

Yep

silver agate
#

Oh

amber granite
#

Totally forbidden

silver agate
#

Okie

amber granite
#

Like if u enter it it will tp u to the last loc

gaunt salmonBOT
silver agate
# amber granite Like if u enter it it will tp u to the last loc

What if you do this:
i will use tpPlayer for simple. This method doesn’t exist.

const loc = player.location;
if (loc.x > 100) tpPlayer(100, loc.y, loc.z)
if (loc.x < -100) tpPlayer(-100, loc.y, loc.z)
if (loc.y > 100) tpPlayer(loc.x, 100, loc.z)
if (loc.y < -100) tpPlayer(loc.x, -100, loc.z)
if (loc.z > 100) tpPlayer(loc.x, loc.y, 100)
if (loc.z < -100) tpPlayer(loc.x, loc.y, -100)
#

I used a cube with side value of 200, and centered.

#

For example

amber granite
#

I mean i want the right way to implement it

#

I have no problem with the logic

silver agate
#

This should work

#

Just look for tp methods

#

If there is none, use runCommand

amber granite
#

Which event i must put it in ?

silver agate
#

One min, i will create the script for ya

amber granite
#

Thx u

silver agate
#
import { world, system } from “@minecraft/server”;

system.runInterval(() => {
for (const player of world.getAllPlayers()) {
const { x, y, z } = player.location;
if (x > 100) player.runCommand(`tp ${player.nameTag} 100 ${y} ${z}`)
if (x < -100) player.runCommand(`tp ${player.nameTag} -100 ${y} ${z}`)
if (y > 100) player.runCommand(`tp ${player.nameTag} ${x} 100 ${z}`)
if (y < -100) player.runCommand(`tp ${player.nameTag} ${x} -100 ${z}`)
if (z > 100) player.runCommand(`tp ${player.nameTag} ${x} ${y} 100`)
if (z < -100) player.runCommand(`tp ${player.nameTag} ${x} ${y} -100`)
}
}, 5);
silver agate
silver agate
#

(Already edited)

dawn zealot
silver agate
dawn zealot
#

yeah

silver agate
#

Oh

silver agate
dawn zealot
dawn zealot
silver agate
#

What is this?

dawn zealot
#

like this

silver agate
#

My friend has a site that does this

#

I wrote the script directly on discord

snow knoll
amber granite
#

Thank u

silver agate
#

Np

round bone
jolly citrus
#

how do i update @minecraft/core-build-tasks

#

mine's still deployinmg my projects to the mc uwp folder

#

im so confused bro

#

i literally manually edited the package to remove any trace of uwp paths

#

and it still somehow

#

manages

#

to deploy there

round bone
jolly citrus
round bone
jolly citrus
#

how do i fix the just script bro

#

core-build-tasks is somehow told im on mc uwp

#

but im not

#

so now its trying to deploy there

#

and im not specifying it anywhere

round bone
#

Isn't it more related to #1339727065846648906 ?

jolly citrus
#

why would it be

#

idk what editor-mode is

#

i'm using core-build-tasks to deploy my typescript project

round bone
#

Why do you need a library to deploy your TypeScript project?

jolly citrus
#

idk because that's what the docs told me

#

to do

#

to build it

round bone
#

Just compile it down to JS or use tool like Regolith

round bone
jolly citrus
#

this is better

#

it directly sends everything to mc

round bone
#

This one also sends everything directly into Minecraft

jolly citrus
#

i fixed it im stupid

#

env is excluded from ctrl f

#

or vsc find i mean

round bone
#

You can opt it in .vscode/ directory I think

jolly citrus
#

yeh i can

#

but the mc product type was defined there

#

thats why searching for 8weky/uwp didnt find anything useful

#

xd

round bone
#

😅

amber granite
#

@carchi77 ma boy i was looking for u

gaunt salmonBOT
stray spoke
#
import { world, system } from "@minecraft/server";

const clamp = (v, min, max) => Math.max(min, Math.min(max, v));

system.runInterval(() => {
  for (const p of world.getAllPlayers()) {
    const { x, y, z } = p.location;

    const nx = clamp(x, -100, 100);
    const ny = clamp(y, -100, 100);
    const nz = clamp(z, -100, 100);

    if (x !== nx || y !== ny || z !== nz) {
      p.teleport({x: nx, y: ny, z: nz})
    }
  }
}, 5);
wary edge
#

shudders Using runCommand

stray spoke
#

Og yeah I forgot

amber granite
#

Guys is carish77 is wake up ?

wary edge
#

Baffles me that JS still doesn't have a built in clamp function.

amber granite
#

I need him in important thing about his better boats add-on

wary edge
amber granite
#

._.

#

Oh yeah

#

You are right, my bad

silver agate
near siren
#

Noticed some new important stuff in minecraft-server, whats up with the SetBookContentsFunction class and others like it?

fickle dagger
#

is there any specific requirements to use dynamic properties?

#

I tried using it and all of my scripts stopped working

wary edge
fickle dagger
#

yeah, but almost all of them are related to block scripts

#

let me try checking for ones that stand out

#

yeah no clue

#

all of the content log error is only filled with missing blocks error

#

and all of those blocks have custom components

#

so I wonder what I'm doing wrong

#

does it have to be in the main js file perhaps?

#

when I removed the dynamic property thing it starts to work again

wary edge
#

What's the dynamic property code?

wary edge
#

Is your custom comp9nents failing to register

fickle dagger
#

yes

#
export function MONEY_EXCHANGE_DYNAMIC_PROPERTY(){
    const moneyPerItem = moneyPerItem ?? 1000;
    const itemPerMoney = itemPerMoney ?? 1000;
    const setMoneyPerItem = world.setDynamicProperty('felix:money_per_item', moneyPerItem);
    const setItemPerMoney = world.setDynamicProperty('felix:item_per_money', itemPerMoney);
    return moneyPerItem, itemPerMoney;
}
MONEY_EXCHANGE_DYNAMIC_PROPERTY();```
#

here's the function

gaunt salmonBOT
wary edge
fickle dagger
#

hmm I see

#

I guess I'll have to look into that

granite badger
#

Is this code simplified cuz that's not valid syntax...

fickle dagger
#

was worldLoad replaced by something else or is it still this

fickle dagger
granite badger
#

In js you can't have multiple "things" returned from a function like tuple

fickle dagger
#

oh

fickle dagger
#

I see

wary edge
#

You can do [a, b]

granite badger
#

yeah or an object, but not like return a, b

#

I saw the code in #debug-playground

wary edge
granite badger
#

python

fickle dagger
#

cool

#

thank you smokey

fickle dagger
#

wait does that mean I can't use it to change the dynamic property value in other functions then?

#

if so then that sucks

wary edge
fickle dagger
#

and they can change without world reload?

wary edge
#

Yes.

fickle dagger
#

hell yeah

deep arrow
wary edge
deep arrow
#

yeah

#
def f():
    return a, b
x, y = f()

like this in python

deep arrow
wary edge
#

All of these are Tuples, yet they require it to be defined via their object or using []

deep arrow
#

Indeed, funny thing i learned something i didnt know before with that ts example

#

didnt know you could do that

shut citrus
#

how to add custom hotbar/ slot in player's inventory?

amber granite
#

Custom hotbar slot ?

#

U mean intierly new slot bar ?

terse pulsar
#

What does the getComponent read on hunger, the current have of missing hams or the left ones?

shut citrus
#

I want to add a secret hotbar to store specific items

cursive fog
#

Does anyone know how to make an entity render much farther away?

warm mason
prisma shard
#

lemme find it

#

a guy named ItzRiyo found a secret method to add another hotbar slot, but i don't know if the slot is fully functional

#

btw #1067869374410657962 would be perfect place for this

warm mason
prisma shard
#

huh

#

i cant find it tho i saw it somewhere

warm mason
#

Even modifying the inventory component in player.json doesn't help, as far as I remember

prisma shard
#

I have no idea either

#

Ohhh

#

found it

warm mason
prisma shard
#

literally a cheating pack

thorn flicker
#

its a resource pack though

#

how does this work

#

lol

prisma shard
#

Yo holy fuck man you do not lose them when died 💀💀

thorn flicker
#

how is that even possible with just a rp

#

tf

prisma shard
#

He showed proof 'Keep Inventory' was turned off

prisma shard
thorn flicker
#

waiting for an hour just to download it

#

gotta love linervertise

warm mason
prisma shard
# thorn flicker waiting for an hour just to download it

also if ur downloading the pack to see how it works, download this latest one, the one video i sent was outdated
https://www.youtube.com/watch?v=jZsInYzB4ag&t=136s

Utility Inventory V0.3 RELEASE - Texture Pack for Minecraft Bedrock Edition

subs to my 2nd channel for sneak peaks
https://youtube.com/@hiwatashi157

🔴 Subscribe if you want another texture pack because i will make it until i run out of ideas!
❔ If you have any ideas, you can send it to the comments in my video!
...

▶ Play video
thorn flicker
#

and no I didnt want to see how it worked, I dont look at others people files, I just wanted to use it for a min

#

and see if it was just a resource pack

prisma shard
#

it is xd

thorn flicker
#

just wanted to check lol

warm mason
#

More of a cheat than an additional slot for something

thorn flicker
warm mason
warm mason
#

Even entity equipment slots have more options

warm mason
thorn flicker
warm mason
#

That's why I say it's more of a cheat because even Minecraft doesn't see it as a slot

thorn flicker
#

no one is gonna argue this is not cheating

thorn flicker
#

and if they do...

warm mason
#

Well, that's not what we need anyway

prisma shard
thorn flicker
#

so like a safe pocket in arc raiders

#

or whatever its called

#

also merry christmas to whoever celebrates it

last latch
#

Adding new slots crashes the client, so new slots seems like crap

thorn flicker
last latch
thorn flicker
#

you could always do it yourself

shut citrus
#

Is it possible to create a custom one?

jolly citrus
#

Been in da works for like the last year im too lazy for mc

warm mason
runic crypt
#

how do i summon fireworks that explode?

midnight ridge
#

trying to make something match the beacon how does it looks?

amber granite
#

?

supple perch
#

but I'm confused

#

is it pointing to a location?

#

or is it pointing to what will happen when you use a move/ability??

amber granite
#

Why no one is online today ☠️

wary edge
amber granite
#

Oh , we don't have Christmas in my country ☠️

jagged gazelle
#

Sup people

#

After 4 months

wise lichen
#

One question: how can I make it so that when I crouch and right-click on an entity, it disappears and an item appears in its place using scripts?

jagged gazelle
#

Item appears like spawn it?

wise lichen
#

So the item appears lying on the ground right where the entity disappeared.

jagged gazelle
# wise lichen So the item appears lying on the ground right where the entity disappeared.
import { world, system, ItemStack } from '@minecraft/server';

world.beforeEvents.playerInteractWithEntity.subscribe(({ target, player, itemStack, beforeItemStack, isFirstEvent }) => {
  if (target.typeId !== 'minecraft:armor_stand' || !player.isSneaking || !isFirstEvent) return;

  system.run(() => {
    target.dimension.spawnItem(new ItemStack('minecraft:stick'), target.location);
    target.remove();
  });
});```
wise lichen
jagged gazelle
#

Spawn first then remove

small depot
wise lichen
# jagged gazelle Spawn first then remove

It works fine, the thing is it works even if you just right-click, but I need it to happen when you crouch and right-click because the entity I want is mountable.

jagged gazelle
wise lichen
jagged gazelle
wise lichen
# jagged gazelle remove **!** before the sneaking

something did


world.beforeEvents.playerInteractWithEntity.subscribe(({ target, player, itemStack, beforeItemStack, isFirstEvent }) => {
    if (target.typeId !== 'minecraft:armor_stand' && player.isSneaking && !isFirstEvent) return;

    system.run(() => {
        target.dimension.spawnItem(new ItemStack('minecraft:stick'), target.location)
        target.remove();
    });
});```
wise lichen
#

It continues to drop a stick just by right-clicking on the entity without needing to crouch.

wary edge
#

Pretty sure you need to use || not &&

jagged gazelle
#

oops, yeh you actually need to use or

#

Sorry bout that...

jagged gazelle
wise lichen
midnight ridge
midnight ridge
supple perch
wise lichen
# wary edge Pretty sure you need to use || not &&

How do I make an entity disappear when I right-click and leave an object on the ground? For example, if I have the Admin tag and right-click on an armor stand, it disappears and leaves a stick. How do I do this?

wary edge
wise lichen
wary edge
wise lichen
terse pulsar
#

Is possible tô cancel the /kill command like the beforeChatSend, event.cancel

#

Something like that?

cyan basin
#

You can only technically disable the kill command if you use a Bedrock Server. Otherwise no, you won't be able to disable/cancel it

whole saddle
#

Hello, I'm trying to make a dash that propels the player into the direction he's looking, but the applyKnockback function changed and now I don't quite know how to take the y axis into consideration. Can anybody help?

const dir2 = player.getViewDirection();
player.applyKnockback({x: dir2.x*6.5, z: dir2.z*6.5}, 0.5);
supple perch
whole saddle
#

ohhh yeah thanks

supple perch
cursive fog
#

how do you minus a number on item dynamic property?

cursive fog
# supple perch what

so i have a item that uses dynamic property how do you minus the value on a dynamic property

supple perch
#
const prop = item.getDynamicProperty('key');
if (typeof prop === 'number') item.setDynamicProperty('key', prop - 1);
#

i still don't think i understand what you mean, but i believe that's what you want

cursive fog
supple perch
#

uh

cursive fog
#
world.afterEvents.worldLoad.subscribe(() => {
    const item = new ItemStack("vdg:akm");
    const ammo = item.setDynamicProperty('vd:akammo', 30);

    world.afterEvents.itemUse.subscribe(gn => {
        const { source: player, itemStack } = gn
        if (typeof ammo === 'number') item.setDynamicProperty('vd:akammo', ammo - 1)
        if (item.getDynamicProperty('vd:akammo') == 0) empty + 1
    })

})
supple perch
#

just source.getDynamicProperty('key'): value

cursive fog
#

idk if this is right

supple perch
#

wait I'm not too sure

#

gimme a second to verify if the dps are saved on the item entity or the item

cursive fog
supple perch
#

it's on the itemstack, not the itemstack entity

#

should work i think

supple perch
#

I'm fixing the code btw

#

cuz it's flawed

#

like seriously flawed

cursive fog
#

ye its really bad tbh

supple perch
#
world.afterEvents.playerSpawn.subscribe((data) => {
  const { player, initialSpawn } = data;
  if (!initialSpawn) return;
  const inv = player.getComponent('inventory')?.container;
  if (!inv) return;
  const itemStack = new ItemStack("vdg:akm");
  itemStack.setDynamicProperty('vd:akammo', 30);
  inv.addItem(itemStack);
});

world.afterEvents.itemUse.subscribe(data => {
  const { source: player, itemStack } = data
  const ammo = itemStack.getDynamicProperty('vd:akammo');
  
  if (typeof ammo === 'number') {
    itemStack.setDynamicProperty('vd:akammo', ammo - 1);
    if (ammo <= 0)
      itemStack.setDynamicProperty('vd:akammo', null);
  }
})```
here, i don't have time to explain all the details
#

but you shouldn't nest event subscriptions

#

you can subscribe to events even before the world load

#

you should NOT mix local variables and such across events unless seriously needed (it's not needed in this case)

cursive fog
supple perch
#

you tried to give the player a gun with 30 bullets based on the world load event but that won't exactly work, you need to add it to the inventory

cursive fog
supple perch
#

and then you tried to access that item across the itemUse event which is just plain wrong

supple perch
cursive fog
supple perch
supple perch
buoyant canopy
#

is there a node js library that deals with level.dat and/or db files?

#

i want to move a lot of structure files from one world to another, and i don't want to do it manually everytime or export them 1 by 1 with structure blocks.

wary edge
buoyant canopy
broken pawn
#

Null or Undefined if i wanted to check if the used item is "minecraft:air"

#

i mean like if the item in mainhand is empty

devout sandal
#

is this wrong..? Im not sure how to use the new tryTeleport.

function teleportPlayers(island) {
const players = world.getPlayers();
for (const player of players) {
const tpStatus = player.tryTeleport(island.origin);
if (debugging) {
if (tpStatus) {
console.log(${player.name} teleported Successfully);
} else {
console.log(${player.name} teleport Failed);
}
}
}
}

meager zenith
#

is island.teleport a vector3 location

#

island.origin I mean

devout sandal
#

yeah it is

origin: { x: 0, y: 64, z: 0 }

devout sandal
meager zenith
#

no

#

you can just use a dictionary

devout sandal
amber granite
#

Hello guys anyone knows hwo to mimic border_blocks

jolly citrus
#

Just check if the item is falsy

#

Null undefined false 0

#

if (!item) should work
if you need to know for whatever reason whether its null or undefined check what the method you’re using is intended to return

devout sandal
jagged gazelle
jagged gazelle
grim raft
#

yo the log says "it cannot read property getScore of undefined at anonymous" which is "player"

world.afterEvents.playerSwingStart.subscribe((event) => {
  const player = event.player
  const m1 = event.swingSource
  if (player && m1 === "Attack") {
    world.scoreboard.getObjective("left").setScore(player, 1)
  }
})```
#

wait nvm i forgot to add the scoreboard thought i had it

#

now how can i make it wait some ticks to run a 2nd function

jolly citrus
#

My ahh ran /tickingarea list and now the game crashed 😢😢😢

#

Should i be concerned

#

I thought my system was sound but i guess not

fallow minnow
#

am i slow or does this not work any more

#

i am not able to grab the PFID at all

jolly citrus
#

that doesnt make sense

#

how could beforeevent be asynchronous and grab data before tick update

fallow minnow
#

crashes my world

#

Argument of type '(data: AsyncPlayerJoinBeforeEvent) => void' is not assignable to parameter of type '(arg0: AsyncPlayerJoinBeforeEvent) => Promise<void>'.
Type 'void' is not assignable to type 'Promise<void>'.ts(2345)
(parameter) data: AsyncPlayerJoinBeforeEvent

jolly citrus
#

what version of @minecraft/server is this

fallow minnow
#
{
  "dependencies": {
    "@minecraft/server": "^2.5.0-beta.1.21.131-stable",
    "@minecraft/server-admin": "^1.0.0-beta.1.21.131-stable",
    "@minecraft/server-ui": "^2.1.0-beta.1.21.131-stable"
  }
}
jolly citrus
#

umm last time i checked asyncPlayerJoin doesnt exist

#

which is just now

fallow minnow
#

its in server-admin

jolly citrus
#

ah

fallow minnow
#

used to work now it doesnt

jolly citrus
#

normal because its asynchronous

#

unless the docs say otherwise youre not meant to be able to resolve it to anything meaningful

#

Promise<void> wont give you anything meaningful

#

because its

#

just void

fallow minnow
#

it used to actually return the pfid now it returns absolutely nothing

jolly citrus
#

same as a function returning nothing

jolly citrus
#

if not then they removed it

fallow minnow
#

bruh

#

it works on a server though

jolly citrus
#

is server-admin not meant for only servers

#

bds

fallow minnow
#

nope

#

supposed to work for worlds too

#

atleast it did

#

now theres no good way of "permanently" storing data via hardcoded ids 💀

#

average script api update

wary edge
#

Contains types related to administering a Bedrock Dedicated Server. These types allow for the configuration of variables and secrets in JSON files in the Bedrock Dedicated Server folder. These types cannot be used on Minecraft clients or within Minecraft Realms.

fallow minnow
#

i legit used it

#

i had old data saved on worlds

#

in a dynamic property

fallow minnow
#

yeah they simply restricted it to server use only 💀 holy stupid

amber granite
#

I may not have brain gentlemens but i have a question

jolly citrus
#

the numeric id -29283472398 shit

amber granite
#

Is border block is a tickable block ?

fallow minnow
jolly citrus
#

is that an issue

#

do you need to export the data or something

fallow minnow
#

yes

jolly citrus
#

how do you do that

#

genuinely wondering

#

is it straightforward to extract dynamic properties from world or no

fallow minnow
#

i mean i dont need to export the data but i dont have any other way to properly store data with a static id now

wary edge
dawn zealot
#

get xuid

jolly citrus
#

you cant on worlds

fallow minnow
#

yeah

#

pfid was basically offbrand xuid

dawn zealot
#

create ur own id system

amber granite
fallow minnow
#

do dynamic properties stay on players that have changed their username

jolly citrus
#

yes

#

players arent indexed by their username in data that would be a mess

fallow minnow
#

so i can just generate a UUID on that players properties and just grab it via join

jolly citrus
#

but idk what im doing in my world atm is i have kv pairs id-username saved in a dynamic property

fallow minnow
#

yeah i was doing that too

jolly citrus
#

what is the difference

fallow minnow
#

true

jolly citrus
#

itll be different on a different world anyway

#

unless you seed generation by their username, but then that means their id is basically their username just in a different format ...

fallow minnow
#

i would store their pfid as the key and data + username in the values

jolly citrus
#

so it wont protect against gamertag changes

fallow minnow
#

yeah i thought of that too

jolly citrus
#

yeah dont do that

#

its basically a stupid way of indexing by their username

#

just pointless abstraction

fallow minnow
#

i might just switch to server stuff

#

i just wish we could securely grab xuid with server-net

broken pawn
harsh robin
#

is it possible to control someone? @stray spoke

#

like

#

take control of someone

jagged gazelle
harsh robin
#

like they cant move while someone is controling them

jagged gazelle
#

For the camera I'm not really sure since .setRotation() doesn't work on players afaik

#

what can only rotate the player is tp

harsh robin
#

aight

#

ill do the movement only

supple perch
#

yo anyone know how to silence this typing issue without just slapping a good'ol as x

#

?

#
BP/scripts/staffs/necromancer.ts(53,50): error TS2345: Argument of type '"staffs:skeleton" | "staffs:wither_skeleton" | "staffs:zombie"' is not assignable to parameter of type 'VanillaEntityIdentifier'.
  Type '"staffs:skeleton"' is not assignable to type 'VanillaEntityIdentifier'.```
stray spoke
#

silence mentioned

last latch
#

You the #1 guy for this

sharp elbow
#

Looks like VanillaEntityIdentifier can take an EntityType. So I suppose you could create one using EntityTypes.get()

stray spoke
#

I'm just a cat

granite badger
wary edge
jolly citrus
#

Is 54525 bytes a lot

#

For dynamic properties

#

Nvm thats nothing bro the fuck

#

Why does my shit lag so bad when im saving data

fallow minnow
#

bad code

jolly citrus
#

not much you can do wrong i think

#

i parse the dp and edit the parsed ver then autosave every 60 sec or so depends what data it is

#

n divide it into chunks with ~32k bytes max

fallow minnow
#

if so just directly access the data and cache it so ur not constantly saving that many characters

jolly citrus
#

whati m

#

doing

#

thats why i said i parse it and edit it

#

but no its not just players

fallow minnow
jolly citrus
#

cosmetics , market, trades, audits, logs, price history, events

#

shit ton

#

of stuff

#

more than that

fallow minnow
#

yeah idk 54k bytes isnt a lot

jolly citrus
#

they gotta see all the data possible yo

#

this will be like 2 gigabytes if it actually scales

fallow minnow
#

wait is the form lagging when u open it?

jolly citrus
#

no

#

it lags when shit autosaves

#

the form doesnt do anything with dp it just fetches data and calculates

#

maybe itll lag for some people therec can be up to 33 buttons on these

empty yoke
#

Can't you respawn if you die in hardcore via script?

amber granite
#

Hmmm , I don't guess so

empty yoke
amber granite
#

Nbt data i guess

#

But using scripts i don't think that would work

jagged gazelle
#

is there a way to know if the item is charged or not...?

#

Like a crossbow...

amber granite
#

Yes i guess

#

U mean event ?

#
const itemStack = player.getComponent("minecraft:inventory").container.getItem(slotIndex);

if(itemStack.hasComponent("minecraft:charged_item")) {
    const chargedComp = itemStack.getComponent("minecraft:charged_item");
    if(chargedComp.isCharged) {
        console.log("The item is charged!");
    } else {
        console.log("The item is not charged.");
    }
}
jagged gazelle
#

can u send me the docs...

amber granite
#

One min

lethal bramble
#

huh nvm

lethal bramble
jagged gazelle
#

cause maybe I'm tripping since I can't find it in docs and my notes lmao

amber granite
#

I thought it existed

#

Maybe i had Mandela effect or something

lethal bramble
#

isnt it a different item if its charged, idk

#

like charged_crossbow

amber granite
#

Hmmm yeah maybe

#

No maybe not

mystic harness
#

do server-admin works in realms? just wanna use transferPlayer from realm to server

fickle dagger
#

love and hate dynamic properties man

jagged gazelle
#

or only me.

fickle dagger
#

that would be nice yeah

#

the other one is that it would be nice if it worked for me

jagged gazelle
#

I love ur clippy pfp

#

I'm gone for months and they still haven't added a breeding component.

#

that's fine since they added item pickup detection and before event entity hit

#

my ass doesn't need to deal with damage sensors anymore

supple perch
supple perch
supple perch
supple perch
stray spoke
#

Silence mentioned

supple perch
#

ahahha

#

my bad

stray spoke
#

another silence mentioned

snow knoll
warm mason
#

waiting for interesting questions...

snow knoll
#

I have an entity that rides the player with an animation to position it behind the player
I want the entity to always face the player's direction as though it were connected to the player's actual geometry but whenever I face a certain angle range it faces another direction. The video below shows the problem more clearly
How can I remedy this?
Can scripts even remedy this or is it more of another type of solution?
Any ideas are sincerely appreciated

prisma shard
prisma shard
#

idk man

warm mason
#

At least use properties

#

Although I would think about getting the player's rotation through Molang and doing this thing on the client side

snow knoll
#

How do you get it through molang?

warm mason
#

maybe query.bone_rotation would work

snow knoll
#

I thought we couldn't access other entities in molang

warm mason
snow knoll
#

To be clear, does that work through getting the view direction of the riding entity, setting that as a property, and using an animation to set that as the look at animation direction?

warm mason
snow knoll
#

No 😭

#

I used too but stopped

warm mason
snow knoll
#

I gave it the parrot family

#

Cause parrots ride players

#

SmokeyStack accidentally gave me the idea some months ago and I've remembered ever since

warm mason
snow knoll
#

That's a pretty good idea

#

I test some things out and see if an idea I have works

snow knoll
#

Ok so everything is dictated by the player.json file due to the rideable component

silver agate
#

how can I get custom commands params, like on that example:

import { world, system, CommandPermissionLevel, CustomCommandParamType } from "@minecraft/server";

system.runInterval(() => {
  let message = world.getDynamicProperty('aca:message');
  let time = world.getDynamicProperty('aca:messageTime');
  if (message === undefined) message = '';
  for (const player of world.getAllPlayers()) {
    player.onScreenDisplay.setActionBar(`${message}\n` + 'aaaaaaa o aaaaaaa');
  }
  if (time === 1 && message !== '') world.setDynamicProperty('aca:message', '');
  world.setDynamicProperty('aca:messageTime', (time - 1));
}, 1);

system.beforeEvents.startup.subscribe((d) => {
  const messageCommand = {
    name: "aca:message",
    description: "sets a message to appear on actionbar",
    permissionLevel: CommandPermissionLevel.GameDirectors,
    mandatoryParameters: [{ type: CustomCommandParamType.String, name: "aca:message" }],
    optionalParameters: [{ type: CustomCommandParamType.Integer, name: "aca:time" }]
  };

  d.customCommandRegistry.registerCommand(messageCommand, (c) => {
    world.setDynamicProperty('aca:message', messageParam;
    const messageTime = timeParam * 20 || 100;
    world.setDynamicProperty('aca:messageTime',messageTime)
  });
});
stray spoke
#

Btw how to get the owner of the world's Player class

snow knoll
stray spoke
jagged gazelle
#

charged item component please

snow knoll
stray spoke
#

I'm Silenced for a reason

snow knoll
#

Lol

snow knoll
jagged gazelle
snow knoll
#

Do you know if the bow reacts to the itemUse event

jagged gazelle
snow knoll
#

Well then you can fake it

jagged gazelle
#

CROSSBOW type of charged

snow knoll
#

You can still fake it 🙃

jagged gazelle
#

sigh

#

I'm not a dumbass not to know that, WHAT I'M SAYING IS A DIRECT WAY

#

just boolean if an item is charged that's it.

#

I already know how to check it in a different way btw lmao

jagged gazelle
silver agate
snow knoll
cursive fog
#

but just asking

#

what does store means?

silver agate
# silver agate how can I get custom commands params, like on that example: ```js import { world...

well, made that and still didnt work:

import { world, system, CommandPermissionLevel, CustomCommandParamType } from "@minecraft/server";

system.runInterval(() => {
  let message = world.getDynamicProperty('aca:message') || '';
  let time = world.getDynamicProperty('aca:messageTime') || 0;
  if (message === undefined) message = '';
  for (const player of world.getAllPlayers()) {
    player.onScreenDisplay.setActionBar(`${message}\n` + 'aaaaaaa o aaaaaaa');
  }
  if (time === 1 && message !== '') world.setDynamicProperty('aca:message', '');
  if (time >= 1) world.setDynamicProperty('aca:messageTime', (time - 1));
}, 1);

system.beforeEvents.startup.subscribe((d) => {
  const messageCommand = {
    name: "aca:message",
    description: "sets a message to appear on actionbar",
    permissionLevel: CommandPermissionLevel.GameDirectors,
    cheatsRequired: true,
    mandatoryParameters: [{ type: CustomCommandParamType.String, name: 'messageParam' }],
    optionalParameters: [{ type: CustomCommandParamType.Integer, name: 'timeParam' }]
  };

  d.customCommandRegistry.registerCommand(messageCommand, messageHandler)

  function messageHandler(messageParam, timeParam) {
    world.setDynamicProperty('aca:message', messageParam);
    const messageTime = timeParam * 20 || 100;
    world.setDynamicProperty('aca:messageTime', messageTime)
  }
});
warm mason
warm mason
cursive fog
#

@warm mason sorry for ping but is there a good way to add some sort of tick delay?

#

ive been experimenting with runInterval for a while but doesnt seem to work very well\

cursive fog
#

every tick of 2 it sets the variable to 1

#

but after that it goes back to 0

warm mason
#

show code

cursive fog
cursive fog
cursive fog
# warm mason uhh

im planning to use it for something that uses if (delay === 0) return

#

@warm mason sorry for ping but just asking is ts code even viable in the first place?

warm mason
cursive fog
runic crypt
#

Is it possible to force a player to select a specific hotbar slot?

cursive fog
#

@warm mason just one last is it possible to export world.afterEvents stuff?

warm mason
cursive fog
#

is it possible?

warm mason
cursive fog
#

ill try

#

thanks btww

whole saddle
#

is there a way to detect whenever a player hits the air?

whole saddle
#

uhh thanks

#

which version do I need to use?

#

already found it

wheat condor
#

are there some chances oreUI will be compatible with scripting?

supple perch
#

i don't have the link to the message

#

but there's a DDUI class

wheat condor
wheat condor
supple perch
#

data driven user interface

#

it's not how you think it is tho

#

it's not react code

#

and it's not HTML

#

it's more like, cleaner JSON defined UI

wheat condor
#

so its just as bad as json ui?

supple perch
#

and script API getting the power to show/hide and do some stuff with the UIs

supple perch
#

it's waaaaay better

#

it's very easy to understand

#

gimme a sec

wheat condor
supple perch
#

i'll get the link of the message

distant tulip
#

you can't confirm that

supple perch
supple perch
#

seems pointless if not usable

#

#1448357215932121249 message

#

#1448357215932121249 message

#

con master is

#

oh wait

#

you meant actual world gen

#

not script api based world gen

#

mb

wheat condor
supple perch
#

we don't edit nor interact with the web code

#

it's declarative

wheat condor
wheat condor
#

what does declarative mean

open urchin
#

It currently seems like the DDUI files will allow you to create your own screen layouts in JSON using vanilla Ore UI elements as well as inserting Ore UI elements into vanilla screens at different "extension points" that the developers add

supple perch
# wheat condor what does declarative mean

you still use JSON for the UI yes, declarative based system means a system that accepts u declaring information (like say a set of instructions, rules, etc.) and does actions (like making the UI) based on said data.

#

JSON UI != DDUI
they both use the data format JSON for declaring the UIs but their formats are completely different.

distant tulip
#

i mean, are we sure those are screens and not just spaces like how json ui have namespace

supple perch
distant tulip
#

could be just inserting panels into screens

supple perch
#

i gtg man

#

have a fantastic evening

distant tulip
#

alr

#

you too

supple perch
distant tulip
#

i guess so

stray spoke
#

Why does the arguments in my custom command only returns the first one even tho it has two parameters, also ingame it shows two. The Target is the first one, the second one is the Minutes:

The code:

data.customCommandRegistry.registerCommand({
    name: format("givevip"),
    description: "give a vip to specific player for a limited time",
    permissionLevel: 1,
    mandatoryParameters: [
      {
        name: "player",
        type: "PlayerSelector"
      },
      {
        name: "minutes",
        type: "Integer"
      }
    ]
  }, (origin,arg)=>{
    const [target,mins] = arg;
    const player = origin.sourceEntity;
//... other codes
warm mason
#
(origin, targets, mins)=>{
    const target = targets[0];
    const player = origin.sourceEntity;
stray spoke
#

What da hill

#

So args is separated?

#

Thankss I'll try

warm mason
stray spoke
#

Thanks a lot, I just misunderstood the docs

#

I thought all args are inside an array

silver agate
# silver agate well, made that and still didnt work: ```js import { world, system, CommandPermi...

made adjustments but the command message doesnt shows:

import { world, system, CommandPermissionLevel, CustomCommandParamType } from "@minecraft/server";

system.runInterval(() => {
  let message = world.getDynamicProperty('aca:message') ?? '';
  let time = world.getDynamicProperty('aca:messageTime') ?? 0;
  if (message === undefined) message = '';
  for (const player of world.getAllPlayers()) {
    player.onScreenDisplay.setActionBar(`${message}\n` + 'aaaaaaa o aaaaaaa');
  }
  if (time === 1 && message !== '') world.setDynamicProperty('aca:message', '');
  if (time >= 1) world.setDynamicProperty('aca:messageTime', (time - 1));
}, 1);

system.beforeEvents.startup.subscribe((d) => {
  const messageCommand = {
    name: "aca:message",
    description: "sets a message to appear on actionbar",
    permissionLevel: CommandPermissionLevel.GameDirectors,
    cheatsRequired: true,
    mandatoryParameters: [{ type: CustomCommandParamType.String, name: 'messageParam' }],
    optionalParameters: [{ type: CustomCommandParamType.Integer, name: 'timeParam' }]
  };

  d.customCommandRegistry.registerCommand(messageCommand, messageHandler)

  function messageHandler(origin, args) {
    const message = args.messageParam;
    const time = args.timeParam;
    world.setDynamicProperty('aca:message', message);
    const messageTime = time >= 0 ? time * 20 : 100;
    world.setDynamicProperty('aca:messageTime', messageTime)
  }
});```
slow walrus
jolly citrus
#

that suchs

#

sicls

#

sucks

slow walrus
#

yep

#

are you doing that for a server or something?

jolly citrus
#

yes

#

or world i mean

slow walrus
#

if it's a server' then I'd recommend using an external DB with a http API

#

can't do that on worlds though

jolly citrus
#

or realms

#

unless with a bot

#

i mean technically

#

if i write a custom dll

#

i could make it poll values from the game's memory that correspond to http requests the script wants to make

#

like entity tags

#

but that would be very very difficult

#

at that point id rather run a server

#

but everything is possible if u put ur mind to it

runic crypt
#

Is there a way to force disabled the auto jump settings with scripts api?

broken pawn
#

Any explanation for this error?

function ShowCommandMenus(Player){
    const A = new ModalFormData().title("Command Menus").textField("Enter Here!");
    const Response = A.show(Player);if(Response.canceled)return;
    const Command = Response.formValues[0].trim();if(!Command)return;
    const ConfirmA = new MessageFormData().title("Command Menus").body("Confirm Command Registry?").button1("True").button2("False");
    const ConfirmResponse = ConfirmA.show(Player);if(ConfirmResponse.canceled||ConfirmResponse.selection==1)return;
    try{Player.runCommand(Command);Player.sendMessage(`Execute ${Command} Successful!`)}catch(e){Player.sendMessage("Command Error!")};
};

it says:
[Scripting][error]-TypeError: Incorrect number of arguments to function. Expected 2-3, received 1 at ShowCommandMenus(Js.8) at <anonymous>(js.4).

here's the .js 4

AE.itemUse.subscribe(({itemStack:A,source:B})=>{if(B.nameTag!=="Mech Protector")return;if(A.typeId=="minecraft:stick"&&B.isSneaking)ShowCommandMenus(B);});
jagged gazelle
broken pawn
#

and my UpperCase typing love this also

distant tulip