Thread Tools Display Modes
05/04/14, 11:24 PM   #1
lyravega
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 93
Any alternative to d()?

Is there a similar command that works like d()?
  Reply With Quote
05/04/14, 11:56 PM   #2
Harven
 
Harven's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 135
If you mean a command that add some text to chat window, then there is CHAT_SYSTEM:AddMessage()
  Reply With Quote
05/04/14, 11:58 PM   #3
lyravega
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 93
Yep, thanks!
  Reply With Quote
05/05/14, 02:32 AM   #4
SpecialK
Join Date: Apr 2014
Posts: 6
A handy way for formatted print to screen with a default color; sort of C "printf()" style.

Lua Code:
  1. local function p(...)
  2.    local function w(...) CHAT_SYSTEM:AddMessage("|cD8C1FF"..string.format(...).."|r") end
  3.    local s, r = pcall(w, ...)
  4.    if not s then error(r, 2) end
  5. end

With the pcall() to the wrapper it will catch string.format() errors and point to the exact "p()" call where it happened (like accidentally passing a "nil" value for example). With out this setup it you'll only see the context on/inside the "p()" call it's self.

Example usage:
Lua Code:
  1. p("My name is \"%s\"", GetUnitName("player"))

You could add more variations of course.
Like pass a color argument instead of a default color "local function p(color, ...)", etc.
  Reply With Quote
05/05/14, 10:29 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Every time you call your P() function, you create a new instance of your w() function.
  Reply With Quote
05/19/14, 02:45 AM   #6
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by lyravega View Post
Is there a similar command that works like d()?
If you want d() messages from before the init of chat window being shown, LibDebug can do that (it adds buffering to d() ). But right now it has minor bug with swallowed Parsing errors so it's a two edged sword for Developers till next version.
  Reply With Quote
05/23/14, 03:49 PM   #7
zolan
 
zolan's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 11
Originally Posted by lyravega View Post
Is there a similar command that works like d()?
I do this in my addons. It will output to whatever chat window screen that the user has open.

CHAT_SYSTEM["containers"][1]["currentBuffer"]:AddMessage('message here')

It, of course, won't work until after PLAYER_ACTIVATED is fired off, so that won't work if you are just trying to get debug info but is great for outputting stuff for the user.

~Zolan
  Reply With Quote
05/23/14, 06:57 PM   #8
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
Or just
Lua Code:
  1. CHAT_SYSTEM:AddMessage("text")
  Reply With Quote
05/29/14, 04:51 PM   #9
zolan
 
zolan's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 11
Just in case this might help someone else out.. If you know the container and tab that you want to output to you can do this:

By default there is only one container, though I think there may be addons that make other containers:

Lua Code:
  1. containerNum = 1

And the tabs seem to be numbered from left to right so the second tab would be 2:

Lua Code:
  1. tabNum = 2

Using those you can output 'Ta daaaaaaa' to the first container on the 2nd tab using the following:

Lua Code:
  1. CHAT_SYSTEM.containers[containerNum].windows[tabNum].buffer:AddMessage('Ta daaaaaaa')

I'd be glad to know if someone comes up with a better solution than this.

~Zolan
  Reply With Quote
05/30/14, 11:49 AM   #10
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by zolan View Post
I'd be glad to know if someone comes up with a better solution than this.
You should propably go up and read the post of Seraah just between your two posts. Not tried them, but I think he knows what he is saying.
  Reply With Quote
05/30/14, 12:22 PM   #11
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
But Zolan's second post is for if you want to write to a tab other than the default/1st.
  Reply With Quote
05/30/14, 02:56 PM   #12
zolan
 
zolan's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 11
Originally Posted by zgrssd View Post
You should propably go up and read the post of Seraah just between your two posts. Not tried them, but I think he knows what he is saying.
Serrah definitely knows what *she* is saying. But my first post definitely doesn't behave like d() as it adds a message to whatever your currently selected tab is.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Any alternative to d()?


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