PDA

View Full Version : Need help coding this mod


Asmodei
25-03-2006, 09:41 PM
I'm trying to make my first mod, and having no experience with lua or xml, its a little tricky.

Here is what the mod will do.

User logs in, loads mods.
Opens mod window, and Profession window.
Shift-click on item adds the item to the mod database. GetTradeSkillItemLink(index)
Duplicate items (items already in mod database) are not stored twice. (Unique itemID used as Primary key)
Mod window shows the list of items stored.
Items can be removed from the list.
Items can have a short comment next to them, which will be output with the item. (Text field in item DB)

Macro is set with /nameofmod
Macro is placed on the actionbar.
When the macro is run, the mod:

Detects the chat channels received by the chatwindow
If Trade - City is present, mod continues. If not, it stops, and prompts user. GetChatWindowChannels(index)
Items in mod database are listed, one per line.

ItemLink, comment.
ItemLink, comment.
ItemLink, comment.

The idea for this mod is simply to link the items that crafters normally advertise in macros. I know it is possible to link items in macros, but you are limited to about 4-5 links, due to the 255 character limit. When you are trying to advertise 9 or 10 items, it is frustrating.

If the basic functions are in, then I can work on the tweaks later.
These include being able to re-order the list, and being able to have the first line of output as a comment by the User.

Any ideas on how to do this? I'll keep editing as I find functions I think will help.

Asmodei
26-03-2006, 06:02 PM
Can anyone recommend an LUA editor? I have found a mod which has a similar functionality for part of what I am trying to do (it stores item links in a table, and then posts them back to the chatframe) which I can hopefully modify, but the LUA in Notepad is a hideous mess.

Crevox
26-03-2006, 06:59 PM
http://lua-users.org/wiki/LuaEditorSupport

Asmodei
27-03-2006, 12:25 AM
Thanks Crevox. I'm using a UI developer, which is making the XML extremely easy. The LUA is still going to be tough though.

If anyone has any experience with ItemLinks, and can help me out, I'd appreciate it.

Asmodei
27-03-2006, 03:56 AM
Well I have my main Frame all designed. I had a few thoughts about the functionality, I just need to know if it's possible.

The Frame has a Single line Text box, so you can put in your message that will appear above the list.

Then there are 6 lines. Each line has a check box, a Label, a Single line Text box, and 3 buttons (up, down, and delete)

Here is where I need help.

When the Frame is open, shift-clicking an ItemLink pastes the ItemLink into the first Label. The Label can hold up to 3 ItemLinks.

The SLTB holds a short text string (eg: 6g) which is stored along with the links.

When the Checkbox is checked, no more links will go into that line. It essentially locks the Label. The links will then fill the first available (unlocked and empty/not-full) Label.

The Label and SLTB can be moved up and down in the list by the Up and Down buttons. Both move at the same time.

The Label and SLTB can be cleared by the Delete button. Any lines below the one deleted are then moved up the list.

The list is stored in a per-character Table.

The frame is accessible by typing /Craftlink

The list outputs to the Chat window by typing /Craftlink output.

Any help with any of these would be appreciated.