Help With Non-Spammable RP Macro

/run local ran=[random(1,100)]
/run local x={a,b,c,d}
/script if ran=100 then SendChatMessage(local x[random(1,4)], "SAY", "DARNASSIAN")
/cast charge

It’s supposed to only say RP dialogue when the random number is 100, so it doesn’t get spammed. Does it make sense what I’m trying to do? Any suggestions to get it working?

/run local ran=[random(1,100)]

Should be causing an error but then again so should if ran=100 instead of if ran==100.

Treat each /run as a sperate code block in that one doesn’t know about locals declared in the others. In other words your test, table and if all need to be in the one /run

/run local ran,x = random(1,100),{"a","b","c","d"} if ran==100 then SendChatMessage(x[random(1,4)], "SAY", "DARNASSIAN") end
/cast charge
1 Like

Wow thanks Fizzlemizz!!!

It seems to work well. I increase the change to <=9 because 1 in 100 seemed super rare! Maybe I’ll turn it down later. I also changed Darnassian to “2”, each language seems to have a corresponding number. This should save room if I wanted to add longer RP phrases.

/run local ran,x = random(1,100),{"Praise Elune!","They shall not escape!","For the Goddess!","Strike!"} if ran<=9 then SendChatMessage(x[random(1,4)], "YELL", "2") end
/startattack
/cast charge

EDIT:
Orcish - 1 (Orcs)
Darnassian - 2 (Night Elves)
Taur’ahe - 3 (Tauren)
Dwarvish - 6 (Dwarves)
Common - 7 (Humans and Worgen)
Demonic - 8 (Demon Hunters)
Thalassian - 10 (Blood Elves and Void Elves)
Gnomish - 13 (Gnomes)
Troll - 14 (Trolls)
Gutterspeak - 33 (Forsaken)
Draenic - 35 (Draenei)
Goblin - 40 (Goblins)
Pandaren - 42 (Pandaren)
Shalassian - 181 (Nightborne)

You could place your messages in an addon that loads them into a global table once at startup rather than limiting yourself to what you can fit in a macro along with the other code.

But then again you could place the whole /run part into the same addon with a global function and just:

/run JwGlobalMessageFunc()
/cast charge
1 Like