Local Chat

Share scripts you wrote for Denizen-Bukkit here!
Post Reply
jumpsplat120
New
New
Posts: 6
Joined: June 24th, 2020, 6:05 pm

Local Chat

Post by jumpsplat120 » June 24th, 2020, 7:20 pm

Ever wanted your chat to be limited to just a few people nearby? Want to hold secret meetings in dingy taverns, far from prying ears? Might I introduce...
LOCAL CHAT



Simply drop the following minimized code in, and BAM! Only those within the defined range (by default 10) will be able to hear what is being said. But of course, if you were to shout (LIKE THIS), then more people will be able to hear you! (by default a range of 20)

Here's a quick video demonstration of the script in action...



The code is only a few lines long, so feel free to modify it with extra features to suit your own needs! If you are using this script in any capacity, I would love to hear about it! Feel free to shoot me a message on Discord, Jumpsplat120#0001.

Simply click https://one.denizenscript.com/haste/71682, or view the github for a more expanded look at the code: https://github.com/jumpsplat120/Denizen ... l_Chat.dsc

EDIT: Updated code to perform check without regex
Last edited by jumpsplat120 on June 30th, 2020, 2:42 pm, edited 2 times in total.

User avatar
mcmonkey
Site Admin
Site Admin
Posts: 282
Joined: August 5th, 2016, 7:27 pm
Location: Los Angeles, California, USA
Contact:

Re: Local Chat

Post by mcmonkey » June 25th, 2020, 10:27 pm

What in the hecksinki is - if <context.message.replace_text[regex:<element[[^A-Za-z]]>].is_uppercase>: meant to be?

Also, you probably should make use of the recipients determination.

Also, the standard link to your current script would be https://one.denizenscript.com/haste/71368
Denizen lead developer. On Discord as mcmonkey#6666.

jumpsplat120
New
New
Posts: 6
Joined: June 24th, 2020, 6:05 pm

Re: Local Chat

Post by jumpsplat120 » June 28th, 2020, 1:41 pm

You can't use the .is_uppercase tag on an element that contains numbers or symbols, as it will automatically fail. So the tag removes all auto failing characters before checking. That way, you don't have to forgo proper punctuation when "yelling".

I'll update the link along with the determination change.

User avatar
mcmonkey
Site Admin
Site Admin
Posts: 282
Joined: August 5th, 2016, 7:27 pm
Location: Los Angeles, California, USA
Contact:

Re: Local Chat

Post by mcmonkey » June 29th, 2020, 9:31 am

You might want to instead check if <context.message.to_uppercase.equals_case_sensitive[<context.message>]> or something like that (generally, regex should be avoided whenever possible).
Denizen lead developer. On Discord as mcmonkey#6666.

jumpsplat120
New
New
Posts: 6
Joined: June 24th, 2020, 6:05 pm

Re: Local Chat

Post by jumpsplat120 » June 30th, 2020, 2:41 pm

Fantastic! I'll implement that.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests