#(NomzHD) Towny compatibility

67 messages · Page 1 of 1 (latest)

grim barn
#

I am trying to find ways to flag players as members of specific towns or nations but I'm unable in finding a way to successfully do so.

If someone could give me some direction I'd appreciate it.

My script is meant to give members of a specific nation, infinite conduit power when they log on. Currently it gives any player who logs on that conduit power.

Not sure if we are allowed to post scripts in here but if needed I can definitely do that.

Help is appreciated!

minor whaleBOT
#

(NomzHD) Towny compatibility

#

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.
You can block this bot if you don't want to see these messages, I won't mind.
<@&525394568410038282>

vagrant glacier
#

you can use <TownTag.residents> to check if the player that just joined is a resident of the Town and then you can cast the CONDUIT_POWER effect using the cast command onto them if they are a resident. use <NationTag.residents> for the Nation version of it. alternatively you can also check their nation/town using <PlayerTag.town> or <PlayerTag.nation> and see if it matches the specific nation/town. you can use the player joins event to apply the effect when the log on. also, sharing scripts in help channels is 100% allowed and is helpful for helpers to help you, so if it's relevant, please post them :) you can post them using the denizen paste site.

#

!t towntag.residents

vague citrusBOT
vagrant glacier
#

!t nationtag.residents

vague citrusBOT
vagrant glacier
#

here is the link to the denizen paste site

#

!paste

vague citrusBOT
vagrant glacier
#
  • alternative tags that you can use to check
#

!t playertag.town

vague citrusBOT
vagrant glacier
#

!t playertown.nation

vague citrusBOT
#
Possible Confusion

Did you mean to search for playertag.nation?

vague citrusBOT
grim barn
#

Here is my script

#

I think I'm doing some small thing incorrectly lol

#

But I can't figure it out, I don't have a lot of practice with Denizen yet

#

Would I want to do like <PlayerTag.Nation[nation name]> true

#

jk that doesnt work unless another part of my script is wrong

vagrant glacier
#

ok so first things first, you are using if command incorrectly. see this guide page on how to use it correctly:

#

!guide if command

vague citrusBOT
grim barn
#

Oh I see

vagrant glacier
#

second, you aren't creating the NationTag correctly. just specifying Nationtag does not mean anything, as Denizen doesn't know what know what Nation you are talking about. you need to provide the name of the nation. In your case, you would have to use <nation[Babylonia].residents> to get the residents of Babylonia. this guide page is relevant for creating tags:

#

!guide first tags

vague citrusBOT
grim barn
#

When the script gets the residents of Babylonia, does it then match it to whatever player then just joined the server to see if they are on that list?

(Just so I further understand how the tags work long-term)

vagrant glacier
#

no, you'll have to check if the player is in that list manually, which brings me to the next point:

#

!l operator

vague citrusBOT
# vagrant glacier !l operator

An operator is a tool for comparing values, used by commands like !command if, !command while, !command waituntil, ... and tags like !tag ObjectTag.is.than

Available Operators include:
"Equals" is written as "==" or "equals".
"Does not equal" is written as "!=".
"Is more than" is written as ">" or "more".
"Is less than" is written as "<" or "less".
"Is more than or equal to" is written as ">=" or "or_more".
"Is less than or equal to" is written as "<=" or "or_less".
"does this list or map contain" is written as "contains". For example, "- if a|b|c contains b:" or "- if [a=1;b=2] contains b:"
"is this in the list or map" is written as "in". For example, "- if b in a|b|c:", or "- if [a=1;b=2] contains b:"
"does this object or text match an advanced matcher" is wr...

Group

Comparables

vagrant glacier
#

you can use the contains operator to check if the list contains the player

#

i.e. if <nation[Babylonia].residents> contains <player>:

grim barn
#

Do I need to specify the player name?

vagrant glacier
#

no you can use <player> as the correct PlayerTag is already linked due to the player joins event

#

PlayerTags represent a player

grim barn
#

Oh I see oh shit

vagrant glacier
# vague citrus

if you need help understanding all the tag stuff and things like PlayerTags, then this guide page is helpful and can help get rid of any confusion you may have. as you seem like someone who is new to Denizen, then I would recommend reading through the whole guide to become more acquainted with the language :)

grim barn
#

I think its working now in-game as well which is exciting

#

This has been super informative

charred stirrupBOT
#

+> YAY!!!

grim barn
#

So when I'm specifying an event, ie "player join, player mine, etc" the script is checking the player currently doing the action

And then the tag runs that player against a set of conditions almost, yeah?

#

So in this case: Player joined, is the player meeting the condition of the nation.residents tag

vagrant glacier
#

the first part about the event knowing what player doing the action is right, but you are the one (with the if command and operators) doing the condition checks

#

actually i think what you said is correct

#

still, the if command is the one doing the check, the tag (<NationTag.residents>) just returns a list of all the residents

#

hmm hope i'm not confusing you because i'm getting confused reading my own mesages XD

delicate whale
#

Any queue can have an attached player / NPC - in you case the linked player is the player joining, and you are checking if that linked player is in the list of players returned by the NationTag.residents tag

#

Note that as bread mentioned you can also compare the name of the player's current nation

#

!t PlayerTag.nation

vague citrusBOT
delicate whale
vague citrusBOT
random falconBOT
#
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.)

#

@grim barn