#(mrcrash) CuboidTag contains LocationTag

269 messages · Page 1 of 1 (latest)

frigid cape
#

Hi,

I use a if check to check if a location is inside a cuboid

the <[cuboid]> is the size of the skyblock island

the location is inside the cuboid but always return false:

                                                - if <player.flag[island_cubo]> contains <[holobuild_build]>:```


```19:06:53 Filled tag <player.flag[island_cubo]> with 'cu@skyblock_world,2299,-50,2299,2501,145,2501'. 
19:06:53 Filled tag <[holobuild_build]> with 'l@2381, 11, 2439, skyblock_world'. 
19:06:53 Comparing if cu@skyblock_world,2299,-50,2299,2501,145,2501 CONTAINS l@2381,11,2439,skyblock_world ... false 
19:06:53 No part of the if command passed, no block will run. ```
tepid pecanBOT
#

(mrcrash) CuboidTag contains LocationTag

tepid pecanBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

mortal bough
#

!t location.is_in

sterile kelpBOT
mortal bough
#

is_in[noted_area]

frigid cape
#

so...

                                                - if <[holobuild_build].is_in[<player.flag[island_cubo]>]>:```
rapid ocean
#

Matchers don't take two | symbols

frigid cape
#

Okay i note this for later, actually i need to fix the is_in part

#
        Error Message: Invalid event 'in:<area>' switch [is_in tag] (invalid cuboid): 'is_in tag' for is_in tag 
20:14:18 Filled tag <[holobuild_build].is_in[cu@skyblock_world,2299,-50,2299,2501,145,2501]> with 'false'. 
20:14:18 No part of the if command passed, no block will run. ```
mortal bough
#

is_in needs the area to be noted

frigid cape
#

oh

mortal bough
#

it's a matcher

#

!obj areaobject

sterile kelpBOT
frigid cape
#

yeah mb ^^

loud horizon
#

can just

#

!t cuboidtag.cont

sterile kelpBOT
# loud horizon !t cuboidtag.cont
Cannot Specify Searched Tag

Multiple possible tags: <AreaObject.contains[<location>]>, <ElementTag.contains_text[<element>]>, <ElementTag.contains_any_text[<element>|...]>, <ElementTag.contains_all_text[<element>|...]>, <ElementTag.contains_case_sensitive_text[<element>]>, <ElementTag.contains_any_case_sensitive_text[<element>|...]>, <ElementTag.contains_all_case_sensitive_text[<element>|...]>.

loud horizon
#

!t cuboidtag.contains[]

sterile kelpBOT
# loud horizon !t cuboidtag.contains[]

Returns a boolean indicating whether the specified location is inside this area.

Returns

ElementTag(Boolean)

Examples
# Checks to see if "my_cuboid" contains the player's location.
- if <cuboid[my_cuboid].contains[<player.location>]>:
     - narrate "You are within 'my_cuboid'!"
- else:
     - narrate "You are NOT within 'my_cuboid'!"
mortal bough
#

oo totally forgot this one existed

frigid cape
#

Hm, don't look to work, can i visualize in game a cuboid ?

#

maybe i fail the cuboid

mortal bough
#

visualize the cuboid ingame? you can do debugblock it's shell

#

!c debugblock

sterile kelpBOT
# mortal bough !c debugblock
Group

player

Syntax

debugblock [<location>|.../clear] (color:<color>) (name:<name>) (players:<player>|...) (d:<duration>{10s})

Short Description

Shows or clears minecraft debug blocks.

Description

Shows or clears minecraft debug blocks, AKA "Game Test Markers".
These are block-grid-aligned markers that are a perfect cube of a single (specifiable) transparent color, and stay for a specified duration of time or until cleared.
Markers can optionally also have simple text names.

If arguments are unspecified, the default color is white, the default player is the linked player, the default name is none, and the default duration is 10 seconds.

mortal bough
#

!t cuboid.shell

sterile kelpBOT
# mortal bough !t cuboid.shell

Returns each block location on the 3D outer shell of the area.
This tag is useful for displaying particles or blocks to mark the boundary of the area.

Returns

ListTag(LocationTag)

Examples
# Spawns a hollow sphere of fire around the player.
- playeffect effect:flame at:<player.location.to_ellipsoid[5,5,5].shell> offset:0
frigid cape
#

Okay the cuboid is right

mortal bough
#

then post a debug with it not working

frigid cape
mortal bough
#

clean up that debug please

#

cant find the relevant section

frigid cape
loud horizon
#

it's returning true

frigid cape
#

yeah it's the problem

rapid ocean
#

matchers still dont take two pipe symbols

#

use one

#

not two

frigid cape
#
                                                - if <player.flag[island_cubo].contains[<[holobuild_build]>]>:```
rapid ocean
#

Post your full script please

frigid cape
#

Okay but.. don't judge me

#

he is extremly not optimized

rapid ocean
#

didn't judge you last time

#

lol

frigid cape
#

the if check is set for line 1970 +

rapid ocean
#

how about

#

optimizing it

frigid cape
#

lmao

rapid ocean
frigid cape
#

yeah obviously but first i need to fix the island limitation

rapid ocean
#

for real that's.. no

#

not talking about the script itself

#

the space grew

frigid cape
#

the spaces ?

rapid ocean
#

and randomized indents

frigid cape
#

oh yeah

rapid ocean
#

sometimes 8 spacing, sometimes 4

#

with huuuuuge spacing between lines

frigid cape
#

before a if: it's okay x)

#

Are you judging me 😮

#

obviously yes, you can

rapid ocean
#

so let me read

#

what's the issue

#

and explain script a little

#

please

sterile kelpBOT
# rapid ocean !ds https://paste.denizenscript.com/View/115610
Script Check Results
Minor Warnings

On line 230, 274, 305, 336, 367, 398, 427, 457, 487, ...: Stray space after end of line (possible copy/paste mixup. Enable View->Render Whitespace in VS Code).

Other Script Information

On line : (Statistics) Total structural lines: 116
On line : (Statistics) Total live code lines: 2098
On line : (Statistics) Total comment lines: 0
On line : (Statistics) Total blank lines: 482

Shortened Lines

There are 91 lines that were merged into other lines.

frigid cape
#

It's a builder wand script, when you right clicks a location he display to the player the shape of the build, if the player right clicks again the same location quickly, he validate the shape and build it

#

My problem is:

If the shape go outside the <player.flag[island_cubo> ( the cuboid matching the size of the island ), she is not build

#

But she is build outside my cuboidactually :c

rapid ocean
#

I'm unable to read that script, sorry

frigid cape
#

I understand :/

rapid ocean
#

try to use some task scripts for repeated actions

#

!c choose

sterile kelpBOT
# rapid ocean !c choose
Group

queue

Syntax

choose [<option>] [<cases>]

Short Description

Chooses an option from the list of cases.

Description

Chooses an option from the list of cases.
Intended to replace a long chain of simplistic if/else if or complicated script path selection systems.
Simply input the selected option, and the system will automatically jump to the most relevant case input.
Cases are given as a sub-set of commands inside the current command (see Usage for samples).

Optionally, specify "default" in place of a case to give a result when all other cases fail to match.

Cases must be static text. They may not contain tag...

rapid ocean
#

that also comes in handy

#

so you dont have to use 4 ifs

frigid cape
#

Yeah sure i need to optimize it ..

#

I only posted part of the script, this one repeats itself by just changing the build form so there's no point confusing your mind with all that

loud horizon
# frigid cape Just, take a look here please: https://paste.denizenscript.com/View/115611 I r...

There's a few things things you can optimize/write a different way/fix here:

  1. ln. 3, 10, 36 => You only need to cancel the event once, the other two (ln. 10 & 36) do nothing (ln. 36 can just be - stop)

  2. ln. 13-32 => I assume this is changing the mode, this can be done without 4 ifs that run the same code with different values

#define a list of modes + current mode
- define modes <list[mode1|mode2|mode3|mode4]>
- define current <player.item_in_hand.flag[mode]>

#get the index of the current mode in the modes list
- define index <[modes].find[<[mode]>]>
#get the new mode by adding +1 to the index, if the index+1 is greater than the size of the modes list, fallback to the first mode
- define new_mode <[modes].get[<[index].add[1]>].if_null[<[modes].first>]>

You can now use the new_mode definition and run the repetitive code (ln. 14-16, 18-20 etc.) once:

- playsound <player.location> sound:entity_experience_orb_pickup
- inventory flag slot:HAND mode:<[new_mode]>
- actionbar "Changed mode to: <[new_mode]>"
  1. ln. 6, 11 => You define the mode as the value of the item's mode flag, but check if the item has the flag later on, either the if check is redundant, you need to put it elsewhere, or you need a fallback

  2. ln. 43 => elementtag.not is not preferrable for if checks, use the ! prefix (https://meta.denizenscript.com/Docs/Tags/elementtag.not#elementtag.not)

  3. ln 44-52 => You don't need to go through each entry of the flag to remove it, you don't have to remove it at all, you can just overwrite it with the new blocks.
    Instead of a - foreach, you can define the blocks, flag the server with the the blocks, and show debug blocks (- debugblock takes in a list of locations as well; https://meta.denizenscript.com/Docs/Commands/debugbl#debugblock)

#

Regarding your issue, your script (as well as the debug) is very large to figure out what's going wrong with it, you can try creating a mcve (or at least something that's much smaller than this).
Have you made sure that the island cuboid actually exactly matches the island itself? Could try highlighting the shell of the island cuboid, standing outside the border (but relatively close to it) and checking if your location is in the cuboid etc.

frigid cape
# loud horizon There's a few things things you can optimize/write a different way/fix here: 1. ...

My god I just realized that my cuboid is bad.

I couldn't figure it out with the debugblock from inside the cuboid

My problem is identify.. BUT you spent time to provide me with help and it is true that this script is horrible.

So I'm going to follow your advice one by one and re-write this script in a decent way, hoping to be able to ask for help here if necessary and hopefully finally solving my initial problem

I think this is the best way to do it

frigid cape
#

https://paste.denizenscript.com/View/115621

Okay, here's where I am at the moment...

I'm having trouble understanding how to properly display debugblocks, - debugblock accept listTag and <[cuboid].blocks> return a listTag of all location in the cuboid, yet this doesn't work

loud horizon
#

Your debug doesnt match your paste

#

Debug = > debugblock <[cuboid]> color:lime players:<player> d:2s
Paste => - debugblock <[cuboid].blocks> color:lime players:<player> d:2s

frigid cape
#

oh my bad..

#

wrong debug, 2 much open

#

1sec

#

Yah okay i figured my server has freeze when i try it out

#

worky, let's finish it !

frigid cape
#

First time with task+def for me, can u tell me what's wrong here ?

mental kettle
#

I won't lie Ididn't read a lot of what was posted, I just opened your script and noticed you're running the task build_hammer and not build_hammer_task, and are including only one definition in your task instead of two that you seem to be passing in your world event.

loud horizon
#

You're also using 3 definitions in the task even though you're passing only 2

#
example_task:
  type: task
  definitions: first|second
  script:
.....

- run example_task def:left|right```
That would pass 2 definitions with the values `left` and `right`, what you input in the `definitions` key will be the definition names in the task script.
So, `<[first]>` would return `left`, and `<[second]>` would return `right`
#

You can also just inject a task script instead

#

!c inject

sterile kelpBOT
# loud horizon !c inject
Group

queue

Syntax

inject [<script>] (path:<name>) (instantly)

Short Description

Runs a script in the current queue.

Description

Injects a script into the current queue.
This means this task will run with all of the original queue's definitions and tags.
It will also now be part of the queue, so any delays or definitions used in the injected script will be accessible in the original queue.

loud horizon
#

This means this task will run with all of the original queue's definitions and tags. It will also now be part of the queue, so any delays or definitions used in the injected script will be accessible in the original queue.

frigid cape
frigid cape
mental kettle
#

Definitions are just arguments to pass through to the script, injecting is nice if you really need past definitions to be sent forward but I personally use inject on a case by case.

frigid cape
#

Okay so,

#

i'm here:

mental kettle
#

path is unnecessary for inject. Also you're injecting a... world event? You should be injecting a task script.

You're still running task scripts without supplying them with definitions, of which you have defined but aren't even being used?

#

Please note that inject will pull context and definitions for the current scirpt that it's running in, and not the script that you're targeting with inject

frigid cape
#

Ok, I'm going to start from the beginning, I don't know how to use task scripts, I want to use one with the definitions of my world event

mental kettle
#

Definitions are used to pass arguments so that it can read them for whatever you need in your scripts.

#

An example:

#
testing_cmd:
    type: command
    name: testing
    usage: /testing
    description: It's to test arguments.
    script:
        - narrate "We're going to run a task script."
        - define world1 <server.worlds>
        - define player1 <server.players.get[1]>
        - run testing_task def.world:<[world1]> def.ply:<[player1]>

testing_task:
    type: task
    definitions: world|ply
    script:
        - narrate "The first world that exists is <&e><[world].name><&f>, and the first ever player is <&e><[ply].name><&f>"
#

You can use def:<[world1]>|<[player1]> as well, but sometimes you might want to account for a definition that might not exist.

frigid cape
#

because u run the second task insid the queu of the first one, this one who contains the definitions ?

#

Sorry if it takes me a while to understand, I understand that tasks are very useful but I can't understand the logic of it

mental kettle
#

You're telling the task of testing_task of what definitions to pass, with the task itself already prefixed of knowing those definitions. If they exist then you can call them.

#

It will not know any other definitions besides the one you've provided, unless you're using inject which at that point you don't need to pass any definitions since they may exist already.

frigid cape
#

Okay, I think I'm starting to understand, let me try something

#

Something to optimize or that's look good for you?

mental kettle
#

You are still injecting an event hook inside of a task, this will not work.

Your definitions in your task script are cubo, when you are passing the definition cuboid.

#

But you're on the right track.

frigid cape
#

Thank's for helping me 😄

#

I finally can use task script properly

frigid cape
mental kettle
#

I am uncertain if player tags work inside of item script containers or not, since when spawned I don't know if a player exists at that time?

#

I have an entire system setup that adjusts items when they are spawned in through commands, mobs, and other means that automatically adjusts the lore, statistics, flags and other stuff but that's bigger than what you're trying to do.

frigid cape
mortal bough
mental kettle
#

Why don't you just temporarily set the level and lore with placeholders and update them as seen fit?

frigid cape
#

with placeholder ?

#

like %denizen_thing%

mental kettle
#

No not actual placeholders, like a default thing you put in that you want to edit later.

#

Like 500 or null or whatever.

frigid cape
#

Uh i don't get it

#

You mean, set the lvl/durability & others flags when player receive the item?

mental kettle
#

I'm saying since you're expecting variables that don't exist, just use a temporary one and edit the item's name and lore later on as seen fit.

#

Yes.

#

You'll have to accomodate when the player gets those, through commands or just by picking it up which shouldn't be too difficult.

#

I'm not certain if entity picks up item applies to getting an item directly via a command or inventory command.

frigid cape
#

Unfortunately no..

#

Maybe that can be a cool feature to add a trigger on <entity> receives <item> for when a player receive a item from command (e.g /give or /ex give)

mental kettle
#

That is above my, I don't know if such a thing were to be possible. Still, you'll have to find ways to make sure people don't break the system unless someone else comes up with a better system.

#

If you have a custom /give command then that can help you since you can do specific cases of items, or maybe just build an entire system for item generation if you're feeling more adventerous.

frigid cape
#

I can adjust the flag with command when the player receive the builder wand ( It's with /ex give )

But what's about if the player inventory is full, the item drop on the ground so i can't track the inventory slot

#

Probably more easy to just check if the player inventory can fit the item before give it ^^

mental kettle
#

Yes, that is smart.

#

Generally ex give is used for debugging, or manually giving yourself an item when you have no alternative means of getting it.

frigid cape
#

Mb, i mean - give

#

But it's the same thing right ?

mental kettle
#

I don't think I can say for certain, if you're using - give in a script then you can just define the item before hand and adjust it before you give it to the player.

frigid cape
#

Oh

#

yeah probably

#

i need to test it

frigid cape
#

Can i track the slot of the item when i - give it ?

I mean, i can't use find_item if the player has two builder wand in this inventory

mental kettle
#

Hmmm.

#

Let me do some testing, I might have an answer for you.

frigid cape
#

Maybe I can give the item with a flag that expires very quickly, just enough so that I have time to adjust it by finding its slot?

mental kettle
#

!t inventorytag.find_empty_slots

sterile kelpBOT
mental kettle
#

Give seems to be using this or similar to this, get the very first one.

frigid cape
#

Oh, when you give a item he go in the first empty slot of the list?

mental kettle
#

Seemingly, after testing - give and checking the list, it seems to be using the first slot provided everytime from that list.

frigid cape
#

Oh that's very useful to know

mental kettle
#

I'm not sure why you need to find the slot the item is going to go into.

frigid cape
#

Because I use inventory adjust to adjust the lore and display name of my item, so the flags become valid

mental kettle
#

Why don't you do it before?

#

!c adjust

sterile kelpBOT
# mental kettle !c adjust
Group

core

Syntax

adjust [<ObjectTag>/def:<name>|...] [<mechanism>](:<value>)

Short Description

Adjusts an object's mechanism.

Description

Many object tag types contains options and properties that need to be adjusted.
Denizen employs a mechanism interface to deal with those adjustments.
To easily accomplish this, use this command with a valid object mechanism, and sometimes accompanying value.

Specify "def:<name>" as an input to adjust a definition and automatically save the result back to the definition.

You can optionally adjust a MapTag of mechanisms to values.

To adjust an item in an inventory, use !command inventory...

mental kettle
#

Define the item, adjust it as seen fit, then give it.

frigid cape
#

Because my lore contains <player.item_in_hand.flag[something]> so I need a player?

mental kettle
#

But the linked player doesn't exist for item script containers?

frigid cape
#

working !

#

Yeah but if i adjust the item with his own lore when the player have the item, the lore contain a player.item_in_hand.flag, so that work

frigid cape
#

Okay, actually i try to check if second args is a valid player && if first args is between 1 and 10

#

Uh, can't - stop a command script ?

mental kettle
#

Of course you can.

#

Verify your context args by the way, because it could be nothing and error.

#

!t elementtag.is_integer

sterile kelpBOT
mental kettle
#

Instead of checking for all of those numbers.

frigid cape
mental kettle
#

!l operator

sterile kelpBOT
# mental kettle !l operator

An operator is a tool for comparing values, used by commands like !command if, !command while, !command waituntil, ... and tags like !tag ObjectTag.is.than

Available Operators include:
"Equals" is written as "==" or "equals".
"Does not equal" is written as "!=".
"Is more than" is written as ">" or "more".
"Is less than" is written as "<" or "less".
"Is more than or equal to" is written as ">=" or "or_more".
"Is less than or equal to" is written as "<=" or "or_less".
"does this list or map contain" is written as "contains". For example, "- if a|b|c contains b:" or "- if [a=1;b=2] contains b:"
"is this in the list or map" is written as "in". For example, "- if b in a|b|c:", or "- if [a=1;b=2] contains b:"
"does this object or text match an advanced matcher" is wr...

Group

Comparables

frigid cape
#

- if <[level]> in <list[1|2|3|4|5|6|7|8|9|10]>:

#

!in for is not in work? or it's other operator ?

mental kettle
#

That is highly unnecessary.

frigid cape
#

yeah

#

i made this, for me it's valid but the item was gived anyway

mental kettle
#

- if <[level]> < 1 || <[level]> > 10 will do fine.

frigid cape
mental kettle
#

It's been a while since I used in as an operator, so I'm not sure where to put the NOT operator.

frigid cape
#

Okay i use your if check but same problem, the item is always gived

#

aaaand with this one the item is never gived 😐

mental kettle
#

I'm not sure how to explain why you need to do this, but <[level]> < 1 || <[level]> > 10 need to be wrapped in ( ) to work. Someone else will have to explain why, but because you have a && operator it needs to be separated.

frigid cape
#

Oh

#

never see that after but okay i trust you

mental kettle
#

I'm not sure if this shows up in the lang documents or the guide.

#

Hopefully a helper or someone more experience can explain why you need to do that.

frigid cape
#

It's probably because it's a operator check (< || >) inside another check (&&)

#

i explain bad but for me it's logic

#

like an equation

#

anyway, i got:

#

but i can't understand that error :

#

Cannot compare as numbers '(1' vs '1' - one or both values are not numerical Uh ?

#

oh th (1

mental kettle
#

Spacing might be needed for ()

#

Also enable debug before submitting a debug.

frigid cape
#

OOoooh

mental kettle
#

Line 12 will return a listtag, not a element.

#

You may want to

#

!t listtag.size

sterile kelpBOT
frigid cape
#

Yeah debug show it to me 😄

#

Whut, the if check for the player return false but... th event is triggered ???

#

&& ( <[level]> > 0 && <[level]> < 11 ): is more valid

mental kettle
#

That is valid yes, I was giving you an operator to check so you can stop the script.

frigid cape
#

fixed !

#

the ( ) is very very usefull to know

#

Uh, || isn't valid in choose system?

#
                    - case 1 || 2:```
mental kettle
#

Space separates them, not ||

#

!c choose

sterile kelpBOT
# mental kettle !c choose
Group

queue

Syntax

choose [<option>] [<cases>]

Short Description

Chooses an option from the list of cases.

Description

Chooses an option from the list of cases.
Intended to replace a long chain of simplistic if/else if or complicated script path selection systems.
Simply input the selected option, and the system will automatically jump to the most relevant case input.
Cases are given as a sub-set of commands inside the current command (see Usage for samples).

Optionally, specify "default" in place of a case to give a result when all other cases fail to match.

Cases must be static text. They may not contain tag...

mental kettle
#

There is a usage example showing this in the meta page.

#

But states this in the full description too.

frigid cape
#

Oh yeah i miss it

#

mb

#

Any idea of how can i run the list of the second build to make same order than the first one?

#

.reverse don't do it properly

dull swift
#

this is pretty hacky

gentle sapphire
#

it makes for a pretty neat sorting method of making sure it fills blocks closest to you first

frigid cape
#

Oh I don't think we could use such precise parameters to browse a list, denizen is really powerful

frigid cape
#

.sort_by_value[distance[<player.cursor_on>]] is exactly what i need thank's !

#

- give <item[job_hammer].with_flag[level:<[level]>].if_null[<[level]>] it is a good usage for .if_null inside a .with_flag ?

#
gentle sapphire
#

<item[job_hammer].with_flag[level:<[level]>]> won't be invalid unless job_hammer is an invalid item - id mention the <[level]> could be the only thing to error there if it wasn't defined, but if you thought of using if_null[<[level]>] then i assume it won't be - so i'd just not use an if_null at the end of that tag
also, from this script https://paste.denizenscript.com/View/115713:
all of lines 13 through 53 could just be this:

- define level <context.args.get[2]>
- define max_dura <[level].mul[50]>
- define dura <[level].mul[50]>```

and i'd of recommended just using the same definition for both dura and max_dura since theyre the same number, but unless they change in that script down the road, then maybe not elsewise

heady stumpBOT
#
Thread Closing Reminder

Has your issue been resolved, or your question been answered?
If so, please use the </resolved:1028673926114594866> command to close your thread.
Or </invalid:1028673926898909185> if it's not possible to resolve.

If not yet resolved, please reply below to tell us what you still need.

(Note that if there is no reply for a few days, this thread will eventually close itself.)

#

@frigid cape