Thread Tools Display Modes
10-17-13, 09:52 AM   #1
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
Addon Request - Lua Command Sending

Is there any way for anyone to send a lua command to another wow client and have that client run the command.

I would like both clients to use the mod. Have some sort of approved list so that each client which sends commands are only able to send commands to trusted clients.

I would like the commands to be run automatically if on the approved list.

I have a seen a few mods capable of doing this. Like Elvui for example, you can send your entire elvui interface profile to another player.
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...
  Reply With Quote
10-17-13, 12:27 PM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,362
Telepathy does something along those lines with spells.
  Reply With Quote
10-17-13, 05:18 PM   #3
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
Cool addon idea but nothing close to what I am looking for really.

I want to beable to push a lua command.
Even something simple like...
/run print("hi noob")

The idea is to beable to send a client LUA Commands that will run on next key press or just the instant they get the sent information from another client using the same mod.
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...
  Reply With Quote
10-18-13, 01:55 AM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Something like this on the sending end:

Code:
SendAddonMessage("CmdShare", [[print("hi noob")]], "WHISPER", "Otherplayer")
... and this on the receiving end:

Code:
RegisterAddonMessagePrefix("CmdShare")

local frame = CreateFrame("Frame")
frame:RegisterEvent("CHAT_MSG_ADDON")
frame:SetScript("OnEvent", function(self, event, prefix, message, channel, sender)
    if prefix == "CmdShare" then
        local func, err = loadstring(message)
        if func then
            print("Running shared command:")
            print("   " .. message)
            func()
        else
            print("Error loading shared command:")
            print("   " .. message)
            print("   " .. err)
        end
    end
end)
Note that the above doesn't provide any security; it will send to anyone, and run commands from anyone. You'd want to check the sender before executing the command, and possibly add some kind of promt the receiver needs to accept before the command gets run.

Also, you should either:

(a) check the command against a list of secure/protected functions that require hardware events (or that can't be called by addons at all) and avoid sending it or execute it if it contains any;

or (b) set up a secure macrotext button for the receive to click (or activate with a keybind) to execute the command, though you'd still need to check for functions that can't be called by addons at all (eg. CastSpellByName) and either avoid trying to execute the command, or convert those function calls into secure button attributes (eg. type/spell, spell/Frostbolt).
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.

Last edited by Phanx : 10-18-13 at 01:57 AM.
  Reply With Quote
10-18-13, 09:56 AM   #5
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
I thank you for the effort you have put forth.

I would be very honest to say, I know less lua than your pet hamster.

I would do an arena carry for you or something for you to create a mod however !

I was thinking of something similar like this

typing ! before what you type in chat tells the mod that this is a command to send then target or player name and then command. So I guess something like this?

! Morpheusxeno /run LeaveParty()
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...

Last edited by morpheusxeno : 10-18-13 at 09:59 AM.
  Reply With Quote
10-19-13, 12:31 PM   #6
morpheusxeno
A Flamescale Wyrmkin
 
morpheusxeno's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 126
shameless bump!
__________________
My mother-in-law fell down a wishing well. I was amazed; I never knew they worked...
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Addon Request - Lua Command Sending


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