Thread Tools Display Modes
08-06-10, 11:21 AM   #1
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Post Duel help

Getting ready to upload one of my new addons. but i cant work out this error

Code:
Interface\AddOns\Wult\Wult.lua:116: attempt to call global 'CancelDuel' (a boolean value)
Count: 1

Call Stack:
(tail call): ?
[C]: in function `CancelDuel'
Interface\AddOns\Wult\Wult.lua:116: in function <Interface\AddOns\Wult\Wult.lua:114>
Code:
if CancelDuel then
addon:RegisterEvent("DUEL_REQUESTED")

addon:SetScript("OnEvent", function(self, event, challenger)
	if (not IsControlKeyDown()) then
		CancelDuel();
		DEFAULT_CHAT_FRAME:AddMessage("Duel cancelled: "..challenger..". Press CTRL to allow the next request!",1,0.3,0.3);
		DoEmote("no",1);
     	end
   end)
end
any help would be great. thanks for your time
  Reply With Quote
08-06-10, 01:43 PM   #2
Tarumi
A Deviate Faerie Dragon
 
Tarumi's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 17
Where is CancelDuel initialized? Ie. where is it first called and set to something?
  Reply With Quote
08-06-10, 02:09 PM   #3
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Post

Originally Posted by Tarumi View Post
Where is CancelDuel initialized? Ie. where is it first called and set to something?
you mean

Code:
CancelDuel = true
that i have at the top of the code
  Reply With Quote
08-06-10, 02:19 PM   #4
Tarumi
A Deviate Faerie Dragon
 
Tarumi's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 17
While I'm not a complete expert I might suggest changing it so that you do not have a global variable named "CancelDuel" and a global function named "CancelDuel". I'm pretty sure that is causing your problems.

Try renaming the function to "CancelDuelFunc" or something and see if that helps.
  Reply With Quote
08-07-10, 03:30 PM   #5
ricks322
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 154
Originally Posted by Tarumi View Post
Where is CancelDuel initialized? Ie. where is it first called and set to something?
Isn't CancelDuel() a standard API call. Therefore it does/should not need to be initialized?

CancelDuel()
  Reply With Quote
08-07-10, 04:57 PM   #6
Guardix
A Cyclonian
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 42
A rename should do it, CancelDuel is overwritten from a function variable to a boolean variable.
__________________
  Reply With Quote
08-07-10, 05:55 PM   #7
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
"Always keep your namespace clear!"

In WoW-Lua, it is absolutely possible to "hook" an API-function, and basically this is, what you're doing.
__________________
  Reply With Quote
08-08-10, 06:17 AM   #8
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Post

Originally Posted by Mischback View Post
"Always keep your namespace clear!"

In WoW-Lua, it is absolutely possible to "hook" an API-function, and basically this is, what you're doing.
so like
if CancelDuelFunc then

so it dont effect or call the part of the code CancelDuel()

i have made the changes and i dont get any errors. but ive not been able to test it. as hard to find anyone who will duel me. to test it. i think addon builders should have a title hehe.
  Reply With Quote
08-08-10, 07:06 AM   #9
ricks322
A Chromatic Dragonspawn
AddOn Author - Click to view addons
Join Date: Jun 2009
Posts: 154
If your aliance just go to GoldShire. I havent been on a server yet, that evertime I'm there I get 10 or more duel requests, (even as a lvl 6, vs lvl 80)
  Reply With Quote
08-08-10, 08:05 AM   #10
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Thumbs up

Originally Posted by ricks322 View Post
If your aliance just go to GoldShire. I havent been on a server yet, that evertime I'm there I get 10 or more duel requests, (even as a lvl 6, vs lvl 80)
that worked a treat. lol that is so funny. its one for the books.

script code working good. thanks so much for all your time and help.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Duel help


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