Quantcast How can i make this load with the game? - WoWInterface
Thread Tools Display Modes
05-09-08, 03:41 PM   #1
Vayder
A Fallenroot Satyr
 
Vayder's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jun 2005
Posts: 23
How can i make this load with the game?

i would like to make this load automatically with the game

/script MainMenuBarLeftEndCap:Hide() MainMenuBarRightEndCap:Hide()
  Reply With Quote
05-09-08, 04:17 PM   #2
Sepioth
A Molten Giant
AddOn Author - Click to view addons
Join Date: Apr 2005
Posts: 894
There is an addon over at WoWAce to do this...

Alar Art Remover
  Reply With Quote
05-09-08, 05:47 PM   #3
Everglow
An Aku'mai Servant
 
Everglow's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 36
Originally Posted by Vayder View Post
i would like to make this load automatically with the game

/script MainMenuBarLeftEndCap:Hide() MainMenuBarRightEndCap:Hide()
All you have to do is find a mod that you already have that registers the "PLAYER_ENTERING_WORLD" event. just add your command to the part of the adoon's OnEvent function that handles that event (remove the "/script" from the front)
__________________
Everglow - Sisters of Elune/US
  Reply With Quote
05-09-08, 08:09 PM   #4
Vayder
A Fallenroot Satyr
 
Vayder's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jun 2005
Posts: 23
Ok, I am not a coder so this might look/sound funny to some of you. but after some reading ive come up with this

function grifremove:PLAYER_ENTERING_WORLD()
MainMenuBarLeftEndCap:Hide() MainMenuBarRightEndCap:Hide()
end

but it doesnt work. basically i have just this line in a lua file in a folder in my addons. it shows the addon in my list but when i login it doesnt remove the gryphons. i really wanna make this work as opposed to downloading another mod for this one simple function. any help is greatly appericiated.
  Reply With Quote
05-09-08, 09:14 PM   #5
rodrick
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 34
you will need to add the line you used in a macro (minus the /script part. Ie. MainMenuBarLeftEndCap:Hide() MainMenuBarRightEndCap:Hide()) to an addon already registered for the event, a new addon, or register the addon you added the lines to for the event yourself.
  Reply With Quote
05-09-08, 10:20 PM   #6
Vayder
A Fallenroot Satyr
 
Vayder's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jun 2005
Posts: 23
Originally Posted by rodrick View Post
you will need to add the line you used in a macro (minus the /script part. Ie. MainMenuBarLeftEndCap:Hide() MainMenuBarRightEndCap:Hide()) to an addon already registered for the event, a new addon, or register the addon you added the lines to for the event yourself.
ok this is where i get confused. how do i register an event in an addon? im assuming i need to register PLAYER_ENTERING_WORLD for this to work?
  Reply With Quote
05-09-08, 10:32 PM   #7
frogofdoom
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Oct 2005
Posts: 31
Basically, in a function that runs when a mod loads (e.g. the OnLoad for a frame), that's where you register events. The format for doing that is just to add this line into an OnLoad function:

if you're doing it in a specific frame's OnLoad:
Code:
this:RegisterEvent("EVENT_NAME");
otherwise,
Code:
framename:RegisterEvent("EVENT_NAME");
So what people are suggesting here, is to find another mod that has already registered the PLAYER_ENTERING_WORLD event, and then add your code into the event handler under PLAYER_ENTERING_WORLD. So essentially, what you'd be doing, is piggy-backing on another mod's already registered events and sticking your code into its event handler.

Now, if I were to create your code as a standalone mod, I would do it like this:

Assume that I've created a frame named Frame. I would set this function to its OnLoad
Code:
function Frame_OnLoad()
 this:RegisterEvent("PLAYER_ENTERING_WORLD");
end
... And I would set this function to its OnEvent
Code:
function Frame_OnEvent(event)
 if (event == "PLAYER_ENTERING_WORLD") then
  MainMenuBarLeftEndCap:Hide()
  MainMenuBarRightEndCap:Hide()
 end
end
The simplest way to do this, as people have said, is just to insert this code into another mod that's already been created. Using that method, all you have to do to make this code load when the game loads, is to go into any mod's lua code, check to see if it has registered the PLAYER_ENTERING_WORLD event, and then insert your code into the event handler under the PLAYER_ENTERING_WORLD conditional.

Anyway, hope that helps you understand a bit better.

Last edited by frogofdoom : 05-09-08 at 10:37 PM.
  Reply With Quote
05-09-08, 10:47 PM   #8
Vayder
A Fallenroot Satyr
 
Vayder's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jun 2005
Posts: 23
thanks i think i might have it figured out now

Last edited by Vayder : 05-09-08 at 10:52 PM.
  Reply With Quote
05-09-08, 11:14 PM   #9
Vayder
A Fallenroot Satyr
 
Vayder's Avatar
AddOn Compiler - Click to view compilations
Join Date: Jun 2005
Posts: 23
ok. this is what i have. from what ive read/seen in other mods i personally think this should work. but alas it is not.

Code:
grifremove = CreateFrame("Frame")

function grifremove:Frame_OnLoad()
 this:RegisterEvent("PLAYER_ENTERING_WORLD");
end

function grifremove:Frame_OnEvent(event)
if (event == "PLAYER_ENTERING_WORLD") then
        MainMenuBarLeftEndCap:Hide() 
        MainMenuBarRightEndCap:Hide()
end
end
i would really like to create a stand alone addon for this rather then piggy backing it into someone elses mod.
what am i doing wrong?
  Reply With Quote
05-10-08, 02:52 AM   #10
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Are you sure you need an event to do it, I'm pretty sure you could just do.

Code:
        MainMenuBarLeftEndCap:Hide() 
        MainMenuBarRightEndCap:Hide()
as all Blizzard code is executed before addons (unless it's LOD).

and heres an example of a super simple event handler:

Code:
local function OnEvent(f, event, args)
   if event == <Event 1> then
      --Do stuff
   elseif event == <Event 2> then
      --Do other stuff
   end
end

local f = CreateFrame("Frame")
f:RegisterEvent(<Event 1>)
f:RegisterEvent(<Event 2>)
f:SetScript("OnEvent", OnEvent)

Last edited by Slakah : 05-10-08 at 02:56 AM.
  Reply With Quote
05-10-08, 02:59 AM   #11
ra1d3n
A Cyclonian
 
ra1d3n's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 44
Originally Posted by Slakah View Post
Are you sure you need an event to do it, I'm pretty sure you could just do.

Code:
        MainMenuBarLeftEndCap:Hide() 
        MainMenuBarRightEndCap:Hide()
as all Blizzard code is executed before addons (unless it's LOD).
I think that you're right.
BasicBuffHide does it like that, and it works.
Looky here: http://files.wowace.com/BasicBuffHid...ide-r54514.zip
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » How can i make this load with the game?

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