Help with Spell Variables

Questions about addon itself.
2 posts Page 1 of 1
Zathras
Posts: 1
Joined: 22 Jul 2018, 21:11


Hi K,

I saw your post about the tedium of getting all the spell numbers out as variables. I wasn't able to reply so I posted this new one. This may be overkill, but there's a way to get that directly from the WOW interface. I scribbled this up (below)

it goes through spells 1 to 100,000 and, if it's really a spell, prints a line that reads...
_WordofRecallOther = 4;
_DeathTouch = 5;
etc.

you can cut and paste those lines into your code to get the list you were looking for. If 100,000 is too low, just bump it up. I'm not sure how high the spell numbers go.

It also creates an array called "spells" and loads them in. So you can have call: spells["Word of Recall Other"] to get number 4 or spells["Death Touch"] to get 5. (no cut and paste needed, just pull out the print commands and put the function at the initialization).

The drawback is that it prolly gets EVERY spell, whether it's user-castable or not... including boss spells, etc.
But I hope it helps. I found a way to scan through the current users spellbook and get the info, but if they change talents, those would change too, so it wouldn't be a complete list of all possible spells for a given class/spec.
Code: Select all
spells = {};  -- REMOVE if you don't need the array
iMaxSpellId = 100000;
for i=1,iMaxSpellId do
	name, rank, icon, castTime, minRange, maxRange = GetSpellInfo(i);
	if (name) then
		-- Don't store any spells with a parenthesis
		-- these say things like "Vanilla Strike(OLD)"
		if (not name:match("%)")) then
			spells[name]=i;  -- REMOVE if you don't need the array
			-- remove spaces, apostrophes, and parenthesis (in case you change to keep those spells)
			nameVar = name:gsub("[ '%(%)]+",""); -- REMOVE if you don't need the cut/paste
			-- Print out the variable in the format you asked for, so you can cut/paste it
			print ("_".. nameVar.." = " .. i .. ";");  -- REMOVE if you don't need the cut/paste
		end;
	end;
end;
Kaminaris
Site Admin
Posts: 298
Joined: 25 Jun 2017, 03:45


Well, tbh its even less useful than my own script that rips spells from Icy veins:
viewtopic.php?f=4&t=15

Check under:
OR you can use my magic function that extracts spells automatically

Except it also has some trash inside that needs to be cleaned up.
2 posts Page 1 of 1
drogie łóżka stolik kawowy stół dębowy rozkładany