#conditional opening with tags

1 messages · Page 1 of 1 (latest)

versed sigil
#

Can i make a form open if some entity at the world have a tag from this values

const dropdownVal = [ "§eYallow", "§bLight bleu", "selections", "§l%color.black" ];```
But this values are in another form
This the cod to more understanding
```js
function UIMenu(player){
    const form = new ActionFormData()
        .title(`TP MENU`)
        .body(`           §a§l» TELEPOT ADDON «§r            `)
        .button("CREAT TP", "textures/creat")//0
        .button("TP LIST", "textures/list")//1
        .button("DETAILS", "textures/setting")//2
        .button("Back\n§r§7§oClick here")//3
        .show(player).then(result => {
            if (result.selection === 0){ creat(player)
                
            }
            if (result.selection === 1){ spawn(player)
                
            }
            if (result.selection === 2,"i need the condition her"){
                list(player)
            }
            if (result.selection === 3){//3
   
                Menu(player)
            }
        })
}
function creat(player){
  const dropdownVal = [ "§eYallow", "§bLight bleu", "selections", "§l%color.black" ];
  const form = new ModalFormData()
    .title("CREAT WAYPOINT")
    .textField("WAYPOINT", "waypoint")
    .dropdown(`waypoint`, dropdownVal, 0)
    .show(player)
    .then(result => {
      const [ waypoint, dropdown ] = result.formValues
      
      const getDropdown = dropdownVal[dropdown];
      const entity = player.dimension.spawnEntity("sh:menu", player.location)
    entity.nameTag = `${getDropdown} ${waypoint}`
      entity.addTag(waypoint)
  })
}```
night bay
#

if entity isnt in loaded chunk u wouldnt be able to detect em

raw locust
#

How to open form from tag

night bay
#

waht

versed sigil
night bay
#

that'd work

versed sigil
#

Because i need to creat if the player click at the list tp button and we have any tp say you don't have any tp you understand me right?

night bay
#

const [waypoint, dropdown] = result.formValues

const getDropdown = dropdownVal[dropdown];
const isWaypoint = player.dimension.getEntities({ tags: [getDropdown] }).length

if (isWaypoint) return players.sendMessage('Waypoint exists')

const entity = player.dimension.spawnEntity("sh:menu", player.location)
entity.nameTag = `${getDropdown} ${waypoint}`
entity.addTag(waypoint)
raw locust
#

whats the question

#

i think i didnt get it right

night bay
#

idk

versed sigil
versed sigil
versed sigil
#

Someone her?
@night bay
@raw locust

raw locust
#

conditional opening with tags

#

he gave the code

#

if (! isWayPoint ) return;

#

tells if there is no entity stop the code

versed sigil
#

Bo bro not look like this

#

If (entityhastag(`${dropdawn}))

night bay
#

this tp form restrict the world to only have 4 waypoints?