#(hatzefatz) Task Script Problem
57 messages · Page 1 of 1 (latest)
(hatzefatz) Task Script Problem
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.
!past
Content of Denizen Script Paste #119454: Unnamed Denizen Script Paste... pasted 2024/01/14 15:27:47 UTC-08:00, Paste length: 680 characters across 14 lines, Content: AQuestDebug: type: task
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:
the player does have the flag. the value is just an empty map (map@[] represents an empty map).
right but the question is, why does the rest get narrated?
!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!
whith no flag, and from the npc right?
debug whatever you did to get this result
Content of Server Log Paste #119456: Denizen Debug Logs From A Minecraft Server... pasted 2024/01/14 15:43:24 UTC-08:00, Paste length: 6751 characters across 60 lines, Content: Java Version: 21.0.1Up-time: 2h 18m
thanks
i got to thank you for your help 😄
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
queue
if [<value>] (!)(<operator> <value>) (&&/|| ...) [<commands>]
Compares values, and runs a subset of commands if they match.
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 ...
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.
even though <[player]> does not have the flag, the player is still valid (https://paste.denizenscript.com/View/119456#44) and so it treats it as Truthy
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])
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
ohh sorry i misunderstood
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
the reason it's true on line 19 is because the player does have the flag (.has_flag returns a bool). the value is an empty map. it's true on line 19 because you are checking if the player has the flag (which, according to the debug, they do) and it's an empty map on line 22 because that's the value of the flag
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?
flag <player> aquest:! just this will do
thats what i have...
flag <player> aquest.debug:! flag <player> aquest.debug.other:!
I'm saying you don't need these
The first one completely removes the flag
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
- 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
Returns a list of all online players with a specified flag set.
Can use "!<flag_name>" style to only return players *without* the flag.
ListTag(PlayerTag)
You can just - foreach <server.online_players_flagged[aquest.debug.other]>
thats perfect.. but i having the problem already with the first 3 narrates
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)
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
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.
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
Content of Denizen Script Paste #119458: Unnamed Denizen Script Paste... pasted 2024/01/14 16:17:51 UTC-08:00, Paste length: 1115 characters across 27 lines, Content: AiLandiaQuest: type: command
well, using <[player]> = x won't work, because it should be ==
it worked actually with just on = but i changed it now and the problem is still there with the emty map..
Any more ideas?
Could you post your current script if it changed and run another debug please?
I can and will but I’m not at home until next week
No problem.
That problem looks to be fixed now... I don't know, what my mistake was lasttime.
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