#(kristouffe) Why does my proc not process tags?

49 messages · Page 1 of 1 (latest)

real nest
#

I have a data script with all my message I send to the players. I made a proc "get_message" which adds the prefix key in front of every message.

Using the proc will never process tags if there are some in the message.
But using the same code the proc uses but not in the proc, will process the tag. Can someone explain? or did I something wrong again?

That's the simple code i'm running to compare

- narrate "<proc[get_key].context[config|prefix]> <script[config].parsed_key[messages.backpack.info_full_tank]>"
- narrate <proc[get_message].context[backpack|info_full_tank]>```

For me both should narrate the same thing, but the first one is processing the tag, the second one isn't processing the tag.

Can anyone explain ?
https://paste.denizenscript.com/View/125478
austere isleBOT
#

(kristouffe) Why does my proc not process tags?

austere isleBOT
#

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.

real nest
#

here is the result

#

Here is the relevant console error when using the proc

hearty sphinx
#

!debug

hallow mirageBOT
# hearty sphinx !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!

real nest
past ice
hallow mirageBOT
# past ice !checklogs https://paste.denizenscript.com/View/125483
Server Version

Paper version 1.21-111-66165f7 (MC: 1.21)

Plugin Version(s)

Citizens: 2.0.35-SNAPSHOT (build 3489) -- (Outdated build, behind by 7)
Denizen: 1.3.1-SNAPSHOT (build 7057-DEV) -- (Outdated build, behind by 2)

Checked For

@past ice

UUID Version

4 (:white_check_mark: Online)

Java Version

21.0.3 :white_check_mark:

Other Noteworthy Plugin(s)

ProtocolLib: 5.3.0-SNAPSHOT-726

Possibly Relevant Plugin(s)

CMI: 9.7.4.8 - CMI tends to mess with a large variety of server features and often gets in the way of issue debugging.
Multiverse-Core: 4.3.12 - Multi-world configuration plugins may affect NPCs in unexpected ways.

hearty sphinx
#

Error Message: Invalid definition name 'tank_type'. ...

real nest
#

But it is since the first narrate does process the tag ?

past ice
#

You're not passing it or doing anything with the definition.

#

You define it and that's just it from the script you're showing us.

real nest
#

I don't get it. The first narrate is able to process the tag but the second one using my proc isnt able to do it. But the proc does the exact same code.

past ice
#

We're missing relevant scripts too like get_key, I don't know what that does.

#

Still, you're defining tank_type and then doing nothing with it in the scripts provided.

#

I'm not even sure how it even called the definition, are you sure the scripts you've provided are as-is?

real nest
#

Oh I see. Forgot to provide a whole part of the script. Will do it once I'm home. Thought get_key was included

real nest
#

I'm defining tank_type because it's a variable in my message.
What I don't get is when I don't use the proc (which is executing the exact same code as the first narrate), it processes the tag, but when I use the proc, it won't process the tag and says it's not defined.

#

- narrate "<proc[get_key].context[config|prefix]> <script[config].parsed_key[messages.backpack.info_full_tank]>" will process tank_type

- narrate <proc[get_message].context[backpack|info_full_tank]> won't process tank_type

#

For me the 2 lines are exactly the same 😅

plush fog
#

Because tank_type isnt defined in the procedure. It has not context excpect for what you explicitly pass in. Being that you did not pass in tank_type it is indeed not defined

real nest
#

How Could I make this proc general for when there is a message with tag to replace? What about if I have a message with more than one tag to replace ?

plush fog
#

Either make the name generic ie value1 and have it as a onptional context,
Or dont use a parsed definition and use string replacement instead and pass in a map of replacements
Ie use _tank_type_ and passin in a map to the procedure that says [_tank_type_=watertank]
And then loop through the map and make the replacements with

#

!t element.replace.with

hallow mirageBOT
#
Possible Confusion

Did you mean to search for elementtag.replace_text?

hallow mirageBOT
plush fog
#

!t element.replace_text.with

hallow mirageBOT
real nest
#

How you make the context optional ? Wanna try it with a generic value rather than with text replacement

plush fog
#

Nothing special, just dont provide the context when you dont need it

real nest
#

There's something I don't understand. How can I make the proc generic (for when I have a Tag in a message). The definition I pass to the proc should have the exact same name as the "tag" in the message right? So this can never be general for different messages with different tags?

plush fog
#

The definition it cares about is the one you call it by in the procedure

#

So if you have a 3rd definition set as value you can use value in all your messages that need a replaced value

real nest
#

I see. So no way to keep the tag name in the message (for more readability) unless I make my own tags with text replacement, right ?

plush fog
#

No, You cant have it both be generic and specific

#

If you want a specific definition, you can use a general proc

real nest
#

Ok thanks.

I'm trying to make it with text replacements atm. Here's the proc get_parsed_message:
https://paste.denizenscript.com/View/125603

It works if and only if I have a single tag to replace. As soon I have more, the tags are replaced as one tag instead of multiple tags.
Can't figure out if it's a regex issue or just a logic issue again. Can anyone figure it out?

#

the test message is the info_full_tank key

plush fog
#

Would need a debug to be sure, but it does seem like a regex issue

#

!debug

hallow mirageBOT
# plush fog !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 whaleBOT
#
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.)

#

@real nest