Thread Tools Display Modes
09-08-08, 01:27 PM   #1
-Glenn-
A Defias Bandit
Join Date: Sep 2008
Posts: 3
Send selected option to chat

Hello,

I'm trying to make a simple addon for WoW, but I'm a bit stuck at the moment. I will keep it simple

I have a dropdown menu with the following options:
Option 1
Option 2
Option 3

Below that is a button: Send to Chat.


If Option 1 is selected, option 1 has to be sent to the chat box. I know the command for that. But how can I get the selected option usable for further using?

I tried the getglobal command, but that is not working:
Code:
chattext = getglobal("RaidHelperForm".."ComboBox1".."Label");
SendChatMessage("..."..chattext.."...", "SAY", this.language);
Can anyone help me with this?


Thank you,

Glenn
  Reply With Quote
09-08-08, 01:30 PM   #2
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Could you please post the full lua and xml code and the toc?
Thx
  Reply With Quote
09-08-08, 01:34 PM   #3
-Glenn-
A Defias Bandit
Join Date: Sep 2008
Posts: 3
I'm using the Program WoW UI Designer:

LUA
Code:
function RaidHelper_OnLoad()
    SLASH_RAIDHELPER1 = "/raidhelper";
    SLASH_RAIDHELPER2 = "/rh";
    SlashCmdList["RAIDHELPER"] = RaidHelper_SlashCmdHandler;
end

function RaidHelper_SlashCmdHandler()
    RaidHelperForm:Show();
end

function RaidHelperRaidChat()
    local skull;
    skull = getglobal("RaidHelperForm".."ComboBox1".."Label");
    SendChatMessage("..."..skull.."...", "SAY", this.language);
end
XML
<Ui xmlns="http://www.blizzard.com/wow/ui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--Autogenerated by wowuides, Version=1.0.300.0, Culture=neutral, PublicKeyToken=null-->
<Frame name="RaidHelperForm" movable="true">
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508883-59c2-4f83-ae10-27aaad48391b" />-->
<Size>
<AbsDimension x="386" y="400" />
</Size>
<Anchors>
<Anchor point="CENTER" relativeTo="UIParent">
<Offset>
<AbsDimension x="0" y="0" />
</Offset>
</Anchor>
</Anchors>
<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11" />
</BackgroundInsets>
<TileSize>
<AbsValue val="32" />
</TileSize>
<EdgeSize>
<AbsValue val="32" />
</EdgeSize>
</Backdrop>
<Layers>
<Layer>
<Texture name="$parentTitleBorder" hidden="true" file="Interface\DialogFrame\UI-DialogBox-Header">
<Size>
<AbsDimension x="160" y="32" />
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="5" />
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.2" right="0.8" top="0" bottom="0.6" />
</Texture>
<FontString name="$parentTitleString" hidden="true" font="Fonts\FRIZQT__.TTF">
<Size>
<AbsDimension x="140" y="0" />
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="-4" />
</Offset>
</Anchor>
</Anchors>
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="1" g="0.8196079" b="0" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="$parentComboBox1">
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d50888b-59c2-4f83-ae10-27aaad48391b"><Property name="Items">&lt;?xml version="1.0"?&gt;
&lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;string&gt;Kill&lt;/string&gt;
&lt;string&gt;Sheep&lt;/string&gt;
&lt;string&gt;Sap&lt;/string&gt;
&lt;string&gt;Mind Control&lt;/string&gt;
&lt;/ArrayOfString&gt;</Property><Property name="OnSelectionChanged">&lt;?xml version="1.0"?&gt;
&lt;string /&gt;</Property></FrameSkin>-->
<Size>
<AbsDimension x="271" y="32" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="88" y="-22" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer>
<Texture name="$parentLeft" file="Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame">
<Size>
<AbsDimension x="25" y="64" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="17" />
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0" right="0.1953125" top="0" bottom="1" />
</Texture>
<Texture name="$parentMiddle" file="Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame">
<Size>
<AbsDimension x="221" y="64" />
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT" />
</Anchors>
<TexCoords left="0.1953125" right="0.8046875" top="0" bottom="1" />
</Texture>
<Texture name="$parentRight" file="Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame">
<Size>
<AbsDimension x="25" y="64" />
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentMiddle" relativePoint="RIGHT" />
</Anchors>
<TexCoords left="0.8046875" right="1" top="0" bottom="1" />
</Texture>
<FontString name="$parentText" font="Fonts\FRIZQT__.TTF" text="$parentComboBox1" justifyH="RIGHT">
<Size>
<AbsDimension x="246" y="10" />
</Size>
<Anchors>
<Anchor point="RIGHT" relativeTo="$parentRight">
<Offset>
<AbsDimension x="-43" y="2" />
</Offset>
</Anchor>
</Anchors>
<FontHeight>
<AbsValue val="10" />
</FontHeight>
<Color r="1" g="1" b="1" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</FontString>
</Layer>
</Layers>
<Frames>
<Button name="$parentButton">
<Size>
<AbsDimension x="24" y="24" />
</Size>
<Anchors>
<Anchor point="TOPRIGHT" relativeTo="$parentRight">
<Offset>
<AbsDimension x="-16" y="-18" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>
ToggleDropDownMenu();
PlaySound("igMainMenuOptionCheckBoxOn");
</OnClick>
</Scripts>
<NormalTexture name="$parentNormalTexture" file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Up">
<Size>
<AbsDimension x="24" y="24" />
</Size>
<Anchors>
<Anchor point="RIGHT" />
</Anchors>
</NormalTexture>
<PushedTexture name="$parentPushedTexture" file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Down">
<Size>
<AbsDimension x="24" y="24" />
</Size>
<Anchors>
<Anchor point="RIGHT" />
</Anchors>
</PushedTexture>
<DisabledTexture name="$parentDisabledTexture" file="Interface\ChatFrame\UI-ChatIcon-ScrollDown-Disabled">
<Size>
<AbsDimension x="24" y="24" />
</Size>
<Anchors>
<Anchor point="RIGHT" />
</Anchors>
</DisabledTexture>
<HighlightTexture name="$parentHighlightTexture" file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD">
<Size>
<AbsDimension x="24" y="24" />
</Size>
<Anchors>
<Anchor point="RIGHT" />
</Anchors>
</HighlightTexture>
</Button>
</Frames>
<Scripts>
<OnLoad>-- START AUTOGENERATED, DO NOT EDIT
local cb_init_fn = function()
local info
info = {}
info.text = "Kill"
info.func = function() UIDropDownMenu_SetSelectedID(RaidHelperFormComboBox1, this:GetID(), 0); end
UIDropDownMenu_AddButton(info);
info = {}
info.text = "Sheep"
info.func = function() UIDropDownMenu_SetSelectedID(RaidHelperFormComboBox1, this:GetID(), 0); end
UIDropDownMenu_AddButton(info);
info = {}
info.text = "Sap"
info.func = function() UIDropDownMenu_SetSelectedID(RaidHelperFormComboBox1, this:GetID(), 0); end
UIDropDownMenu_AddButton(info);
info = {}
info.text = "Mind Control"
info.func = function() UIDropDownMenu_SetSelectedID(RaidHelperFormComboBox1, this:GetID(), 0); end
UIDropDownMenu_AddButton(info);
end
UIDropDownMenu_Initialize(this, cb_init_fn)
-- END AUTOGENERATED
</OnLoad>
<OnHide>CloseDropDownMenus();</OnHide>
</Scripts>
</Button>
<Button name="$parentButton1" text="Raid Chat">
<!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4973-d66d-444e-bb2d-1ad102c87fed" />-->
<Size>
<AbsDimension x="118" y="24" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="23" y="-350" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>RaidHelperRaidChat();
</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-Panel-Button-Up">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</NormalTexture>
<PushedTexture file="Interface\Buttons\UI-Panel-Button-Down">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</PushedTexture>
<DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</DisabledTexture>
<HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</HighlightTexture>
<ButtonText name="$parentText">
<FontHeight>
<AbsValue val="10" />
</FontHeight>
</ButtonText>
<NormalFont inherits="GameFontNormal" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="1" g="0.8196079" b="0" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</NormalFont>
<HighlightFont inherits="GameFontHighlight" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="1" g="1" b="1" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</HighlightFont>
<DisabledFont inherits="GameFontDisable" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="0.4901961" g="0.4901961" b="0.4901961" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</DisabledFont>
<PushedTextOffset x="0" y="0" />
</Button>
<Frame name="$parentLabel1">
<!--<FrameSkin skinid="dcb143e1-a4ab-4e7c-b934-1efa40101d21" frameid="2d508885-59c2-4f83-ae10-27aaad48391b" />-->
<Size>
<AbsDimension x="55" y="27" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="20" y="-22" />
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer>
<FontString name="$parentLabel" font="Fonts\FRIZQT__.TTF" text="{skull}">
<Anchors>
<Anchor point="TOPLEFT" />
<Anchor point="BOTTOMRIGHT" />
</Anchors>
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="1" g="0.8196079" b="0" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</FontString>
</Layer>
</Layers>
</Frame>
<Button name="$parentComponent1" text="Raid Warning">
<!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4973-d66d-444e-bb2d-1ad102c87fed" />-->
<Size>
<AbsDimension x="118" y="24" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="147" y="-350" />
</Offset>
</Anchor>
</Anchors>
<NormalTexture file="Interface\Buttons\UI-Panel-Button-Up">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</NormalTexture>
<PushedTexture file="Interface\Buttons\UI-Panel-Button-Down">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</PushedTexture>
<DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</DisabledTexture>
<HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</HighlightTexture>
<ButtonText name="$parentText">
<FontHeight>
<AbsValue val="10" />
</FontHeight>
</ButtonText>
<NormalFont inherits="GameFontNormal" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="1" g="0.8196079" b="0" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</NormalFont>
<HighlightFont inherits="GameFontHighlight" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="1" g="1" b="1" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</HighlightFont>
<DisabledFont inherits="GameFontDisable" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="0.4901961" g="0.4901961" b="0.4901961" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</DisabledFont>
<PushedTextOffset x="0" y="0" />
</Button>
<Button name="$parentComponent2" text="Done">
<!--<FrameSkin skinid="f15d4970-d66d-444e-bb2d-1ad102c87fed" frameid="f15d4973-d66d-444e-bb2d-1ad102c87fed" />-->
<Size>
<AbsDimension x="89" y="24" />
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="271" y="-350" />
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnClick>RaidHelperForm:Hide();
</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-Panel-Button-Up">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</NormalTexture>
<PushedTexture file="Interface\Buttons\UI-Panel-Button-Down">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</PushedTexture>
<DisabledTexture file="Interface\Buttons\UI-Panel-Button-Disabled">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</DisabledTexture>
<HighlightTexture file="Interface\Buttons\UI-Panel-Button-Highlight" alphaMode="ADD">
<TexCoords left="0" right="0.625" top="0" bottom="0.6875" />
</HighlightTexture>
<ButtonText name="$parentText">
<FontHeight>
<AbsValue val="10" />
</FontHeight>
</ButtonText>
<NormalFont inherits="GameFontNormal" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="1" g="0.8196079" b="0" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</NormalFont>
<HighlightFont inherits="GameFontHighlight" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="1" g="1" b="1" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</HighlightFont>
<DisabledFont inherits="GameFontDisable" font="Fonts\FRIZQT__.TTF">
<FontHeight>
<AbsValue val="12" />
</FontHeight>
<Color r="0.4901961" g="0.4901961" b="0.4901961" />
<Shadow>
<Color r="0" g="0" b="0" />
<Offset>
<AbsDimension x="1" y="-1" />
</Offset>
</Shadow>
</DisabledFont>
<PushedTextOffset x="0" y="0" />
</Button>
</Frames>
<Scripts>
<OnLoad>this:RegisterEvent("VARIABLES_LOADED");</OnLoad>
<OnEvent>RaidHelper_OnLoad();</OnEvent>
</Scripts>
</Frame>
</Ui>
TOC
## Interface: 20400
## Title: RaidHelper
## Author: Glenn de Man
## Version: 0.0.1
## eMail: [email protected]
## DefaultState: Enabled
## LoadOnDemand: 0
RaidHelperForm.xml
RaidHelper.lua
  Reply With Quote
09-08-08, 01:58 PM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Thank you. But ... what a wall of text.

I am awfully sorry, but I can't help you with this.

I'm pretty sure that this is not the "help" you expected ... but I kindly suggest to learn at least the lua/xml/programming basics and to develop some simple addons without the ui designer.
  Reply With Quote
09-08-08, 02:20 PM   #5
-Glenn-
A Defias Bandit
Join Date: Sep 2008
Posts: 3
Originally Posted by Duugu View Post
Thank you. But ... what a wall of text.

I am awfully sorry, but I can't help you with this.

I'm pretty sure that this is not the "help" you expected ... but I kindly suggest to learn at least the lua/xml/programming basics and to develop some simple addons without the ui designer.
Yeah, I think you have a good point
  Reply With Quote
05-31-09, 06:46 PM   #6
Sythalin
Curse staff
 
Sythalin's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 680
If you aren't experienced in using LUA and XML from base, then it's a bad idea to use a designer. As you've discovered, if something goes wrong you'll have no idea how to fix it.

In the meantime, please repost your code above at pastey.net and link it. It'll be a lot easier for people to read and help troubleshoot.
  Reply With Quote
05-31-09, 07:55 PM   #7
Nirrudn
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 17
I think what you want to use is UIDropDownMenu_GetSelectedValue() or UIDropDownMenu_GetText().

Trouble is you need to supply them with your actual UIDropDownMenu object, which I can't locate in the XML you posted. I think it's RaidHelperFormButton as that has the ToggleDropDownMenu call and all the setup stuff.

i.e.

chattext = UIDropDownMenu_GetText(RaidHelperFormButton);
  Reply With Quote
06-04-09, 09:28 PM   #8
BlogApostille
A Kobold Labourer
Join Date: Jun 2009
Posts: 1
Cool Send selected option to chat

Do some of the chat rooms out there allow you to create a private room, i.e., one where you specify who can and can not come in? Which ones? What are the advantages/disadvantages to moving to a chat room site with the people we like here? Are there any sites similiar to Askville that allow you to select who you interact with and don't interact with? Tell me!!!! PLEASE!!
__________________
Blog Apostille
  Reply With Quote
06-05-09, 07:47 AM   #9
Bluspacecow
Giver of walls of text :)
 
Bluspacecow's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 770
Originally Posted by BlogApostille View Post
Do some of the chat rooms out there allow you to create a private room, i.e., one where you specify who can and can not come in? Which ones? What are the advantages/disadvantages to moving to a chat room site with the people we like here?
Their is an IRC they frequent.

irc.freenode.net

#wowuidev
#wowace
#curseforge

Both the wowuidev channel and the wowace channel are pretty good. Join both and post in one or both and you should get an answer pretty quickly

I can't connect from work as I suspect they block it
I can connect with mibbit but then I get d/ced a few minutes after connetiong (yes my nick is registered and all that)

http://www.mibbit.com/chat/

Is the site for mibbit
__________________
tuba_man on Apple test labs : "I imagine a brushed-aluminum room with a floor made of keyboards, each one plugged into a different test box somewhere. Someone is tasked with tossing a box full of cats (all wearing turtlenecks) into this room. If none of the systems catch fire within 30 minutes, testing is complete. Someone else must remove the cats. All have iPods." (http://community.livejournal.com/tec...t/2018070.html)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Send selected option to chat

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