Raised This Month: $51 Target: $400
 12% 

Attribute Description Formatting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Riotline
AlliedModders Donor
Join Date: Oct 2015
Location: Half Life 3
Old 11-22-2021 , 04:58   Attribute Description Formatting
Reply With Quote #1

G'day,
I've been messing around with the Attributes of Items/Weapons (in TF2) and it seems when I PrintToChat an attribute's key valued description (e.g. #Attrib_DamageDone_Negative) it will format into "% damage [blah blah blah]" but if I do anything else to the formatted string it goes to the '#Attrib_DamageDone_Negative'.

I'm wondering if there's a way to reliably obtain the actual description rather than the placeholding name for the description (i.e. grab the "% dmg" from the "#Attrib_...").
__________________
Riotline is offline
PC Gamer
Veteran Member
Join Date: Mar 2014
Old 11-23-2021 , 09:27   Re: Attribute Description Formatting
Reply With Quote #2

You didn't mention if you are trying to view static attributes of items or attributes that you applied. How you view attribute data will largely depend on how you applied them.

You may consider using [TF2/CS:GO] Econ Data written by the talented nosoop. Here's a link: https://forums.alliedmods.net/showthread.php?t=315011

The commands you may be interested in are: TF2Econ_GetAttributeName(), TF2Econ_GetAttributeDefinitionString(defindex , "description_string", ...), and TF2Econ_GetAttributeDefinitionString(defindex , "description_format", ...)

I hope this helps.
PC Gamer is offline
Riotline
AlliedModders Donor
Join Date: Oct 2015
Location: Half Life 3
Old 11-23-2021 , 20:43   Re: Attribute Description Formatting
Reply With Quote #3

Cheers for that; however, I am already using nosoop's Econ Data for grabbing the descriptors from the items_games.txt (? forgot actual file name lmao).
Issue I'm having is that when Printed alone, as a string, it appears as the descriptor as shown in game and in the wiki of attributes; however, when anything else is in the formatted string, it will revert into the items_games.txt (?) identifier for the description instead (e.g. #Attrib_DamageDone_Negative).

Expected Result from "%s" : % damage done
Actual Result from "%s" : % damage done
Expected Result from "10%s" : 10% damage done
Actual Result from "10%s" : 10#Attrib_DamageDone_Negative
__________________

Last edited by Riotline; 11-23-2021 at 20:50.
Riotline is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 11-24-2021 , 03:42   Re: Attribute Description Formatting
Reply With Quote #4

It sounds like you'll want Powerlord's PrintValveTranslation stock for this (or the raw TextMsg usermessage that it wraps). It does have its limitations, though.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:13.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode