Thread Tools Display Modes
01-22-23, 11:21 PM   #1
sirpucna
An Aku'mai Servant
Join Date: Nov 2016
Posts: 32
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
01-23-23, 07:15 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Interesting, though this one has some issues. It's largely dependent on having active chatframes with the message event registered. If you have multiple chatframes with the same event registered, it will send duplicate replies for each one.
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)

Originally Posted by ChatGPT
You can run this script by typing the command /run AutoReply() in the chat window, or by binding it to a macro.
This will do nothing as the callback function is expecting various arguments from a chat event that it isn't getting.



Originally Posted by ChatGPT
You can run this script by typing the command /run AutoReply() in the chat window, or by binding it to a macro.
You can run this script by typing the command /run CheckPowerInfusion() in the chat window, or by binding it to a macro.
Revisiting the second and also in the third prompt, these functions are defined as locals. You can't even access them with /run.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
01-23-23, 09:23 PM   #3
sirpucna
An Aku'mai Servant
Join Date: Nov 2016
Posts: 32
after a bit of testing, i've determined any new information you teach it is localized to the window you initiated the chat in, if you create a new chat window, it simply forgets what you taught it.
in other words if you try teach it new functions since DF's release, it will learn them, until you open a new window and its snapshot information from 2021 is back to giving you outdated information
  Reply With Quote
01-25-23, 12:53 AM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Probably a security measure so an end user can't permanently influence the bot.
Imagine if some random person were to feed it intentionally incorrect or harmful information.
The model itself is probably fed curated data in the first place.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-25-23 at 12:55 AM.
  Reply With Quote
01-25-23, 03:12 AM   #5
EvilMaddness
An Aku'mai Servant
 
EvilMaddness's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2015
Posts: 33
I've been trying to get a set end and start angle on the old spinner code

https://youtu.be/XPtVZ69lomk
For months. I'll figure it out one of these days.
Trial and error.
__________________
The Maddness Within lua

Last edited by EvilMaddness : 01-25-23 at 03:18 AM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » ChatGPT

Thread Tools
Display Modes

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