Quantcast Static initialising a table - WoWInterface
Thread Tools Display Modes
02-09-18, 09:44 AM   #1
doofus
A Wyrmkin Dreamwalker
Join Date: Feb 2018
Posts: 59
Static initialising a table

Can I do the following? Do you spot any obvious mistakes? The values below maybe fictitious - but is the syntax/concept correct?

Many thanks


local lSpellNamesAndIds = {
["PALADIN"] =
{
["Retribution"] =
{
["Judgment"] = { 231663, "Judgment", },
["Templars-verdict"] = { 85256, "templars-verdict", },
["crusader-strike"] = { 231667, "crusader-strike", },
},
},
["DRUID"] =
{
["Balance"] =
{
["Starfall"] = { 231663, "Starfall", },
["Sunrise"] = { 85256, "Sunrise", },
},
},
};
  Reply With Quote
02-09-18, 09:52 AM   #2
doofus
A Wyrmkin Dreamwalker
Join Date: Feb 2018
Posts: 59
OK I have fixed it now, a few extra commas here and there... Sorry
  Reply With Quote
02-09-18, 01:31 PM   #3
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,544
Originally Posted by doofus View Post
OK I have fixed it now, a few extra commas here and there... Sorry
Table errors are much easier to see when you format it this way.
Lua Code:
  1. local lSpellNamesAndIds = {
  2.      ["PALADIN"] = {
  3.           ["Retribution"] = {
  4.                ["Judgment"] = {
  5.                     231663,
  6.                     "Judgment",
  7.                },
  8.                ["Templars-verdict"] = {
  9.                     85256,
  10.                     "templars-verdict",
  11.                },
  12.                ["crusader-strike"] = {
  13.                     231667,
  14.                     "crusader-strike",
  15.                },
  16.           },
  17.      },
  18.      ["DRUID"] = {
  19.           ["Balance"] = {
  20.                ["Starfall"] = {
  21.                     231663,
  22.                     "Starfall",
  23.                },
  24.                ["Sunrise"] = {
  25.                     85256,
  26.                     "Sunrise",
  27.                },
  28.           },
  29.      },
  30. };
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-09-18, 02:40 PM   #4
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 416
Lua Code:
  1. local lSpellNamesAndIds = {
  2.      ["PALADIN"] = {
  3.           ["Retribution"] = {
  4.                ["Judgment"] =  231663,
  5.                ["Templars-verdict"] = 85256,
  6.                ["crusader-strike"] = 231667,
  7.           },
  8.      },
  9.      ["DRUID"] = {
  10.           ["Balance"] = {
  11.                ["Starfall"] = 231663,
  12.                ["Sunrise"] = 85256,
  13.           },
  14.      },
  15. };

Since you said your values are fictitious, this might not be useful advice, but there's certainly no need to create tables for every spell containing only the name and the ID.
__________________
  Reply With Quote
02-10-18, 12:51 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,544
Originally Posted by MunkDev View Post
Since you said your values are fictitious, this might not be useful advice, but there's certainly no need to create tables for every spell containing only the name and the ID.
I thought this as well, but since it wasn't actual code, I didn't think to say it.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
02-10-18, 03:14 PM   #6
doofus
A Wyrmkin Dreamwalker
Join Date: Feb 2018
Posts: 59
Yes it is in-progress code for the time being. I am not sure what to do with the spell lists yet, or the buffs/debuffs lists but I know I need to keep track. My idea is to create something like weakauras or more like simcraft, where you have script which looks at 2-3 things and decides what to do next. I got this idea from writing my own simcraft scripts for my Frost mage just a few lines of code so that I could understand the rotation and the talents etc and compare with the simcraft's own (very complicated) scripts. Then I thought why can't I have this script in game too - and then I tried weakauras or the other one that highlights your buttons, but it is too heavy duty and then I thought let me have a go at it myself. Something like that. It's also fun to make your own addon and use it (productively) in game. In the old WoW you could have it on full auto (one button raid healing), but now you cannot assign different actions to the same key in combat, so the best you can do is to highlight existing buttons or provide clues like DBM and others - anything more than that and you'd be breaking a lot of rules. And I suppose a lot of people already break them anyway.
  Reply With Quote
02-11-18, 02:22 PM   #7
Kakjens
A Cliff Giant
Join Date: Apr 2017
Posts: 75
You won't be able to break too many things. There's even certain goblin starting quest where you are asked to use the ability, the icon of which was just displayed.
You might be interested to check what people might have already done in this and similar projects.

Last edited by Kakjens : 02-11-18 at 02:24 PM.
  Reply With Quote
02-12-18, 02:47 AM   #8
doofus
A Wyrmkin Dreamwalker
Join Date: Feb 2018
Posts: 59
Thank you for the links to those addons.

I have done mine for now, I think, finished testing late last night, tested on my Balance Druid.

As with weakauras et all, I still find my reaction times way too slow to take full advantage of the on-screen prompts even though they display well before the end of the GCD or the previous spell cast. Maybe good to remind you to use a trinket or something but it's like bicycle riding, it needs to be fluid and quick, you cannot be following prompts. On the Frost Mage for example, on occasion I must cast 6 spells back to back, especially the Flurry's, you cannot be following prompts for that you have to know it or have a sequence macro for when Flurry procs.

I also think (have not tested) that the client queues keystrokes, so that you spam the spell 50% into the GCD and say 75% into the previous cast, and it still fires and with 0 latency, whereas if you wait any longer there will be pauses in your rotation and a DPS loss.

Best use of the prompts I think will be from a machine that reads the prompt and reacts in 0 time. Not allowed of course.
  Reply With Quote
02-12-18, 05:10 AM   #9
aallkkaa
A Theradrim Guardian
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 64
Originally Posted by doofus View Post
I also think (have not tested) that the client queues keystrokes, so that you spam the spell 50% into the GCD and say 75% into the previous cast, and it still fires and with 0 latency, whereas if you wait any longer there will be pauses in your rotation and a DPS loss.
A couple notes:
1. If I understood correctly, you were referring to "latency" as a lapse of time between a spell cast (or GCD) finisihing and a new cast starting. At least in WoW, this is not what people (or indeed Blizzard) usually refers to when speaking of "latency"; we usually refer to it as the time between your game client registering an user-event (say a button click) and that event being received by your realm's server, or inversely your realm's server sending you a world update (say some mob starting to cast a spell on you) and your game client receiving that information. This is essentially dependent on the player's Internet connection and, as different game clients (players) will have different latencies but still need to play in the same timeframe, some players will have this local-world / realm-world synchronisations spawned at "slightly" different intervals (when the difference isn't "slight", then you'll see players complain about "lag").
2. I might be wrong (don't think so but ...) but I believe the queueing works solely based on your actual latency (as I described it above). Your game client is aware of your latency (see https://wow.gamepedia.com/API_GetNetStats ) and will therefore allow you to queue an ability only within this time. E.g. your latency == 100ms means you can successfuly activate a spell 100ms before the current spell cast (or GCD) elapses.
  Reply With Quote
02-19-18, 02:59 PM   #10
doofus
A Wyrmkin Dreamwalker
Join Date: Feb 2018
Posts: 59
Originally Posted by aallkkaa View Post
A couple notes:
1. If I understood correctly, you were referring to "latency" as a lapse of time between a spell cast (or GCD) finisihing and a new cast starting. At least in WoW, this is not what people (or indeed Blizzard) usually refers to when speaking of "latency"; we usually refer to it as the time between your game client registering an user-event (say a button click) and that event being received by your realm's server, or inversely your realm's server sending you a world update (say some mob starting to cast a spell on you) and your game client receiving that information. This is essentially dependent on the player's Internet connection and, as different game clients (players) will have different latencies but still need to play in the same timeframe, some players will have this local-world / realm-world synchronisations spawned at "slightly" different intervals (when the difference isn't "slight", then you'll see players complain about "lag").
2. I might be wrong (don't think so but ...) but I believe the queueing works solely based on your actual latency (as I described it above). Your game client is aware of your latency (see https://wow.gamepedia.com/API_GetNetStats ) and will therefore allow you to queue an ability only within this time. E.g. your latency == 100ms means you can successfuly activate a spell 100ms before the current spell cast (or GCD) elapses.

Yes you are right, I am/was describing that the client has a look-ahead buffer for the keyboard, it used to be configurable but can't find it now, which means that the client launches a new spell as soon as it is practically possible which means that on my reported 35 ms latency I can visibly press the button once, and only once, while the cast bar is still at 70%-80% and the new spell still launches.
  Reply With Quote
02-20-18, 05:48 AM   #11
Xodiv
A Murloc Raider
Join Date: May 2007
Posts: 6
Originally Posted by doofus View Post
Yes you are right, I am/was describing that the client has a look-ahead buffer for the keyboard, it used to be configurable but can't find it now, which means that the client launches a new spell as soon as it is practically possible which means that on my reported 35 ms latency I can visibly press the button once, and only once, while the cast bar is still at 70%-80% and the new spell still launches.
This is now the CVar "SpellQueueWindow", which is in milliseconds.

/dump GetCVar("SpellQueueWindow")
/run SetCVar("SpellQueueWindow", 50) -- default is 400 I think.
  Reply With Quote
02-20-18, 03:21 PM   #12
doofus
A Wyrmkin Dreamwalker
Join Date: Feb 2018
Posts: 59
Ah that's good to know, thanks.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Static initialising a table

Thread Tools
Display Modes

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

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