Thread Tools Display Modes
10-27-19, 09:24 AM   #1
BloodDragon
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 32
Please Help Button for /command`s

Hi,

i have a little Problem, i make a Button with a /command, like this

Lua Code:
  1. [b]QC.b=Add_Button(L["PullTimer"],"/pull 6",W,0,QC.F,{0.7,0.7,0.2,1});W=W+50;[/b]


In the game now i press the button PullTimer.
Now it is in chat /pull 6 and I would have to confirm with Enter. But I want if I click the button PullTimer the command /pull 6 is executed automatically.

Iam new on lua so i hope everyone can help me with it.
It would be very very friendly if someone could help me.

Sorry for my Bad English.
Attached Files
File Type: lua main.lua (4.4 KB, 140 views)
  Reply With Quote
10-27-19, 11:46 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
I assume /pull x is simply a text display alerting the group when the pull will start ? If so maybe what you need to use instead is ..

DEFAULT_CHAT_FRAME:AddMessage(text,r,g,b)

We use this in nUI to display messages automatically such as for errors and information.


However, if /pull x actually does something in the game play then unless there is a macro or script function equivalent there is unlikely to be an automated equivalent.
__________________
  Reply With Quote
10-27-19, 11:57 AM   #3
BloodDragon
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 32
I trying to execute the slash command, rather than just put the text in the editbox.

The commands are:
/roll
/readycheck
/pull 6
  Reply With Quote
10-27-19, 12:45 PM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
If you're trying to call DBM's pull command from a button, you can use their slash function directly:

This will call the default 10 seconds:
SlashCmdList.DEADLYBOSSMODSPULL()
This will call the 6 seconds you want:
SlashCmdList.DEADLYBOSSMODSPULL(6)
Same with /break as well:
SlashCmdList.DEADLYBOSSMODSBREAK()
(break's number is in minutes)

Last edited by Kanegasi : 10-27-19 at 12:47 PM.
  Reply With Quote
10-27-19, 12:51 PM   #5
BloodDragon
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 32
This is my Button:
Lua Code:
  1. QC.b=Add_Button(L["PullTimer"],"/pull 6",W,0,QC.F,{0.7,0.7,0.2,1});W=W+50;

So i must insert your command here?:
Lua Code:
  1. QC.b=Add_Button(L["PullTimer"],"SlashCmdList.DEADLYBOSSMODSPULL(6)",W,0,QC.F,{0.7,0.7,0.2,1});W=W+50;

I'm really a big beginner in the .lua area.

I think my main.lua is not bad. but I'm not quite there .
  Reply With Quote
10-27-19, 01:05 PM   #6
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Ahh, I see what you're doing there. Your buttons only open chat. Replace your OnClick handler with this:

Lua Code:
  1. Button:SetScript("OnClick", function()
  2.     if command=="/pull 6" then
  3.         SlashCmdList.DEADLYBOSSMODSPULL(6)
  4.     else
  5.         Open_chat(command)
  6.     end
  7. end)

This is a simple way to do it. You can also do this for readycheck and roll as well, which are DoReadyCheck() and RandomRoll("1","100").
  Reply With Quote
10-27-19, 01:23 PM   #7
BloodDragon
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 32
Ok Pulltimer works very nice now thx a lot.

Lua Code:
  1. Button:SetScript("OnClick", function()
  2.         if command=="/pull 6" then
  3.             SlashCmdList.DEADLYBOSSMODSPULL(6)
  4.         else
  5.             Open_chat(command)
  6.         end
  7.     end)
  8.     return Button;

So now i must add the the other commands
on the same place like:

Lua Code:
  1. Button:SetScript("OnClick", function()
  2.         if command=="/pull 6" then
  3.             SlashCmdList.DEADLYBOSSMODSPULL(6)
  4.         else
  5.         if command=="/readycheck" then
  6.             SlashCmdList.DoReadyCheck()
  7.         else
  8.             Open_chat(command)
  9.         end
  10.     end)
  11.     return Button;

But this dont work.
  Reply With Quote
10-27-19, 01:31 PM   #8
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
It's just DoReadyCheck(), no SlashCmdList for that. The colored functions I mentioned are exactly how they are. You're also missing "elseif".

Lua Code:
  1. Button:SetScript("OnClick", function()
  2.     if command=="/pull 6" then
  3.         SlashCmdList.DEADLYBOSSMODSPULL(6)
  4.     elseif command=="/readycheck" then
  5.         DoReadyCheck()
  6.     else
  7.         Open_chat(command)
  8.     end
  9. end)
  Reply With Quote
10-27-19, 02:12 PM   #9
BloodDragon
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Mar 2017
Posts: 32
Ahhhh ok i understand very very thank you i love you for the help.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Please Help Button for /command`s

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