WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   ChatGPT (https://www.wowinterface.com/forums/showthread.php?t=59483)

sirpucna 01-22-23 11:21 PM

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.

SDPhantom 01-23-23 07:15 PM

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)

Quote:

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.



Quote:

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.

sirpucna 01-23-23 09:23 PM

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

SDPhantom 01-25-23 12:53 AM

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.

EvilMaddness 01-25-23 03:12 AM

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.


All times are GMT -6. The time now is 02:05 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI