WoWInterface

WoWInterface (http://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (http://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Static initialising a table (http://www.wowinterface.com/forums/showthread.php?t=56031)

doofus 02-09-18 09:44 AM

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", },
},
},
};

doofus 02-09-18 09:52 AM

OK I have fixed it now, a few extra commas here and there... Sorry

Seerah 02-09-18 01:31 PM

Quote:

Originally Posted by doofus (Post 326784)
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. };

MunkDev 02-09-18 02:40 PM

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.

Seerah 02-10-18 12:51 PM

Quote:

Originally Posted by MunkDev (Post 326789)
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.

doofus 02-10-18 03:14 PM

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.

Kakjens 02-11-18 02:22 PM

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.

doofus 02-12-18 02:47 AM

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.

aallkkaa 02-12-18 05:10 AM

Quote:

Originally Posted by doofus (Post 326834)
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.

doofus 02-19-18 02:59 PM

Quote:

Originally Posted by aallkkaa (Post 326838)
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.

Xodiv 02-20-18 05:48 AM

Quote:

Originally Posted by doofus (Post 326987)
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.

doofus 02-20-18 03:21 PM

Ah that's good to know, thanks.


All times are GMT -6. The time now is 09:27 PM.

vBulletin © 2018, Jelsoft Enterprises Ltd
© 2004 - 2017 MMOUI