Quantcast Help with assigning Alias to a Button (possible?) - LoTROInterface
lotrointerface.com
Search Downloads


Go Back   LoTROInterface > LotRO > Developer Discussions > Lua Programming Help (L)

Reply
Thread Tools Display Modes
  #1  
Unread 09-08-2012, 11:21 AM
Radicus's Avatar
Radicus Radicus is online now
The Undefeated
Interface Author - Click to view interfaces
 
Join Date: Aug 2012
Posts: 5
Help with assigning Alias to a Button (possible?)

Just wondering it's possible to add an alias to a button rather than a quickslot, or somehow tie the two together?

I'm trying to code a button to send an emote when pressed. I've had a look at the coding for ChatEdit by Galuhad, but can't decipher is coding easily. I've noticed when you create some text it updates the button so that when you hover the mouse over the button, it displays what the alias is and sends it to the chat channel when clicked.

Can someone offer an alternative piece of code to achieve this? Here's my effort so far.

eg.
Code:
-- Create Emote Button
myWindow.EmoteButton=Turbine.UI.Lotro.Button();
myWindow.EmoteButton:SetParent(myWindow);
myWindow.EmoteButton:SetSize(190,30);
myWindow.EmoteButton:SetPosition(myWindow:GetWidth()/4+30,265)
myWindow.EmoteButton:SetText("Send Emote");

-- The next line doesn't work, but I was hoping it would:
-- myWindow.EmoteButton:SetShortcut(Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Alias, "/flirt"));

-- When Clicked
-- This creates a quickslot button that works, but would like to bind the alias to the button above instead.
myWindow.EmoteButton.MouseClick=function()
  qsButton = Turbine.UI.Lotro.Quickslot();
  qsButton:SetParent(myWindow);
  qsButton:SetShortcut(Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Alias, "/flirt"));
  qsButton:SetVisible(true);
end
Any help appreciated.
__________________
Radicus Hood - Protectors of Middle Earth, Riddermark

http://www.anotherworld.com.au/lotro...0Signature.jpg
Reply With Quote
  #2  
Unread 09-08-2012, 01:00 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 270
There is an example of masking a quickslot behind another control to simulate a quickslot button in the Writing LotRO Plugins for Noobs thread:
http://forums.lotro.com/showthread.p...91#post5824491
The third button example is the quickslot. You can also find similar code in the MoorMap main.lua file to implement the Quick Annotation tool as well as in many other plugins, Plugin Compendium which uses quickslots behind labels to send text to chat comes to mind. I'm sure there are many other examples.

It's usually overkill to put an actual Button in front of the quickslot since you need to use SetMouseVisible(false) on the masking object so that mouse events go through to the quickslot. However, I can think of at least one case where I have put a real button in front and by controlling its mouse visibility was able to implement some neat functionality. Typically though, you would either use a Control object and just set a background image to make it look like a button or use a Label object if you want text.

Here's some additional comments I recently sent to another user regarding using quickslots masked behind other controls:
Quote:
Now, as to hiding a quickslot behind another control, there are a few tricks:
First, you need to size the quickslot 34 pixels wider and higher than the control it will be behind and then position it 34 pixels to the left and above. This will prevent the "/A" icon in the quickslot from displaying through the control in front of it.
Second, you need to prevent the user's ability to drag and drop. You partially took care of this with the "tmpControl:SetAllowDrop(false);" line, but that doesn't prevent the user from accidentally dragging your alias OUT of the control. To prevent that, you need to save the correct alias text in a property of the control and then set the "tmpControl.DragDrop" function to restore the correct alias, effectively preventing it from being dragged out.
Third, you need to make the control in front of the quickslot ignore mouse events using the SetMouseVisible(false) method.
Fourth, there is (or was, I haven't checked lately) a bug in the constructor of quickslot shortcuts which would fail to process special characters (non-ASCII) correctly. For this reason, you should always create shortcuts with an empty string and then assign the text using the SetData() method.
Basically, your sample would become:
Code:
-- Create Emote Button
myWindow.EmoteButton=Turbine.UI.Label();
myWindow.EmoteButton:SetParent(myWindow);
myWindow.EmoteButton:SetSize(190,30);
myWindow.EmoteButton:SetPosition(myWindow:GetWidth()/4+30,265)
myWindow.EmoteButton:SetText("Send Emote");
myWindow.EmoteButton:SetBackColor(Turbine.UI.Color(0,0,0)); -- needed to prevent the quickslot icon boundary from displaying
myWindow.EmoteButton:SetMouseVisible(false);

myWindow.EmoteQSBack=Turbine.UI.Control(); -- used to prevent the quickslot from drawing outside the mask bounds
myWindow.EmoteQSBack:SetParent(myWindow);
myWindow.EmoteQSBack:SetSize(myWindow.EmoteButton:GetWidth(),myWindow.EmoteButton:GetHeight())
myWindow.EmoteQSBack:SetPosition(myWindow.EmoteButton:GetLeft(),myWindow.EmoteButton:GetTop())
myWindow.EmoteQSBack:SetZOrder(-1);
myWindow.EmoteQS = Turbine.UI.Lotro.Quickslot();
myWindow.EmoteQS:SetParent(myWindow.EmoteQSBack);
myWindow.EmoteQS:SetShortcut(Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Alias, "/flirt"));
 -- note, if there is any chance that the alias could contain a special (non-ASCII) character then you should use the SetData method to assign it to avoid a bug in the Shortcut constructor
myWindow.EmoteQS:SetSize(myWindow.EmoteButton:GetWidth()+34,myWindow.EmoteButton:GetHeight()+34)
myWindow.EmoteQS:SetPosition(-34,-34);
myWindow.EmoteQS.AliasText="/flirt";
myWindow.EmoteQS:SetAllowDrop(false);
myWindow.EmoteQS.DragDrop=function(sender)
     local sc=Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Alias,"");
     sc:SetData("/flirt");
     sender:SetShortcut(sc);
end

Last edited by Garan : 09-08-2012 at 01:32 PM.
Reply With Quote
  #3  
Unread 09-12-2012, 01:27 PM
Galuhad's Avatar
Galuhad Galuhad is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Dec 2010
Location: Norwich, UK
Posts: 20
I'd be the first to admit that I am not the best coder, so apologies if you are having a hard time understanding my code (I suffer the same problem when I leave a project and return to it at a later stage). What Garan said is correct and is basically what I did it ChatEdit, and pretty much every other plugin that sends something to the chat window. Unfortunately the API does not allow you to send messages through any hard code, the only loop hole we can manage is by masking the alias in a quickslot behind another control. That way we are not sending the message per se, the user is instead clicking a quickslot with the alias loaded into it. Hopefully Turbine will be more trusting one day and give us better functionality.
__________________
Galuhad, Guardians of the Light, Evernight (formally of Eldar RIP)
---
Reply With Quote
  #4  
Unread 09-18-2012, 11:22 AM
Radicus's Avatar
Radicus Radicus is online now
The Undefeated
Interface Author - Click to view interfaces
 
Join Date: Aug 2012
Posts: 5
Ok, I've used your suggestion to create the following script and it's not working quite right. What I am attempting to do is to create a single button that cycles through a number of emotes and to send that emote each time the button is displayed.

The script is cycling through the various aliases, but does not send the emote on each keypress of the button. It will do something weird however when you untick one of the emotes, it will get stuck on the emote preceeding the unticked emote and send that one sucessfully... can you spot what I am doing wrong please? Why is getting stuck when the IF/THEN/END statement should skip to the next statement and it's sending it only then? Does it have something to do with the RETURN in that IF/THEN statement? Is it possible to return out of the function successfully each on each keypress? It has me stumped!

Code:
-- Set SocialGuy Window Positions

local Settings = Turbine.PluginData.Load(Turbine.DataScope.Character, "SocialGuySettings");
local WindX,WindY=Turbine.UI.Display:GetWidth()/2-100,Turbine.UI.Display:GetHeight()/2-100;
if Settings~=nil then
  if Settings["WindPosX"]~=nil then WindX=Settings["WindPosX"] end
  if Settings["WindPosY"]~=nil then WindY=Settings["WindPosY"] end
end

-- Create Window
wSocialGuy = Turbine.UI.Lotro.Window();
wSocialGuy:SetSize(500,300);
wSocialGuy:SetPosition(WindX,WindY);
wSocialGuy:SetText("SocialGuy by Radicus");
-- if Settings["WindState"] == true then wSocialGuy:SetVisible(true) end

-- Create Heading Label
xpos = 25;
ypos = 35;
yinc = 25;
label = "Emotes"; 
labelEmotes = Turbine.UI.Label();
labelEmotes:SetParent(wSocialGuy);
labelEmotes:SetText(label);	
labelEmotes:SetPosition(wSocialGuy:GetWidth()/4,ypos)
labelEmotes:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
labelEmotes:SetForeColor(Turbine.UI.Color(1,1,0));
labelEmotes:SetSize(wSocialGuy:GetWidth()/2,20);
labelEmotes:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter);

-- Create Checkboxes
ypos=ypos+yinc;
checkboxHug = Turbine.UI.Lotro.CheckBox();
checkboxHug:SetPosition(xpos,ypos);
checkboxHug:SetCheckAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
checkboxHug:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
checkboxHug:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
checkboxHug:SetForeColor(Turbine.UI.Color(1,1,0));
checkboxHug:SetText(" /hug - The Adorable");
checkboxHug:SetParent(wSocialGuy);
checkboxHug:SetSize(180,20);
checkboxHug:SetChecked(true);

ypos=ypos+yinc;
checkboxHail = Turbine.UI.Lotro.CheckBox();
checkboxHail:SetPosition(xpos,ypos);
checkboxHail:SetCheckAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
checkboxHail:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
checkboxHail:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
checkboxHail:SetForeColor(Turbine.UI.Color(1,1,0));
checkboxHail:SetText(" /hail");
checkboxHail:SetParent(wSocialGuy);
checkboxHail:SetSize(180,20);
checkboxHail:SetChecked(true);

ypos=ypos+yinc;
checkboxConfused = Turbine.UI.Lotro.CheckBox();
checkboxConfused:SetPosition(xpos,ypos);
checkboxConfused:SetCheckAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
checkboxConfused:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
checkboxConfused:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
checkboxConfused:SetForeColor(Turbine.UI.Color(1,1,0));
checkboxConfused:SetText(" /confused");
checkboxConfused:SetParent(wSocialGuy);
checkboxConfused:SetSize(180,20);
checkboxConfused:SetChecked(true);

ypos=ypos+yinc;
checkboxKiss = Turbine.UI.Lotro.CheckBox();
checkboxKiss:SetPosition(xpos,ypos);
checkboxKiss:SetCheckAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
checkboxKiss:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
checkboxKiss:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
checkboxKiss:SetForeColor(Turbine.UI.Color(1,1,0));
checkboxKiss:SetText(" /kiss");
checkboxKiss:SetParent(wSocialGuy);
checkboxKiss:SetSize(180,20);
checkboxKiss:SetChecked(true);

-- Create Send Emote Button
ypos=ypos+yinc;
wSocialGuy.GoButton=Turbine.UI.Label();
wSocialGuy.GoButton:SetParent(wSocialGuy);
wSocialGuy.GoButton:SetSize(50,15);
wSocialGuy.GoButton:SetPosition(wSocialGuy:GetWidth()/4,ypos)
wSocialGuy.GoButton:SetText("Be Sociable");
wSocialGuy.GoButton:SetBackColor(Turbine.UI.Color(.3,.3,.3)); -- needed to prevent the quickslot icon boundary from displaying
wSocialGuy.GoButton:SetMouseVisible(false);

currentEmote="/hug"; -- sets the starting emote
nextEmote=currentEmote;

wSocialGuy.EmoteQSBack=Turbine.UI.Control(); -- used to prevent the quickslot from drawing outside the mask bounds
wSocialGuy.EmoteQSBack:SetParent(wSocialGuy);
wSocialGuy.EmoteQSBack:SetSize(wSocialGuy.GoButton:GetWidth(),wSocialGuy.GoButton:GetHeight())
wSocialGuy.EmoteQSBack:SetPosition(wSocialGuy.GoButton:GetLeft(),wSocialGuy.GoButton:GetTop())
wSocialGuy.EmoteQSBack:SetZOrder(-1);
wSocialGuy.EmoteQS = Turbine.UI.Lotro.Quickslot();
wSocialGuy.EmoteQS:SetParent(wSocialGuy.EmoteQSBack);
 -- note, if there is any chance that the alias could contain a special (non-ASCII) character then you should use the SetData method to assign it to avoid a bug in the Shortcut constructor
wSocialGuy.EmoteQS:SetSize(wSocialGuy.GoButton:GetWidth()+34,wSocialGuy.GoButton:GetHeight()+34)
wSocialGuy.EmoteQS:SetPosition(-34,-34);
wSocialGuy.EmoteQS:SetAllowDrop(false);

wSocialGuy.EmoteQS.DragDrop=function(sender)
	local sc=Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Alias,"");
	sc:SetData(currentEmote);
	sender:SetShortcut(sc);
	Turbine.Shell.WriteLine(sc);
end

function SetEmote(e)
	wSocialGuy.EmoteQS:SetShortcut(Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Alias, e));
	wSocialGuy.EmoteQS.AliasText=e;
	currentEmote=e;
end

wSocialGuy.EmoteQS.MouseClick=function()
	if checkboxHug:IsChecked() == true and nextEmote == "/hug" then
		SetEmote(nextEmote);
		nextEmote="/hail";
		return;
	end
	if checkboxHail:IsChecked() == true and nextEmote == "/hail" then
		SetEmote("/hail");
		nextEmote="/confused";
		return;
	end
	if checkboxConfused:IsChecked() == true and nextEmote == "/confused" then
		SetEmote("/confused");
		nextEmote="/kiss";
		return;
	end
	if checkboxKiss:IsChecked() == true and nextEmote == "/kiss" then
		SetEmote("/kiss");
		nextEmote="/hug";
		return;
	end
end
__________________
Radicus Hood - Protectors of Middle Earth, Riddermark

http://www.anotherworld.com.au/lotro...0Signature.jpg
Reply With Quote
  #5  
Unread 09-18-2012, 01:15 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 270
First off, at a glance, you have a serious logic flaw in your if-then clauses. For instance, if you click the EmoteQS control while the nextEmote="/hug" but checkboxHug is not checked, then the emote will never change to another emote, it will simply get stuck since none of your conditions apply. I am assuming you simply want it to cycle through emotes but only performing the ones that are checked. If that is the case, then your if-then cases should fall through to the next available case when a checkbox is not selected so, in the example above where the next emote would be /hug but the hug checkbox is not checked, it should change the nextEmote to "/hail" so that when it falls through it will be testing against the next possible option. This assumes you only want a single, non-cyclic pass through the emotes.

If you want the flow to be cyclic (if you want it to cycle back to the first emote if all of the checkboxes following the next emote are unchecked) you have a second flaw. If you want it to cycle then your mechanism needs to be reworked so that you can know which was the initial emote tested (to avoid an endless loop) and it needs to be tested in a while loop or similar structure that will allow you to cycle back through the first elements until a checked option is true or you reach the starting point in which case you would simply stop and clear the emote text since no emotes would be checked.

Note, there is also an oddity with the MouseClick event handler for quickslots - if you assign a handler and left click the action is suppressed but the handler fires. If you right click, both the action and the handler fire.

Something along the lines of the following should work although I would have probably designed it slightly differently by making the checkboxes a table of controls which would have been used in place of the "emotes" table below
Code:
wSocialGuy.EmoteQS.MouseClick=function()
 local emotes={{"/hug",checkboxHug},{"/hail",checkboxHail},{"/confused",checkboxConfused},{"/kiss",checkboxKiss}}
 local index;
 local startIndex=0;
 for k,v in ipairs(emotes) do
  if v[1]==nextEmote then
   startIndex=k;
   break;
  end
 end
 if startIndex~=0 then
  index=startIndex;
  local done=false
  while not done do
   if emotes[index][2]:IsChecked() then
    SetEmote(emotes[index][1]);
    done=true
   end
   index=index+1
   if index>#emotes then index=1 end
   if index==startIndex then done=true end
   if done then
    nextEmote=emotes[index][1]
   end
  end
 end
end

Last edited by Garan : 09-18-2012 at 02:04 PM.
Reply With Quote
  #6  
Unread 09-18-2012, 02:42 PM
Galuhad's Avatar
Galuhad Galuhad is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Dec 2010
Location: Norwich, UK
Posts: 20
Try this:

Code:
-- Set SocialGuy Window Positions
--local Settings = Turbine.PluginData.Load(Turbine.DataScope.Character, "SocialGuySettings");
local WindX,WindY=Turbine.UI.Display:GetWidth()/2-100,Turbine.UI.Display:GetHeight()/2-100;
--~ if Settings~=nil then
--~   if Settings["WindPosX"]~=nil then WindX=Settings["WindPosX"] end
--~   if Settings["WindPosY"]~=nil then WindY=Settings["WindPosY"] end
--~ end

-- Create Window
wSocialGuy = Turbine.UI.Lotro.Window();
wSocialGuy:SetSize(500,300);
wSocialGuy:SetPosition(WindX,WindY);
wSocialGuy:SetText("SocialGuy by Radicus");
wSocialGuy:SetVisible(true);
-- if Settings["WindState"] == true then wSocialGuy:SetVisible(true) end

-- Create Heading Label
xpos = 25;
ypos = 35;
yinc = 25;
label = "Emotes";
labelEmotes = Turbine.UI.Label();
labelEmotes:SetParent(wSocialGuy);
labelEmotes:SetText(label);
labelEmotes:SetPosition(wSocialGuy:GetWidth()/4,ypos)
labelEmotes:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
labelEmotes:SetForeColor(Turbine.UI.Color(1,1,0));
labelEmotes:SetSize(wSocialGuy:GetWidth()/2,20);
labelEmotes:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleCenter);

-- Create Checkboxes
-- Changed this to a table, if you wish to add more emotes in the future then you actually don't need to write any extra code
-- except to add the emotes to the _EMOTES table below - as the checkboxes are created based on these entries.
_EMOTES = {"/hug", "/hail", "/confused","/kiss"};
checkbox = {};

for k,v in pairs (_EMOTES) do

	ypos=ypos+yinc;


	checkbox[k] = Turbine.UI.Lotro.CheckBox();
	checkbox[k]:SetPosition(xpos,ypos);
	checkbox[k]:SetCheckAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
	checkbox[k]:SetTextAlignment(Turbine.UI.ContentAlignment.MiddleLeft);
	checkbox[k]:SetFont(Turbine.UI.Lotro.Font.TrajanPro14);
	checkbox[k]:SetForeColor(Turbine.UI.Color(1,1,0));
	checkbox[k]:SetText(" " .. v);
	checkbox[k]:SetParent(wSocialGuy);
	checkbox[k]:SetSize(180,20);
	checkbox[k]:SetChecked(true);

end


-- Create Send Emote Button
ypos=ypos+yinc;
wSocialGuy.GoButton=Turbine.UI.Label();
wSocialGuy.GoButton:SetParent(wSocialGuy);
wSocialGuy.GoButton:SetSize(50,15);
wSocialGuy.GoButton:SetPosition(wSocialGuy:GetWidth()/4,ypos)
wSocialGuy.GoButton:SetText("Be Sociable");
wSocialGuy.GoButton:SetBackColor(Turbine.UI.Color(.3,.3,.3)); -- needed to prevent the quickslot icon boundary from displaying
wSocialGuy.GoButton:SetMouseVisible(false);

currentEmote=_EMOTES[1]; -- sets the starting emote

wSocialGuy.EmoteQSBack=Turbine.UI.Control(); -- used to prevent the quickslot from drawing outside the mask bounds
wSocialGuy.EmoteQSBack:SetParent(wSocialGuy);
wSocialGuy.EmoteQSBack:SetSize(wSocialGuy.GoButton:GetWidth(),wSocialGuy.GoButton:GetHeight())
wSocialGuy.EmoteQSBack:SetPosition(wSocialGuy.GoButton:GetLeft(),wSocialGuy.GoButton:GetTop())
wSocialGuy.EmoteQSBack:SetZOrder(-1);

wSocialGuy.EmoteQS = Turbine.UI.Lotro.Quickslot();
wSocialGuy.EmoteQS:SetParent(wSocialGuy.EmoteQSBack);
 -- note, if there is any chance that the alias could contain a special (non-ASCII) character then you should use the SetData method to assign it to avoid a bug in the Shortcut constructor
wSocialGuy.EmoteQS:SetSize(wSocialGuy.GoButton:GetWidth()+34,wSocialGuy.GoButton:GetHeight()+34)
wSocialGuy.EmoteQS:SetPosition(-34,-34);
wSocialGuy.EmoteQS:SetAllowDrop(false);

wSocialGuy.EmoteQS.DragDrop=function(sender)
	local sc=Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Alias,"");
	sc:SetData(currentEmote);
	sender:SetShortcut(sc);
	Turbine.Shell.WriteLine(sc);
end

function SetEmote(e)
	wSocialGuy.EmoteQS:SetShortcut(Turbine.UI.Lotro.Shortcut(Turbine.UI.Lotro.ShortcutType.Alias, e));
	wSocialGuy.EmoteQS.AliasText=e;
end


-- Emote doesn't send until after the mouse events have completed, meaning if you change the alias mid-event it won't work.
-- Instead we can get around this by using the Update() function of the control.

wSocialGuy.EmoteQS.MouseClick=function(sender,args)

	wSocialGuy.EmoteQS:SetWantsUpdates(true);

end

wSocialGuy.EmoteQS.Update=function(sender,args)

	sender:SetWantsUpdates(false); -- Reset to false otherwise it will loop forever.
	SetEmote(currentEmote);
	currentEmote = FindNextChecked(currentEmote);

end


-- This function will loop through the emotes and checklist tables to get the next emote command
-- which can then be set using SetEmote()
function FindNextChecked(CURRENTEMOTE)

	if CURRENTEMOTE == nil then return _EMOTES[1] end;

	local NEXTEMOTE = CURRENTEMOTE; -- default incase of some error (perhaps the user unticked all boxes).

	-- Check to see if the checkboxes are all unchecked (in which case we can't get the next emote);
	if AllUnchecked() == true then

		Turbine.Shell.WriteLine("You must select at least one emote");

	else

		local CURRENTEMOTEID = 1;
		local MAXEMOTES = 0;

		-- This gets the ID for the current emote in the table
		for k,v in pairs (_EMOTES) do

			if v == CURRENTEMOTE then CURRENTEMOTEID = k + 1 end;
			MAXEMOTES = MAXEMOTES + 1;

		end

		-- If the emote is the last in the list then go back to the beginning to start checking from there.
		if CURRENTEMOTEID > MAXEMOTES then CURRENTEMOTEID = 1 end;

		-- Loop through the checkbox table to find the next checked box.
		local loopThreshhold = 50; -- This is more a safety net incase some error in the code causes an infinity loop.
		local curLoop = 1;
		local blFOUNDCHECKBOX = false;

		while blFOUNDCHECKBOX == false and curLoop < loopThreshhold do

			if checkbox[CURRENTEMOTEID]:IsChecked() == true then

				NEXTEMOTE = _EMOTES[CURRENTEMOTEID];
				blFOUNDCHECKBOX = true;
				break;

			else

				if CURRENTEMOTEID >= MAXEMOTES then -- Either add 1 to CURRENTEMOTEID or reset to 1.
					CURRENTEMOTEID = 1;
				else
					CURRENTEMOTEID = CURRENTEMOTEID + 1;
				end

			end

			curLoop = curLoop + 1; -- Safety net counter.

		end

	end

	return NEXTEMOTE;

end



function AllUnchecked()

	-- This checks each checkbox to see if they are all unchecked, if it finds one that is checked then it returns false.
	-- If it doesn't find any checked, then it returns the default value of true.

	local blALLUNCHECKED = true;

	for k,v in pairs (checkbox) do

		if checkbox[k]:IsChecked() == true then
			blALLUNCHECKED = false;
			break;
		end

	end

	return blALLUNCHECKED;

end
If you unchecked a box which was set to nextemote, the plugin would never have found it. A better option is to construct the checkboxes as a table which means you can easily loop through them to see which are checked and which aren't.

In the code above this is how I've done it. I also put your emotes into a table which will make it easier for you if you want to expand the plugin in future with more emotes as you will not need to change any of the code except the table entries.

Also another bug I found was that the emotes wouldn't fire because the alias is changed mid-event during the mouseclick. If you unticked all but one emote it would then work as the alias would not be changing. To get around this I put the setEmote call in the quickslot control's Update() function and used the mouseclick event to SetWantsUpdates() to true.

I've tested this ingame and found it to work efficiently.
__________________
Galuhad, Guardians of the Light, Evernight (formally of Eldar RIP)
---
Reply With Quote
  #7  
Unread 09-19-2012, 08:11 PM
Radicus's Avatar
Radicus Radicus is online now
The Undefeated
Interface Author - Click to view interfaces
 
Join Date: Aug 2012
Posts: 5
Thanks guys, appreciate the input! Keep a look out for the release version that I'll be posting shortly.
__________________
Radicus Hood - Protectors of Middle Earth, Riddermark

http://www.anotherworld.com.au/lotro...0Signature.jpg
Reply With Quote
  #8  
Unread 10-10-2013, 09:46 PM
zetasj55 zetasj55 is offline
The Wary
 
Join Date: Oct 2013
Posts: 1
Unfortunately the API does not allow you to send messages through any hard code, the only loop hole we can manage is by masking the alias in a quickslot behind another control. That way we are not sending the message per se, the user is instead clicking a quickslot with the alias loaded into it. Hopefully Turbine will be more trusting one day and give us better functionality.
Reply With Quote
Reply


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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i get a Button working? Haupthir Lua Programming Help (L) 2 11-14-2011 01:21 PM
pressed button and mouse over button problem Marzio XML modification help (L) 3 09-24-2011 07:03 PM
Alias editor Tyrolit Interface Requests (L) 2 06-20-2011 12:44 PM
Need help reskinning mount button..... Thayilis Interface Help (L) 3 10-24-2010 07:35 PM
Attack Button Kailvine LotRO Wish List (L) 2 09-05-2007 07:56 PM


All times are GMT -5. The time now is 08:12 AM.


Our Network
EQInterface | EQ2Interface | Minion | WoWInterface | ESOUI | LoTROInterface | MMOUI | Swtorui