#home dimension teleport
1 messages · Page 1 of 1 (latest)
learn js and how to use the scripting api like MANY have already suggested
you keep asking every single possible question in here
no exageres
I think you like me seriously bro
@ripe anchorhttps://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/entity#teleport
It doesn't say how to get the dimension that the player is
there simple thing bro
I was testing to see if it would
player.addTag(`HOME:${r.formValues[0]}: ${Object.values(player.location).map(Math.floor).join(" ")} :${dim}`)
const Dimension = r[4]
player.teleport({x, y, z}, Dimension)
I tried in other ways the "player.teleport"
what's wrong?
Dimension is a class that is instantiated. You need to get it from the world class
like this?
?
U didn't send anything
Just get the dimension from the world instance then put that into the dimension parameter
Did not help
Literally what I just said
var dimension = world.getDimension('overworld');
player.teleport(new Vec3(0,0,0), dimension);
I did different
const dim = player.dimension.id
then I saved the result in the tag and then got it there
That's not the same as an instantiated dimension
Id is an id. Its not an object
so how would I get the dimension that the person is for me to save in the tag and then get it?
the guy had said this here
That's the thing. Use the id to get the dimension to then pass it into the method
So is it right? Before "player.teleport"?
Yes
vec3 have any import?
Mate. Just look at the docs. Everything you need to know is right there
I tested and it wasn't a friend
Once u learn how to use the docs. Just looking at a method will give you all the information you need. Which class to import, What parameters to fill and the errors that are thrown, asynchronous operation etc..
I mean how much more direct can you not be
I already read it there
?
I'm understanding nothing
function exgui5(player) {
const dim = player.dimension.id
const createForm = new ModalFormData()
.title("§lCriar home")
.textField("Nome da home:", "...")
createForm.show(player).then(r => {
if (r.canceled) return;
const [name] = r.formValues
if (name === "") {
player.sendMessage("§cColoque o nome da home!")
return;
}
player.addTag(`HOME:${r.formValues[0]}: ${Object.values(player.location).map(Math.floor).join(" ")} ${dim}`)
player.sendMessage(`§aHome criada com sucesso§f "${r.formValues[0]}"`)
})
}
function exgui6(player) {
const tags = player.getTags().filter(tag => tag.startsWith("HOME:"))
if (tags.length === 0) {
const gui8 = new ActionFormData()
gui8.title("§lTeleportar Home")
gui8.body("Voce nao possui home para teleportar!")
gui8.button("§lCriar Home");
gui8.show(player).then(result => {
if(result.selection === 0){
exgui5(player);
}
})
return;
}
const tp = new ActionFormData()
.title("§lTeleportar Home")
.body("Selecione uma home:")
for (const tag of tags) {
const loc = tag.split(":")
const home = loc[1]
const x = loc[2].split(" ")[1]
const y = loc[2].split(" ")[2]
const z = loc[2].split(" ")[3]
tp.button(`§l${home}\n§2${x} ${y} ${z}`)
}
tp.show(player).then(result => {
const r = tags[result.selection].split(":")
const home = r[1]
const x = r[2].split(" ")[1]
const y = r[2].split(" ")[2]
const z = r[2].split(" ")[3]
const dimension = world.getDimension(r[3])
player.teleport(new Vec3(x,y,z), dimension);
player.sendMessage("§aSucesso ao se teleportar na home§f " + home)
player.runCommandAsync(`playsound random.orb @s`)
})
}
Stable: This means the current, publicly supported version of Minecraft. Everyone plays Stable by default.
Experimental: Experimental can be turned on per-world. If you want to use Experimental things in your addons you (and everyone who uses your addon) will need to turn on Experimental in their world.
Beta: Beta is the most extreme "cutting edge" Minecraft. Beta is opt-in, meaning you need to install it separately. It will replace your stable Minecraft unless you use a version switcher. Beta players cannot play with stable players, and visa-versa.
Marketplace: Marketplace work cannot contain beta or experimental features.
Sometimes we say exp instead of experimental
I still don't know where it went wrong

I have one question. Do you even know what r[3] returns?
The type of variable
Also you got basically a lot of things wrong there
I followed the previous logic bro
which?
Do you even know what you are trying to put in. Trace the code because it starts at the very point you start putting variables into the constants
Yes
Ill explain in the simplest terms. Your putting a string into an integer for the method and your also putting a string into the dimension parameter
Integer is not string
and if I made a mistake I need to know what I did wrong to learn from the mistake
const r = tags[result.selection].split(":")
const home = r[1]
const x = r[2].split(" ")[1]
const y = r[2].split(" ")[2]
const z = r[2].split(" ")[3]
const dimension = r[3]
player.teleport(new Vector3(x,y,z), dimension);
``` all of this is wrong
exactly what?
because when I hadn't tried to put it to teleport in the right dimension it was working
I told you way before. Your putting a variable that is typeof string into a method that takes no string parameters
Meaning you need to convert your variables
For starters. Change
const dimension = r[3]
to
const dimension = world.getDimension(r[3])
I didn't know this one

Exactly. So you change that example to match your code
I'm never gonna give full blown code. Only from examples
at the time I only understood the code and didn't try to change it
I seek knowledge
do you have any more errors?
At this point just wrap that entire function in try catch and log the error to console to debug it
?
?debug
There are 2 errors in this [code](#1093629549054541894 message):
[36m<repl>.js[0m:[33m10[0m:[33m17[0m - [31merror[0m[30m TS2552: [0mCannot find name 'exgui5'. Did you mean 'exgui6'?
[7m10[0m exgui5(player);
[7m [0m [31m ~~~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m10[0m
[7m1[0m function exgui6(player) {
[7m [0m [36m ~~~~~~[0m
'exgui6' is declared here.
[36m<repl>.js[0m:[33m37[0m:[33m32[0m - [31merror[0m[30m TS2304: [0mCannot find name 'Vec3'.
[7m37[0m player.teleport(new Vec3(x,y,z), dimension);
[7m [0m [31m ~~~~[0m
it didn't work