#(realjimmyb) Access flag stored inside a variable

58 messages · Page 1 of 1 (latest)

lofty sequoia
#

Hi,
I've got flags stored on chunk objects that I'd like to access, but the chunk object is stored in a variable I made using - define. I can't figure out the syntax to access the flags through the variable, instead of directly on the chunk object.

drifting smeltBOT
#

(realjimmyb) Access flag stored inside a variable

drifting smeltBOT
#

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.

whole reef
#

if it's set through the define command, you can use <[variable]> to get the value

lofty sequoia
#

if <[currchunk]>.flag[chunk_domainnameflag]> != player.flag[player_domainnameflag]:

#

This is what I've got, currchunk is the variable

whole reef
#

uhh... couple issues

lofty sequoia
#

Great! please help, I've been struggling with variable syntax all day

whole reef
#

<[currchunk]>.flag[chunk_domainnameflag]> isn't a valid syntax, as there can only be one > for each <

#

player.flag[player_domainnameflag] also only returns the plain-text value, since it's not surrounded by <>

#

!c define usage

chrome grottoBOT
# whole reef !c define usage
Group

queue

Syntax

define [<id>](:<action>)[:<value>]

Short Description

Creates a temporary variable inside a script queue.

Use to make complex tags look less complex, and scripts more readable.
- narrate "You invoke your power of notice..."
- define range <player.flag[range_level].mul[3]>
- define blocks <player.flag[noticeable_blocks]>
- define count <player.location.find_blocks[<[blocks]>].within[<[range]>].size>
- narrate "<&[base]>[NOTICE] You have noticed <[count].custom_color[emphasis]> blocks in the area that may be of interest."
Use to validate a player input to a command script, and then output the found player's name.
- define target <server.match_player[<context.args.get[1]>]||null>
- if <[target]> == null:
  - narrate "<red>Unknown player target."
  - stop
- narrate "You targeted <[target].name>!"
Use to keep the value of a tag that you might use many times within a single script.
- define arg1 <context.args.get[1]>
- if <[arg1]> == hello:
    - narrate Hello!
- else if <[arg1]> == goodbye:
    - narrate Goodbye!
Use to remove a definition.
- define myDef:!
Use to make a MapTag definition and set the value of a key inside.
- define myroot.mykey MyValue
- define myroot.myotherkey MyOtherValue
- narrate "The main value is <[myroot.mykey]>, and the map's available key set is <[myroot].keys>"
lofty sequoia
#

[18:24:29 INFO]: Additional Error Info: Tag <[currchunk].flag[chunk_domainnameflag]> is invalid!
I'm sorry I should have seen that first one..

whole reef
#

what is the definition of currchunk

graceful hearth
#

Don't post error snippets, post debugs/script pastes which would have the full context we need to help you out

lofty sequoia
#
define currchunk <chunk[<[new_player_chunk_temp_str]>,world4]> ---------+
[18:26:10 INFO]: Filled tag <[new_player_chunk_temp_str]> with '148,-108'.
[18:26:10 INFO]: Filled tag <chunk[148,-108,world4]> with 'ch@148,-108,world4'.```
graceful hearth
#

!debug

chrome grottoBOT
# graceful hearth !debug
Info: debug

If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!

lofty sequoia
whole reef
# chrome grotto

can you run a debug of you running through the segment that's giving you an error/issues?

lofty sequoia
whole reef
#

.flag<[chunk_domainnameflag]>> also isn't valid syntax

lofty sequoia
#

Yeah I figured

whole reef
#

does removing the excess <> fix the issue?

faint rose
chrome grottoBOT
# faint rose !ds https://paste.denizenscript.com/View/135641
Script Check Results
Encountered Critical Errors

On line 1: Invalid YAML! Error message: While scanning a mapping, found invalid tab as indentation.
On line 55: Script section within command is empty (add contents, or remove the section).

Script Warnings

On line 2: This script uses the raw tab symbol. Please switch these out for 2 or 4 spaces.
On line 51, 53, 54, 55: Uneven number of tag marks (forgot to close a tag?).

Minor Warnings

On line 38, 106: Pointless quotes (arguments quoted but do not contain spaces).

Other Script Information

On line : (Statistics) Total structural lines: 10
On line : (Statistics) Total live code lines: 72
On line : (Statistics) Total comment lines: 12
On line : (Statistics) Total blank lines: 15

Shortened Lines

There are 4 lines that were merged into other lines.

lofty sequoia
#

Nope, still invalid

#

<[currchunk].flag[chunk_domainnameflag]> is invalid!

#

I just have no idea how to structure the < and [ when using a variable

whole reef
#

is the chunk that's being checked even flagged?

lofty sequoia
#

Yes, I confirmed that

whole reef
#

can you run another debug that includes the chunk being flagged, and the script that produces this error?

lofty sequoia
#

Sure, but it's going to be very long, just a heads up. I can point you to the lines where the interesting bits happen

#
#

Hold on the debug cut most of it off, I'll redo

whole reef
#

Oh I think I see the issue

#

You're checking chunk 151,-111, but not flagging it

#

I see you flagging 152,-111 but not 151,-111

lofty sequoia
#

Yeah I saw that too, it looks like the process actually worked for 152,-111. I'm curious why the title on line 8564 fails to read out the value inside the flag then

#

I've probably got the syntax on line 51 of the script screwed up

whole reef
#

If there's no flag set, the tag will return null

lofty sequoia
#

It doesn't return null though, it returns a big literal string

#

title='ch@152,-111,world4.flag[chunk_domainnameflag]>'

whole reef
#

That's null

lofty sequoia
#

Oh

whole reef
#

If there's no value, it'll return the literal text of the tag that errored

#

For instance:

lofty sequoia
#

so the syntax is right, but the flag isn't set properly?

whole reef
#

@nocturne smelt <server.match_player[mcsamuel]>

nocturne smeltBOT
# whole reef <@349935669956706304> <server.match_player[mcsamuel]>

Tag parse results for <server.match_player[mcsamuel]>: https://paste.denizenscript.com/View/135647

server.match_player[mcsamuel]
Had error: Tag <server.match_player[mcsamuel]> is invalid!
Had error: Unfilled or unrecognized sub-tag(s) 'match_player[mcsamuel]' for tag <server.match_player[mcsamuel]>!
Had error: The returned value from initial tag fragment 'server' was: '(Base-Object)'.
Had error: Almost matched but failed (possibly bad input?): match_player
whole reef
lofty sequoia
#

Hmm, but the title is returning a null then for 152,-111 as well

whole reef
#

I can't take a close look rn as I have somewhere to be soon, but I'll take a look when I get back if someone else isn't able to assist

lofty sequoia
#

Well I confirmed the tag works when I check for the flag stored on the chunk, now it seems that the value stored on the player is incorrect.

lofty sequoia