Thread Tools Display Modes
Prev Previous Post   Next Post Next
01-22-23, 11:21 PM   #1
sirpucna
An Aku'mai Servant
Join Date: Nov 2016
Posts: 34
ChatGPT

Just signed up and thought i'd try put it through World of Warcraft lua.

curious to see what else people can do with it

here are some things i've tried so far:

build a lua script for world of warcraft that prints the text "hello world"

Lua Code:
  1. print("hello world")
  2. You can run this script by typing the command /run print("hello world") in the chat window, or by binding it to a macro.


build a lua script for world of warcraft that auto replies to anyone a chat message in game saying "i'm busy"


Lua Code:
  1. local function AutoReply(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12)
  2.   if event == "CHAT_MSG_WHISPER" then
  3.     SendChatMessage("I'm busy", "WHISPER", nil, arg2)
  4.   end
  5. end
  6.  
  7. ChatFrame_AddMessageEventFilter("CHAT_MSG_WHISPER", AutoReply)
  8.  
  9. You can run this script by typing the command /run AutoReply() in the chat window, or by binding it to a macro.
  10.  
  11. This script will work for whispers (private messages) only, if you want to reply to other type of chat messages you should replace "CHAT_MSG_WHISPER" with the appropriate event type.
  12.  
  13. You can also change the reply message from "I'm busy" to any other message you want.
  14.  
  15. Also, you might want to add a delay between the reply messages to avoid spamming.


build a lua script for world of warcraft that notifies me in the middle of the screen when the aura buff "Power Infusion" is present on me.

Lua Code:
  1. local function CheckPowerInfusion()
  2.     local name, _, _, _, _, _, _, _, _, spellId = UnitBuff("player", "Power Infusion")
  3.     if spellId then
  4.         UIErrorsFrame:AddMessage("Power Infusion is up!", 1.0, 1.0, 0.0, 53, 5)
  5.     end
  6. end
  7.  
  8. local frame = CreateFrame("Frame")
  9. frame:RegisterEvent("UNIT_AURA")
  10. frame:SetScript("OnEvent", function(self, event, ...)
  11.     if event == "UNIT_AURA" and ... == "player" then
  12.         CheckPowerInfusion()
  13.     end
  14. end)
  15. You can run this script by typing the command /run CheckPowerInfusion() in the chat window, or by binding it to a macro.
  16.  
  17. This script uses the UnitBuff function to check if the "Power Infusion" aura is present on the player, and if it is, it uses the UIErrorsFrame:AddMessage function to display a notification in the middle of the screen. You can adjust the color and position of the message by changing the parameters of the UIErrorsFrame:AddMessage function.
  18.  
  19. Also, you can set a timer to check the buff every x seconds instead of using the UNIT_AURA event and also you could also use another function as UnitAura to check for the presence of the buff.

Last edited by sirpucna : 01-24-23 at 05:10 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » General Authoring Discussion » ChatGPT


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