Quantcast
Learning LUA - WoWInterface
Thread Tools Display Modes
02-28-06, 12:23 PM   #1
Mr_Vonhelding
A Deviate Faerie Dragon
Join Date: Feb 2006
Posts: 10
Learning LUA

Im trying to get into the addon game so to speak.

For starters im skipping the interface design. It jsut takes more brain power than i have to devote right now to go through reams and ream and reams of code that si far to similar to html tables than I like.

What I would like to do for a starter. To get my feet wet. Is take some macros I made up in game that i use alot and turn them into / commands via an addon.

So lets take something real simple

/say Stop laying down on the job %T
/cast Ressurection(Rank 1)

This obviously says the line then casts ressurection on my target.

So what I'd like to do is turn something like this into a / command

For example

/rt

and Poof it access the lua which in turns sends the message and then rezes my current target.

Ive got some basic Idea. But Im wondering if anyone can provide a little lesson or a link to a tutorial that might detail how to go about this?

Thank in advance
  Reply With Quote
02-28-06, 12:27 PM   #2
JoshBorke
A Chromatic Dragonspawn
 
JoshBorke's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 185
http://www.wowwiki.com/Interface_Customization

Has a tutorial section where you should start because you really should create a xml file if only to hold a single frame.

http://www.wowwiki.com/Category:HOWTOs

Should show you how to add a slash command.

HTH
  Reply With Quote
02-28-06, 12:47 PM   #3
Mr_Vonhelding
A Deviate Faerie Dragon
Join Date: Feb 2006
Posts: 10
Just curious why would I want a frame if my first intention is only to put these macros into slash commands?
  Reply With Quote
02-28-06, 01:00 PM   #4
JoshBorke
A Chromatic Dragonspawn
 
JoshBorke's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 185
ah, it's my mistake (still a newb :]). You need the XML if you want to listen to events. But for just slash commands, you can dispense with the XML and go straight to LUA.
  Reply With Quote
02-28-06, 07:04 PM   #5
Mr_Vonhelding
A Deviate Faerie Dragon
Join Date: Feb 2006
Posts: 10
Well its not working

heres what I have so far

myaddon.toc
## Interface: 1800
## Title: My Addon
## Notes: Testing Slash Commands
myaddon.xml

myaddon.xml
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
<!-- Load Script file -->
<Script file="myaddon.lua"/>
<Frame name="myaddon">
<Scripts>
<OnLoad>
myaddon_OnLoad();
SLASH_MYADDON1 = "/myaddonmessage";
SLASH_MYADDON2 = "/mam";
SlashCmdList["MYADDON"] = myaddon_message();
</OnLoad>
</Scripts>
</Frame>

</Ui>

myaddon.lua
function myaddon_OnLoad()
message("My Addon Loaded!");
end

function myaddon_message()
message("Yay! It Works!");
end

And problem is when i type /myaddonmessage or /mam I get the type /help for a list of commands message
So its not loading or creating my slash command list.

What I see is
My Addon Loaded!
Yay! It Works!

as soon as I log in. so its like both events are firing and the list isnt being generated.

Can someone advise?
Please?
  Reply With Quote
03-01-06, 07:48 AM   #6
JoshBorke
A Chromatic Dragonspawn
 
JoshBorke's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 185
Code:
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ C:\Projects\WoW\Bin\Interface\FrameXML\UI.xsd">
<!-- Load Script file -->
<Script file="myaddon.lua"/>
<Frame name="myaddon">
<Scripts>
<OnLoad>
myaddon_OnLoad();
</OnLoad>
</Scripts>
</Frame>

</Ui>
myaddon.lua
Code:
function myaddon_OnLoad()
SLASH_MYADDON1 = "/myaddonmessage";
SLASH_MYADDON2 = "/mam";
SlashCmdList["MYADDON"] = myaddon_message;
message("My Addon Loaded!");
end

function myaddon_message()
message("Yay! It Works!");
end
try that
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Learning LUA

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