#Gui help

1 messages · Page 1 of 1 (latest)

marsh socket
#

?question

blissful turretBOT
#
How to ask a good question!

Be specific and include relevant details about the question upfront.
• What are you trying to accomplish?
• If you have code, which part is not working?
• What have you already tried?
• Have you searched the Bedrock Wiki?

flint tinsel
#

i need help

river surge
#

Send code

flint tinsel
#
    const form = new ActionFormData()
        .title(title)
        .body(`§l§o§5Welcome §d${player.nameTag}§5! §5Choose a Option Below!`)
        .button(`§3Warps\n§7[ Click to View ]`, "texture/items/map_locked")
        .button(`§aShop\n§7[ Click to View ]`)
        .button(`§bHomes\n§7[ Click to View ]`)
        .button(`§5Discord Code\n§7[ Click to View ]`)
        .button(`§8tpMenu\n§7[ Click to View ]`, "textures/items/ender_pearl")
        .button(`§aMoney Transfer\n§7[ Click to View ]`)
        .button(`§6Credits\n§7[ Click to View ]`, "textures/blocks/diamond_block")
        .button(`§cExit Menu`)
    form.show(player).then(r => {
        if (r.selection == 0) Warps(player)
        if (r.selection == 1) Shops(player)
        if (r.selection == 2) bukaCommand(player)
        if (r.selection == 3) DiscordKit(player)
        if (r.selection == 4) tpMenu(player)
        if (r.selection == 5) moneyTransfer(player)
        if (r.selection == 6) Credits(player)
    })
}```
#

this is the main gui

#
    let actionForm = new ActionFormData()
    actionForm.title("SHome GUI")
    actionForm.body(`What do you want to do?\n§7do "-h help" for more info`)
    actionForm.button("§fSet\n§7add/set new home","textures/ui/color_plus")
    actionForm.button("§fChange\n§7change/move your home","textures/ui/book_edit_default")
    actionForm.button("§fGo\n§7tp to your home","textures/ui/icon_import")
    actionForm.button("§fDelete\n§7remove a house","textures/ui/icon_trash")
    actionForm.button("§fList\n§7see all your home","textures/ui/creative_icon")
    actionForm.button("§fSpawn\n§7set home as spawn poin","textures/items/bed_red")
    actionForm.button("§fPos\n§7see xyz of a house","textures/ui/xyz_axis")
    
    actionForm.button("§4Cancel","textures/ui/cancel")
    const actionFormResponse = await ForceShow(actionForm,player)
    const {
        canceled,
        selection,
        cancelationReason
    } = actionFormResponse
    if (canceled === true) {
        if (cancelationReason == "userBusy") player.sendMessage({
            rawtext: [ {
                text: chatPrefix+"can't open ui, please close other ui first"
            }]
        })
        return "cancel"
    }
    const _r = ["add","move","go","remove","list","setspawn","location","cancel"]
    return _r[selection]
}```
#

this is what im trying to export

#

and it uses a form wrapper what ever that is

tall yacht
#

do you import it in the main file?

flint tinsel
#

Yes I did

#
import { ActionFormData, ModalFormData } from "@minecraft/server-ui"
import { getScore, metricNumbers } from "./examples/getScore.js"
import { Warps } from "./examples/warps.js"
import { Shops } from "./examples/ShopSystem/shop_main.js"
import { tpMenu } from "./examples/tpa/tpMenu.js"
import { bukaCommand } from "./examples/homes/index.js"```
#

all my imports

buoyant maple
flint tinsel
#

Okay

#

But the. Await doesn’t work

buoyant maple
#

no need for async

flint tinsel
#

I’m not getting an error

buoyant maple
flint tinsel
#

Yea

#

Removing async made it stop working the regular way too

buoyant maple
flint tinsel
#

Nothing

buoyant maple
#

there is no .show

flint tinsel
#

The force show

buoyant maple
#

code

flint tinsel
#
    system
} from "@minecraft/server";
import {
    ActionFormData,
    MessageFormData,
    ModalFormData
} from "@minecraft/server-ui";

export async function ForceShow(form, player, timeout = -1) {
    const end = system.currentTick + (timeout * 20)
    while (end <= system.currentTick) {
        const response = await form.show(player)
        if (response.cancelationReason !== "userBusy") {
            return response
        }
    }
    throw new Error(`Timed out after ${timeout} ticks`)
}```
buoyant maple
#

What menu is not showing up?

flint tinsel
#

Okay look

#

That menu works

#

But none of the buttons work

#

Like nothing is popping up

#

But when i type -h it works

buoyant maple
#

try use default guis, without variables and async

flint tinsel
#

When I take out async the command stops working to

buoyant maple
flint tinsel
#

How do I do that

buoyant maple
#

gui in gui

#
new ActionFormData()
  .show(player).then((r)=>{
    new ActionFormData()
      .show(player).then((r1)=>{
    });
  });
flint tinsel
#

yo i figured out the problem

#

but i need help

#

so the gui works but the code for the gui is ina different file so how do i get the code to work do i import the code to my main file or something