Page 1 of 1

Please Remove all Colons from Talent IDs

Posted: Thu Sep 05, 2019 3:29 pm
by helminthauge
a good example of the talents whose IDs have colons are inscriptions

This makes addon developpings and debuggings involving these talents annoying. i.e. You can safely type game.player.T_RUSH, but something like game.player.T_INFUSION:_REGENERATION_2 is not going to work.

and I see no downsides of this, except for the efforts to do so.

Re: Please Remove all Colons from Talent IDs

Posted: Fri Sep 06, 2019 12:02 am
by HousePet
You can bypass it with square brackets instead of the . indexing of tables.

So game.player["T_INFUSION:_REGENERATION_2"] should work.

Re: Please Remove all Colons from Talent IDs

Posted: Fri Sep 06, 2019 1:35 am
by helminthauge
yeah, this works, but what if I'm trying to build such a table in a data file? Using quotations in key seems not working, neither does using colons of course.

Re: Please Remove all Colons from Talent IDs

Posted: Fri Sep 06, 2019 7:58 am
by HousePet
What are you trying to do that isn't working?
There is no reason that syntax would work in one place, but not in another.

Re: Please Remove all Colons from Talent IDs

Posted: Fri Sep 06, 2019 11:25 am
by helminthauge
I'm trying to write an addon and I want to import a table where some keys are talent IDs from a data file.

plus, when debugging, using [] won't give you auto-complete.

Re: Please Remove all Colons from Talent IDs

Posted: Fri Sep 06, 2019 11:46 pm
by HousePet
Subtly hinting that you should post the code that isn't working...

Re: Please Remove all Colons from Talent IDs

Posted: Sun Sep 08, 2019 3:24 am
by Zizzo
helminthauge wrote:I'm trying to write an addon and I want to import a table where some keys are talent IDs from a data file.
The [] syntax can be used in table indexes too. For instance, here's a fragment from a talent point plan vault file generated by (and designed to be reloaded by) my Talent Point Planner addon:

Code: Select all

wire_version = 3
talents = {
  ["T_VITALITY"] = 1,
  ["T_UNENDING_FRENZY"] = 5,
  ["T_WINDBLADE"] = 1,
  ["T_ACTIVATE_OBJECT_20"] = 1,
  ["T_ACTIVATE_OBJECT_14"] = 1,
  ["T_SECONDARY:_PAIN_SUPPRESSION_1"] = 1,
  ["T_LIGHT_ARMOUR_TRAINING"] = 1,
  ["T_QUICK_RECOVERY"] = 5,

Re: Please Remove all Colons from Talent IDs

Posted: Fri Sep 13, 2019 4:54 pm
by helminthauge
ok, thx Zizzo. seems I'd better actually go to learn Lua