Quantcast
Making a custom channel sticky - WoWInterface
Thread Tools Display Modes
02-02-09, 12:44 PM   #1
knifesideleft
A Defias Bandit
Join Date: Feb 2009
Posts: 2
Making a custom channel sticky

I haven't programmed in 4 years (vb6 shouldn't be considered a language though) and I've started again trying to do my first mod mod for wow. This mod is for me and my friends and basicly it creates a sort of fake guild chat. It automaticly joins a channel and allows us to chat.

Anyway one really important feature that I'd like it to have is be set to sticky when used. I've tried ChatTypeInfo["Custom chan namestring here"]={sticky=1}; but it doesn't seem to work with anything other then say guild raid or whisper. Not only that it has the tendency to change the text colors. Am I just doing this wrong or is this not supported.

I figured I could just go around this somehow but I have yet to figure it out.
Unless theres a way to take the text from the msgbox after being entered then stopping it from being set and then send it to whereever I want via sendchatmessage
  Reply With Quote
02-02-09, 01:42 PM   #2
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
There are already addons that do this, although I can't think of the names off the top of my head. Look in the chat mods section here.

If you want to do it yourself, you probably need to hook ChatFrameEditBox's OnTextChanged and OnShow handlers, and actually modify its OnEnterPressed handler... (http://www.wowwiki.com/UIHANDLER_OnTextChanged)

i.e. ChatFrameEditBox:HookScript("OnTextChanged", myFunction)

etc...

To do the sticky channel stuff and also watch for: 1. other sticky channel changes so you can disable your override, 2. anything else starting with / so you can ignore it.
  Reply With Quote
02-02-09, 03:03 PM   #3
Sekrin
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 150
Prat does this, amongst other things.
__________________
  Reply With Quote
02-02-09, 04:02 PM   #4
Cirk
A Cobalt Mageweaver
 
Cirk's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 226
As does Chatmanager
__________________
Cirk's Addons
  Reply With Quote
02-03-09, 04:54 PM   #5
knifesideleft
A Defias Bandit
Join Date: Feb 2009
Posts: 2
bah

Alright so here is what ice come up with so far on a testing mod

Code:
function Dmodtest_OnLoad()
DEFAULT_CHAT_FRAME:AddMessage("Testing Mod Running")
ChatEditBox = getglobal("ChatFrameEditBox");
ChatEditBox:HookScript("OnShow", Dmodtest_OnShow)
ChatEditBox:HookScript("OnTextSet",Dmodtest_SetText)
end

function Dmodtest_OnShow()
ChatEditBox:SetText(" ")
SetEnabled = true
end

function Dmodtest_SetText()

DEFAULT_CHAT_FRAME:AddMessage("Set Text Activated")
if SetEnabled == true then
ChatEditBox:SetText("text")
SetEnabled = false
end

end

So basically every time I open the edit box it fires a blank settext to trigger what I really want in the box, and then it disables it from happening again

It works pretty good except for the Dmodtest_SetText being fired several times but its considerably better then when I had hooked OnTextChanged because it would go on firing forever. It would of worked well if I could have figured out how to unhook them after the text was posted but unless I did it wrong I guess UnHookScript doesn't exit. What I was originally going to do was Untextchanged then set text. Then use Gettext and if it matched what I wanted I would unhook it. Im just surprised it workes considering anything I used to program was just a bunch of functions with 100's of if statements and duplicate peices of code used over and over again that could of been set as just 1 function itself. I'm pretty sure that there's some obvious improvements sitting right in front of my eyes though.

Last edited by knifesideleft : 02-03-09 at 07:54 PM.
  Reply With Quote
02-04-09, 12:29 PM   #6
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
If it's working for you so far then great. If you want to use OnTextChanged, you can't unhook the script, but you can set a variable and use an if statement in your function so that it doesn't do anything.
  Reply With Quote
02-04-09, 02:40 PM   #7
Kleo
A Theradrim Guardian
Join Date: Jun 2007
Posts: 62
StickyChannel does that, without all the other functions.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Making a custom channel sticky

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