• 0

    posted a message on Detecting if you are in a party
    The line: UnitIsFriend("target") is what caused the errors.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    My current .lua is on page 2, post #15.

    I can also use pastebin.com, something i grew fond of, especially since chrome has it built in it.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    Thank you all very much for helping me with all this. I know when people asked me a million questions about my script's/code's for the diablo 2 bot, i got aggravated very easily.

    Here's the .xml and i'm about to debug now.

    <Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/">
    	<Script file="EasyControl.lua" />
    	<Frame name="EasyControlMainFrame" parent="UIParent" toplevel="true" movable="true" enableMouse="true">
    		<Size>
    			<AbsDimension x="200" y="110" />
    		</Size>
    		<Anchors>
    			<Anchor point="CENTER">
    				<Offset x="-2" y="57" />
    			</Anchor>
    		</Anchors>
    		<TitleRegion setAllPoints="true">
    			<Size>
    				<AbsDimension x="0" y="30" />
    			</Size>
    			<Anchors>
    				<Anchor point="TOPLEFT" />
    				<Anchor point="TOPRIGHT" />
    			</Anchors>
    		</TitleRegion>
    		<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>
    			<Color r="2" g="0.4" b="0.1" />
    			<BorderColor r="1.5" g="0.2" b="0.4" />
    		</Backdrop>
    		
    <Frames>
    	<Button name="Leave_Party" inherits="UIPanelButtonTemplate" text="Leave Party">
    	<Size>
    		<AbsDimension x="77" y="16" />
    	</Size>
    		<Anchors>
    			<Anchor point="TOPLEFT">
    				<Offset x="12" y="-16" />
    			</Anchor>
    		</Anchors>
    	<Scripts>
    		<OnClick>Leave_Party_OnClick(self, button);</OnClick>
    	</Scripts>
    		<HighlightColor r="0.94" g="0.94" b="0.94" />
    		<DisabledColor r="0" g="0" b="0" />
    	</Button>
    </Frames>
    	
    <Frames>
    	<Button name="Invite_Target" inherits="UIPanelButtonTemplate" text="Party Invite">
    	<Size>
    		<AbsDimension x="86" y="16" />
    	</Size>
    		<Anchors>
    			<Anchor point="TOPRIGHT">
    				<Offset x="-14" y="-16" />
    			</Anchor>
    		</Anchors>
    	<Scripts>
    		<OnClick>Invite_Party_OnClick(self, button);</OnClick>
    	</Scripts>
    		<HighlightColor r="0.94" g="0.94" b="0.94" />
    		<DisabledColor r="0" g="0" b="0" />
    	</Button>
    </Frames>
    
    <Frames>
    	<Button name="Follow_Target" inherits="UIPanelButtonTemplate" text="Follow">
    	<Size>
    		<AbsDimension x="77" y="15" />
    	</Size>
    		<Anchors>
    			<Anchor point="TOPLEFT">
    				<Offset x="12" y="-40" />
    			</Anchor>
    		</Anchors>
    	<Scripts>
    		<OnClick>Follow_Target_OnClick(self, button);</OnClick>
    	</Scripts>
    		<HighlightColor r="0.94" g="0.94" b="0.94" />
    		<DisabledColor r="0" g="0" b="0" />
    	</Button>
    </Frames>
    
    <Frames>
    	<Button name="Grant_Level" inherits="UIPanelButtonTemplate" text="Grant Level">
    	<Size>
    		<AbsDimension x="77" y="15" />
    	</Size>
    		<Anchors>
    			<Anchor point="TOPLEFT">
    				<Offset x="12" y="-64" />
    			</Anchor>
    		</Anchors>
    	<Scripts>
    		<OnClick>Grant_Level_OnClick(self, button);</OnClick>
    	</Scripts>
    		<HighlightColor r="0.94" g="0.94" b="0.94" />
    		<DisabledColor r="0" g="0" b="0" />
    	</Button>
    </Frames>
    	
    <Frames>
    	<Button name="Invite_Guild" inherits="UIPanelButtonTemplate" text="Guild Invite">
    	<Size>
    		<AbsDimension x="86" y="16" />
    	</Size>
    		<Anchors>
    			<Anchor point="TOPRIGHT">
    				<Offset x="-14" y="-40" />
    			</Anchor>
    		</Anchors>
    	<Scripts>
    		<OnClick>Invite_Guild_OnClick(self, button);</OnClick>
    	</Scripts>
    		<HighlightColor r="0.94" g="0.94" b="0.94" />
    		<DisabledColor r="0" g="0" b="0" />
    	</Button>
    </Frames>
    
    
    
    		<Layers>
    			<Layer level="OVERLAY">
    				<FontString name="EasyControl" inherits="GameFontNormal" text="EC v1.0">
    					<Size>
    						<AbsDimension x="100" y="10" />
    					</Size>
    					<Anchors>
    						<Anchor point="TOPLEFT">
    							<Offset x="119" y="-90" />
    						</Anchor>
    					</Anchors>
    				</FontString>
    			</Layer>
    		</Layers>
    		<Scripts>
    			<OnLoad>EasyControlMainFrame_OnLoad(self);</OnLoad>
    			<OnEvent>EasyControlMainFrame_OnEvent(self, event, ...);</OnEvent>
    			<OnDragStart>self:StartMoving();</OnDragStart>
    			<OnDragStop>self:StopMovingOrSizing();</OnDragStop>
    		</Scripts>
    	</Frame>
    
    
    </Ui>
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    How I have it now doesn't cause lag and prints it doesn't have a target when it doesn't, and prints it can't do that action to the current target if the current target is an NPC or monster. But if you target a friend, player, and press any of the buttons besides leave party, it does nothing but do the 'lag' thing.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    I can't really quote right now since I'm doing this from my phone but...

    I need it to identify if it has a target, so that if it doesn't, then it will print "You have no target to --". I,m mainly doing this because if I did not the client would "pause" for a very breif moment whenever the player had no target and tried pressing one of the buttons.

    The party identifying I need for, if the player is not in a party print "You are not in a party" because if there was nothing for it to do, if the player was not in a party, that would also cause a client 'pause'.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    Hmm, but now it doesn't work.

    -- Author      : wwwDot
    -- Create Date : 11/14/2010 5:05:10 PM
    
    
    function EasyControlMainFrame_OnLoad(self)
    	self:RegisterEvent("PLAYER_REGEN_DISABLED")	
    	self:RegisterEvent("PLAYER_REGEN_ENABLED")
    end
    
    function EasyControlMainFrame_OnEvent(self, event)
    	if event == "PLAYER_REGEN_DISABLED" then
    		self:Hide()
    	else
    		self:Show()
    	end
    
    end
    
    function Leave_Party_OnClick()
    	local inParty = GetNumPartyMembers()
    	if inParty > 0 then
    		LeaveParty()
    		print("You have left the party")
    	else
    		print("You are not in a party")
    	end
    end
    
    function Invite_Guild_OnClick()
    	if UnitExists("target") then
    		if UnitIsPlayer("target") and UnitIsFriend("target") and not GetGuildInfo("target") then
    			GuildInvite(UnitName("target"))
    		--	print("You have invited " .. UnitName("target") .. " to your guild")
    		else
    			print("You cannot invite " .. UnitName("target") .. " to your guild")
    		end
    	else
    		print("You have no target to invite to your guild")
    	end
    end
    
    function Follow_Target_OnClick()
    	if UnitExists("target") then
    		if UnitIsPlayer("target") and UnitIsFriend("target") then
    			if CheckInteractDistance("target", 4) then
    			--	print("You are following " .. UnitName("target"))
    				FollowUnit(UnitName("target"))
    			else
    				print(UnitName("target") .. " is to far away")
    			end
    		else
    			print("You cannot follow " .. UnitName("target"))
    		end
    	else
    		print("You have no target to follow")
    	end
    end
    
    function Invite_Party_OnClick()
    	if UnitExists("target") then
    		if UnitIsPlayer("target") and UnitIsFriend("target") then
    			InviteUnit(UnitName("target"))
    		--	print("You have invited " .. UnitName("target") .. " to your party")
    		else
    			print("You cannot invite " .. UnitName("target") .. " to your party")
    		end
    	else
    		print("You have no target to invite to your party")
    	end
    end
    
    function Grant_Level_OnClick()
    	if UnitExists("target") then
    		if UnitIsPlayer("target") and UnitIsFriend("target") and canGrantLevel("target") then
    			GrantLevel(UnitName("target"))
    		--	print("You have granted a level to " .. UnitName("target"))
    		else
    			print("You cannot grant a level to " .. UnitName("target"))
    		end
    	else
    		print("You have no target to grant a level to")
    	end
    end


    It will print if no target, and will print if it cant do that action to the current target, but when there is a target it can complete an action on, it does nothing, but create a small 'lag' as if the frame rate dropped very low.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    Taking the time to look at closely made me notice i had unneeded lines in the code which was causing the UnitExists() function to not work.

    I used elseif ....... in a few places that only needed else.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    My last post was a reply to Ketho.

    Using your code 'snippet' is giving some issue's which i'm trying to fix before i ask for anymore help.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    It would make the game react as if you were running low FPS.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    So i tried:

    elseif UnitExists("target") ~= 1 then

    and

    local canHappen = UnitExists("target")
    ...
    ...
    ...
    elseif canHappen ~= 1 then

    and

    elseif UnitExists("target") = nil

    But none of them worked.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    if not UnitName("target")
    if not UnitName("unit")
    if UnitName("unit") = nil
    if UnitName("target") = nil

    All create a small lag. I'm stumped.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    ...... if UnitName("target") = nil then
    etc etc

    Should work right?

    /edit

    Nope, Just create's a half second lag. Back onto the thinking wagon.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    I went past that function so many times and never thought that would be what it was for lol, thanks.

    Also, i can't figure out how to tell if you have no target.... I could only find things that clear your target, but i need the AddOn to know if the target is clear or not.

    Thank in advance.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting if you are in a party
    I cannot figure this out. Is it even possible? How do you identify yourself?

    Can anyone help?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with my first
    I did delete them but never saved the xml so they really were never deleted.

    I have no framexml.log and no error's happened on a miss-click.

    They were there originally from when I first made it, didn't really know what I was doing, and I thought that was what I had to do.
    Posted in: Addon Ideas
  • To post a comment, please or register a new account.