#(JustinS) A lot of NPC interactions

1 messages · Page 1 of 1 (latest)

patent rampart
#

I have a long list of responses that an npc can give when a player clicks them. I want the player to be able to respond with a short message (by clicking in the chat), and the npc sometimes responding back to that. My question is, what's the best/shortest way of doing that for a lot of responses?

       random:
            - narrate " <&3>What do you want?"
            - narrate " <&3>Move!"
            - narrate " <&3>Get out of my sight!"
            - narrate " <&3>What do you need?!"
            - narrate " <&3>You should consider taking a shower!"
            - narrate " <&3>You're not from around here are you?!"
            - narrate " <&3>I'd watch out if I were you."
            - narrate " <&3>Get away from me!"
            - narrate " <&3>Stop stalking me, creep!"
              .... goes on for a long time```
winter galleonBOT
#

(JustinS) A lot of NPC interactions

winter galleonBOT
#

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.

sand ravine
#

do you want the responses to be clickable

#

and the npc sometimes responding back to that
with what

#

a generic response for each clicked response? different for each one?

patent rampart
patent rampart
#

Or, most of them. Some might use the same

patent rampart
sand ravine
#

so do you just want:

  • random responses
  • for those responses to be cliclable
    ??
patent rampart
#

Yes

#

Well

#

Dont scrap it. Playet Responses would be useless if the npc doesnt respond back

sand ravine
#

i can think of 2 ways to do this but not sure which one is more efficient

#

ill test later/tmrw when i have time if someone doesnt get to u first

patent rampart
#

Were you already able to test it?

analog isle
#

huh

#

!t element.click

vivid raptorBOT
analog isle
#

i assume you'd want click_chat

#

!t element.click_chat

vivid raptorBOT
# analog isle !t element.click_chat

Adds a click command to the element, which makes the element pseudo-chat the input message when clicked, for activating interact script chat triggers (!language Chat Triggers).
This internally uses the command "/denizenclickable chat SOME MESSAGE HERE" (requires players have permission "denizen.clickable")
Note that this is a magic Denizen tool - refer to !language Denizen Text Formatting.

Group

text manipulation

Returns

ElementTag

Examples
- narrate "You can <element[click here].click_chat[hello]> to say hello to an NPC's interact script!"
analog isle
#

then you can just <element[<[random_pick]>].click_chat[...]>

#

then idk,

npc_yap:
  type: data
  messages:
  - hi
  - bye
  - hello
- define random_pick <script[npc_yap].parsed_key[messages].random>
#

something along these lines

patent rampart
#

The hi, bye, hello can be clicked by the player?

#

or

analog isle
#

unless i misunderstood something

analog isle
patent rampart
#

Hmm I see

#

How can I add an npc response to that though?

#

So if I press one of the options, the NPC just says "What do you want"

analog isle
#

now you've lost me cus i dont know citizens, only denizen

patent rampart
#

Well that is kinda part of denizen's trigger system no?

#

or whatever you can use to do that

analog isle
#

ya but im not familiar with it

sand ravine
#

!lang interact script cont

vivid raptorBOT
# sand ravine !lang interact script cont

Interact script containers are used to handle NPC triggers.

Interact scripts must be referenced from an assignment script container to be of any use.
See !language assignment script containers.

The only required key on an interact script container is the 'steps:' key.

Within the steps key is a list of steps,
where the first step is '1', 'default', or any step that contains a '*' symbol.
After that, any steps must be 'zapped' to via the zap command: !command zap.

Each step contains a list of trigger types that it handles, and the relevant handling that the given
trigger makes available.

Refer to !language interact script triggers for documentation about the triggers available.
Any triggers used must be enabled in !action assignment by !command trigger...

Group

Script Container System

sand ravine
#

ugh

#

!lang chat trig

vivid raptorBOT
# sand ravine !lang chat trig

Chat Triggers are triggered when a player chats to the NPC (usually while standing close to the NPC and facing the NPC).

They can also be triggered by the command "/denizenclickable chat hello" (where 'hello' is replaced with the chat message). This is used for clickable triggers.
This option enforces all the same limitations as chatting directly, but unlike real chat, won't display the message in global chat when there's no match.
This requires players have the permission "denizen.clickable".

Interact scripts are allowed to define a list of possible messages a player may type and the scripts triggered in response.

Within any given step, the format is then as follows:


# Some identifier for the trigger, this only serves to make the sub-triggers unique, and sort them (alphabeticall

...

Group

NPC Interact Scripts

sand ravine
#

!t element.click_cha

vivid raptorBOT
# sand ravine !t element.click_cha

Adds a click command to the element, which makes the element pseudo-chat the input message when clicked, for activating interact script chat triggers (!language Chat Triggers).
This internally uses the command "/denizenclickable chat SOME MESSAGE HERE" (requires players have permission "denizen.clickable")
Note that this is a magic Denizen tool - refer to !language Denizen Text Formatting.

Group

text manipulation

Returns

ElementTag

Examples
- narrate "You can <element[click here].click_chat[hello]> to say hello to an NPC's interact script!"
sand ravine
#

this fires chat triggers ^

patent rampart
#

I'm using - random to get the the initial npc msg though. I somehow need to add the clickable under that message

#

Though I can't add an extra line because it's the random command

#

Is there a nextline option for -narrate? Like <&n> but for a second line

#

holy shit it exists

sand ravine
#

your questions always confuse me 🧍‍♀️

sand ravine
#

that way you can fetch a random element and stick .click_chat to it

patent rampart
#

Could you give a small example?

sand ravine
#

can you explain again pls

patent rampart
#

I'll give some examples

sand ravine
#

if i fall alseep i swear ill respond tmrw

patent rampart
#

Lol no worries

#

Theres a bunch of roaming NPCs, and they sometimes send the message a player when the player gets very close (50% chance rn)
I'm doing this using util.random_chance and ```
random:

  • narrate "randommsg1"
  • narrate "randommsg2",etc..```
    I want the player to be able to react to each of those responses, with a unique response.
    So, for randommsg1, the player could reacht with "Sorry", or "Move Along". The NPC then responds back to each of those differently. So for "Sorry", they respond "You're alright", and for "Move Along" they react with "Someone's angry...". And that's it. No extra responses or anything. End it there
#

But I have like 50 of those random msgs

sand ravine
#

ok gotcha

#

brain too fried tho ill try to write an example but i might fall asleep in the middle of it

patent rampart
#

tek no respond 😢

#

oh wait the day isn't over yet. Still hope

patent rampart
#

no hope

patent rampart
#

@sand ravine did you still have an example?

woeful gulch
#

What's the issue here @patent rampart

#

Can you provide what you have?

#

!paste

vivid raptorBOT
patent rampart
woeful gulch
#

Do you have a script yet?

patent rampart
#

I already have the triggering of the initial msg part but that's not necessary here

#

Just need to know what would be the best way to add a lot of random short convos

woeful gulch
#

An interact script with multiple chat triggers in a single step.

#

Does the NPC returns an unique answer to each reply from the player?

#

Depending on the answer you might need multiple steps for each answer and zap to it, on the initial step.

silent bobcat
#

This sounds like a case for a simple map structured like

1:
  Enter: hi
  User: hello
  Response: have a good day```
Upon starting flag randomly the person one of those entries and proceeded
woeful gulch
#

Why reinventing the wheel

woeful gulch
woeful gulch
#

@patent rampart Should players should be able to respond via chat or only via clicks in chat?

woeful gulch
#

Here's a sample

patent rampart
#

Im confused

#

very confused

#

oh wait I think I get it

#

I'll try it out, thanks!
Ill let you know what happens

woeful gulch
#

Yee

patent rampart
# woeful gulch Yee

Couldn't get it working, not sure why 😕
https://paste.denizenscript.com/View/124921
I added the assignment to the npc. When I rightclick it, the console says Interact script is INTERACTIONS. Current step for this script is: 4 , though nothing else happens

#

Also not sure why the step is 4. Thought it was supposed to be 1

#

I also have a custom wander assignment which uses the proximity trigger (which is not currently on my npc)

#

Though the npc_react only uses the click trigger

woeful gulch
#

You never zap back to 2

#

This is inside the random, so it will only run randomly

#

Also this will never work

patent rampart
#

stupid mistake

patent rampart
woeful gulch
#

This violates the syntax of interact scripts

#

You can not put script at places where script not belong

patent rampart
#

Hmm alright

#

I'll change it up

woeful gulch
#

It's the step, then trigger, then script

patent rampart
#

Ill move the script back to the step

woeful gulch
#

And then zap to 2

patent rampart
#

yeah but since I refer to the third step in 2 places I thought it might be stupid to duplicate it

woeful gulch
#

To get the correct answer

#

I mean the current zap 3 is the initial message + the reply. You have to zap to the correct step in each of them.

#

!guide interact script

vivid raptorBOT
patent rampart
woeful gulch
#

You can not have all answers in a single step

patent rampart
#

I thought you had that in your example?

woeful gulch
#

No

patent rampart
#

step 3

#

contains 2 replies?

#

Why can't I just put more replies in there

woeful gulch
#

These are two possible answers for one question.

#

You can always only respond to one question.

patent rampart
#

I don't see why I can't reuse that third step for other questions too

#

I mean you just call one of the triggers inside the 3rd step

woeful gulch
#

Because you could technically respond to "What is your name?" with "It is raining"

patent rampart
#

Only if I use the rainingResponse trigger?

woeful gulch
#

Wot

patent rampart
#

Like the /Secret_2/ trigger

#

that won't trigger unless I run it specifically

woeful gulch
#

Ye

patent rampart
#

If I don't run that with the "what is your name?" question, it won't be a problem? I can just run the /Respond_to_name/ trigger

woeful gulch
#

If you already got the response to click, you can answer with different answers.

#

This question should either be answered with Empty or Aggressive, then you zap to step 2

#

All chat triggers here are possible answers, because you're in step 2

patent rampart
#

So I should put each response into a different step?

woeful gulch
#

Yeah and then zap to it.

patent rampart
#

yeah so delete the zap 2 and put each zap in the repeat 1:

woeful gulch
#

Ye

patent rampart
#

but

woeful gulch
#

You can use task scripts later, if you need to reuse the responses

patent rampart
#

Some of the responses are used multiple times

#

let me give an example

woeful gulch
#

task scripts

patent rampart
#

oh

woeful gulch
#

Will you have multiple npcs?

#

that can do the question / answers thing?

patent rampart
#

will have a couple hundred

woeful gulch
#

sounds good, if you put that in tasks you can reuse them everywhere

#

the responses

patent rampart
#

So, turn each response into an individual task?

#

then run that, somehow

woeful gulch
#

Ye

#

!c inject

vivid raptorBOT
# woeful gulch !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.

patent rampart
#

oh no

#

scary

woeful gulch
#

It's simple

#
my_fancy_task:
    type: task
    script:
    - narrate Yay

/ex inject my_fancy_task

patent rampart
#

how is that different than /ex run my_fance_task

woeful gulch
#

inject injects to the queue, so all definitions are passed automatically

#

run creates a new queue, you have to pass definitions manually

patent rampart
#

hmm

#

So, I should run the inject, via the step

#

that I reference to via the click msg

#

so much

woeful gulch
#

It's not that hard o:

#

you can do this

patent rampart
#

It is if you've never used triggers/injections or whatever's mentioned here before :/

#

never had to do any of that

#

wait no

woeful gulch
#

time to learn c:

patent rampart
#

Im confused again

marsh wing
#

what part?

patent rampart
#

Take this example

- repeat 1:
    - narrate " <&c>Move!"
    - narrate "<n><gold> 1: <element[<yellow>Sorry].click_chat[Empty]> <n><gold> 2: <element[<yellow>Oooh look at Mr. Sassy over here...].click_chat[Insulted]>"

If I'm supposed to use task scripts, how can I run the correct one when clicking the msg? I can't do them via steps because then I zap to 1 step, which is supposed to contain both reponses, but since responses are used multiple times I can't do it like that

woeful gulch
#

Only for the response

#

Not for the initial message

patent rampart
#

yes

#

The response gets triggered whenclicking in chat

woeful gulch
#

yep and on the response you just have to call your task script

patent rampart
#

whahaaat

#

😭

#

my questions was about that

marsh wing
#

when you click the sorry button, and it results in you inputting Empty

#

what part runs next

patent rampart
#

well, currently step 2 with trigger: /Empty/

marsh wing
#

directly below that

#

fire your script from that part

patent rampart
#

and a chat trigger*

woeful gulch
#

Let me give you another sample

patent rampart
#

no but Icecapade just told me to put all responses in a different step

#

which would mean I need to zap to 2 steps at the same time, because my script can smell which response I pressed before the chat trigger

woeful gulch
#
trigger: /Agressive/
hide trigger message: true
script:
- inject task_aggressive_response
task_aggressive_response:
    type: task
    script:
    - random:
        - narrate "Excuse me?"
        - narrate "Who do you think you are?!"
        - narrate "Oooh look who thinks is the big boss?"
        - narrate "One more word and you'll regret everything you've said!"
#

That way you can reuse them

patent rampart
#

let's say the agressive trigger is in step 4

#

and the other response, let's say "Optimistic", is step 3

#

I'd have to zap to both step 4 and step 3 at the same time?

woeful gulch
#

No

#

Have both possible answers in a single step

patent rampart
#

but then how can I reuse the step?????

#

Just have some steps include the inject for a script multiple times?

woeful gulch
#

You're reusing the task not the step. Alternatively you could also look into clickables.

patent rampart
#

yeah already looked into those and am using them but theyre quite a hassle

patent rampart
woeful gulch
#

Yeah they're a little complicated. So I would recommend setting your interact script up first.

#

More improvement can be done afterwards, when you figured out how your script works

patent rampart
#

Ill come back to this tomorrow, thanks

patent rampart
#

Still not working. I added some testing announcements and only 'test1' ran.
[12:44:39 INFO]: +> [InteractScri...] Interact script is INTERACTIONS. Current step for this script is: 4
Same error

#

I haven't yet used the task scripts for this, to optimise it a little

#

But it doesnt work in the first place

woeful gulch
#

What exactly?

patent rampart
#

Everything

#

only thing that gets announced/narrated is test

#

1

#

upon right clicking

#

And test1 only gets run when setting the assignemnt

#

But nothing related to interactions get narrated in the chat

woeful gulch
#

Can you reset to step 1 and record a debug

patent rampart
#

How do i reset?

#

to step 1

woeful gulch
#

!c zao

vivid raptorBOT
#
Possible Confusion

Did you mean to search for zap?

#
Possible Confusion

Did you mean to search for mechanism map?

vivid raptorBOT
# woeful gulch !c zao
Group

core

Syntax

zap (<script>) [<step>] (<duration>)

Short Description

Changes the current interact script step.

Description

Changes the current interact script step for the linked player.

The step name input should match the name of a step in the interact script.
The step name can be '*' to automatically zap to the default step.

If used inside an interact script, will default to the current interact script.
If used elsewhere, but there is a linked NPC with an assignment and interact, that NPC's interact script will be used.
For anywhere else, you must specify the script by name.

Optionally specify a duration. When...

woeful gulch
#

/ex zap interactions 1

patent rampart
#

Right so it worked, the first time

#

Second time when I clicked the msg, no response

#

:
Clicked NPC1: got the msg, sent a response, and received a response
Clicked NPC2: got the msg, sent a response, didn't receive a response

#

I can turn the vehicle interaction off rq. Kinda spams the debug

#

~~Didn't get a msg from NPC2 this time, upon rightclicking ~~ This was bcs they were still on cooldown

woeful gulch
#

You dont send anything except <n>?

patent rampart
#

Yeah there's 1 empty msg

#

it's where they're not supposed to give a response back (the npcs)

obtuse dawn
#

heyo, been a couple months. still need help?

solar oarBOT
#
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.)

#

@patent rampart

patent rampart
#

I think its fixed thanks though

solar oarBOT
#
Resolved

Thread closed as resolved.

solar oarBOT
#
Thread Reopened

Thread was manually reopened by @somber wraith.