Language Macro Problems

UI and Macro
I'm not sure exactly which of the recent patches is the source of this problem, but I've noticed that the following is not working anymore:

/run SendChatMessage("I can speak Darnassian!","SAY","DARNASSIAN")

Whenever I run that macro, it simply says "I can speak Darnassian!" in Common. Now, perhaps it is worth noting that even when I change to Darnassian manually (via the emote menu), the macro still speaks the line in common. Did something happen with a recent patch that altered the way languages are indexed by the UI?

Additionally, this macro no longer works as a language "toggle" macro:

/script DEFAULT_CHAT_FRAME.editBox.language = GetLanguageByIndex(2)

I'm assuming the same issue is occurring, whatever it may be. The only add-on I am running is Weak Auras.

Is anyone else experiencing this and/or knows of a solution?
I actually just noticed this earlier. After looking through the latest UI source, it turns out that SendChatMessage now takes a languageID (the second return of GetLanguageByIndex) rather than a language name.

You can find the ID of each of your languages with this macro:/run for i = 1, GetNumLanguages() do print(GetLanguageByIndex(i)) end

It should print the name and ID of each language you need.
Thanks, Choonster. I was just playing with the macro, in-game, myself, and noticed that this works:

/run SendChatMessage("I can speak Darnassian!","SAY","2")

Now, changing the "2" to a "1" does not speak the line in common. In fact, it returns a "You do not know that language" error. I will have to run your script command and see what the index value for Common is, but I know that you can also leave off the last conditional, entirely, to force it to automatically use Common (or, I assume, Orcish, if you are Horde).

I assume this will also fix the language toggle I mentioned in the previous post. Thanks, again.


Edit: for the record, that returned the following:

Darnassian 2
Common 7

I thought it would return the entire list, that I could then post here, but I guess it returns only languages that your character can speak. So each individual race will have to run Choonster's line in order to find out the values for any language macros they want to run!
Well, as it turns out, this one still isn't working:

/script DEFAULT_CHAT_FRAME.editBox.language = GetLanguageByIndex(2)

Its intended as a simple toggle for languages, and is paired with another toggle button that is the same code but with "(7)" instead of "(2)", to switch back to Common.

That's assigning the language field of the editBox to the first return of GetLanguageByIndex. What you need to do is assign the languageID field of the editBox to the second return of GetLanguageByIndex.

/run DEFAULT_CHAT_FRAME.editBox.languageID = select(2, GetLanguageByIndex(2))
Ah, this works. Please and thank you!!
Something you might find useful... my addon NativeSpeech adds a "/n" command to the game which works just like /s, except that it speaks in your character's native language. It also adds a "/ny", which can be used to yell in your character's native language. With the addon loaded, you can also use those commands in macros.

Join the Conversation

Return to Forum