Inspect target combat ability

jose_95

Member
Nov 10, 2019
13
0
0
This script allows you to inspect a target to get information useful for combat.

Instructions:
1 - Install this script: https://one.denizenscript.com/haste/61913
2 - Name any item "Inspect Target" (Or have the item's name contain "Inspect Target")
3 - Attack a player or mob with the item in your hand.

Information includes (But is not limited to):
- Items, their durability, and enchantments.
- Potion effects
- Damage of melee weapon
- The damage you'll inflict based on armor
- Damage the mob will inflict to you based on armor
- Armor and the damage it'll absorb
- Movement speed

Preview:
xTyL8YQ.png
 

mcmonkey

Administrator
Staff member
Helper
- Script is a bit long and messy (fallbacks / defines might come in handy here)
- For highly repetitive code (like the sub-section of script that's copypasta'd for each item), make a subscript to be ran per item, instead of copypastaspasm. The end result will occupy less than half the file size, and be much cleaner/clearer/smarter for it.
- You'll also cut the file size almost exactly in half by not literally having two full copies of the script in the file. Which you did. There's one entire copy for if the mainhand item is an inspector, and then a second entire copy for the offhand. Why in the seventeen hells would you ever do that.
- You should make a unique item script for this, not the weird name based thing
- NEVER do raw comparisons of objects (things like <item> == i@air or <list> == li@) those are VERY BAD... do static value comparisons and tag-assisted comparisons (like <item.material.name> == air or <list.is_empty>)
- if <X> contains <Y> is deprecated. Get rid of it. Use the contains tag.
- - if <context.entity.type> == Player: did you intentionally make this an object-type based check? Cause that's... weird. You probably meant to use entity_type there?
 

jose_95

Member
Nov 10, 2019
13
0
0
Hey, thanks for checking it out!

- I didnt quite get how fallbacks work. I didnt use define because I didnt know where it was needed. The tag would just do

- You are right, I should do that when I can. Might do use a define because of two different scripts.

- Wasnt thinking about making it small at the moment, just that it worked.

- Alright, will do

- I suppose you mean about the <context.entity.name>. I use it because it returns the custom name of entities, player names and entity types.

If you meant the attack speed where I checked if it was a player being inspected, I used entity.type because its shorter than entity.entity_type
 

mcmonkey

Administrator
Staff member
Helper
jose_95 said:
- I suppose you mean about the <context.entity.name>. I use it because it returns the custom name of entities, player names and entity types.
I never mentioned anything about context.entity.name, wat.

jose_95 said:
If you meant the attack speed where I checked if it was a player being inspected, I used entity.type because its shorter than entity.entity_type

Then you used the wrong tag. Those are two different tags that do different things.