#(hatzefatz) Task Script Problem

57 messages · Page 1 of 1 (latest)

livid parrot
#

A Task Script is still executing, also if the player doesn't has the flag:

noble shuttleBOT
#

(hatzefatz) Task Script Problem

noble shuttleBOT
#

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.

livid parrot
#

!past

#

i'm executing that task script in an interact from an npc click trigger wit that command: ~run AQuestDebug def:<player>|<script>|<script.step> The Problem now is, that i get also the chat message, when the player don't has the Flag. I'm narrating the flag in the chat and this here is how it looks like ingame:

blissful girder
#

the player does have the flag. the value is just an empty map (map@[] represents an empty map).

livid parrot
#

right but the question is, why does the rest get narrated?

blissful girder
#

!debug

fossil gorgeBOT
# blissful girder !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!

livid parrot
#

whith no flag, and from the npc right?

blissful girder
livid parrot
blissful girder
#

thanks

flint crownBOT
livid parrot
#

i got to thank you for your help 😄

blissful girder
#

i think the reason it's still running is because of how the if commands handles truthiness. this is a newer addition to the if command. because the <[player]> variable is valid, it uses that as the input and because the player is valid, it's Truthy so the if block passes.

#

!c if

fossil gorgeBOT
# blissful girder !c if
Group

queue

Syntax

if [<value>] (!)(<operator> <value>) (&&/|| ...) [<commands>]

Short Description

Compares values, and runs a subset of commands if they match.

Description

Compares values, and runs a subset of commands if they match.
Works with the else command, which handles alternatives for when the comparison fails.
The if command is equivalent to the English phrasing "if something is true, then do the following".

Values are compared using the comparable system. See !language operator for information.

Comparisons may be chained together using the symbols '&&' and '||' or their text equivalents 'and' and 'or'.
'&&' means "and", '||' means "or".
So, for ...

blissful girder
#

When not using a specific comparison operator, true vs false will be determined by Truthiness, see Tag:ObjectTag.is_truthy for details.
For example, "- if <player||null>:" will pass if a player is linked, valid, and online.

#

you can either add an if check to see if the <[player]> has the flag (.has_flag) or by adding a tag fallback (.if_null[false])

livid parrot
#

that error i understood and resolved already. but what i don't understand is, why is the flag in line 19 true but in line 22 an empty map

blissful girder
#

ohh sorry i misunderstood

livid parrot
#

i mean i didn't know about the if_null tag. that could still work.. i got to try it
edit: i doesn't change anything

blissful girder
livid parrot
#

but i'm removeing the flag that way:
- flag <player> aquest:!
- flag <player> aquest.debug:!
- flag <player> aquest.debug.other:!

is that not the right way to remove a flag?

neon arrow
#

flag <player> aquest:! just this will do

livid parrot
#

thats what i have...

neon arrow
#

flag <player> aquest.debug:! flag <player> aquest.debug.other:!
I'm saying you don't need these

#

The first one completely removes the flag

livid parrot
#

thats what i thought... but i usually just want to remove the debug and not everything. i'm storing other information in aquest.data.... i just removed the flag completly to make sure that this isn't the problem

flint crownBOT
neon arrow
#
- foreach <server.online_players> as:player:
    - if <[player].flag[aquest.debug.other].contains[<player>]>:
      - narrate "<&[aq]>[AiLandiaQuest] <&[qb]>Quest Debug von: <&[cmd]><player.name>" targets:<[player]>```
You're directly checking the flag value of every online player, even if they might not have the flag
#

that's why it's erroring probably

#

!t server.online_players_flagged

fossil gorgeBOT
neon arrow
#

You can just - foreach <server.online_players_flagged[aquest.debug.other]>

livid parrot
#

thats perfect.. but i having the problem already with the first 3 narrates

neon arrow
#

I guess you can check if <player.has_flag[aquest.debug]> && <player.flag[aquest.debug].is_truthy>

#

So the if only passes if the player has the flag and the flag is truthy (not an empty map)

livid parrot
#

oke, that seems to work. But is there any reason for? I never had that issue before and used a lot of flag back in the days

blissful girder
#

are you 100% sure that the player does not have the aquest.debug flag? because if they don't, it should not be returning an empty map, it should be null. are you setting it to an empty map anywhere? because doing /ex flag <player> aquest.debug:! and narrating the flag value <player.flag[aquest.debug]> returns an error for me. i'm just double checking.

livid parrot
#

you are right... but how is the command to set it to an empty map...

#

- if <context.args.size> == 2 && <context.args.get[2]> == off: - flag <player> aquest:! - flag <player> aquest.debug:! - flag <player> aquest.debug.other:! - narrate "<&[dq]>[AiLandiaQuest] <&[qb]>Debug deaktiviert!" - stop - if <context.args.size> == 1: - flag <player> aquest.debug - narrate "<&[dq]>[AiLandiaQuest] <&[qb]>Debug aktiviert!" - else: - run ailandia_permission def:hatze.aquest.debug.other instantly - define player <context.args.get[2].as[player]||x> - if <[player]> = x: - narrate "<&[error]>Du musst einen Spielernamen eingeben!" - stop - else: - flag <player> aquest.debug.other:->:<[player]>

#

arg one is debug

blissful girder
#

well, using <[player]> = x won't work, because it should be ==

livid parrot
#

it worked actually with just on = but i changed it now and the problem is still there with the emty map..

livid parrot
#

Any more ideas?

fluid turtle
livid parrot
#

I can and will but I’m not at home until next week

fluid turtle
#

No problem.

livid parrot
#

That problem looks to be fixed now... I don't know, what my mistake was lasttime.

charred runeBOT
#
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.)

#

@livid parrot