• 1 page(s)
How to go about this?

I'm trying to write an addon for myself. Having read Hello World tutorials and prior programming experience, I think I'm up for the task of writing this rather seemingly-simple addon.

The addon I want is to pop up a dialog to notify me when I receive (via World Drop) a predefined list of items/patterns/plans. The idea is that if by chance I get a twink item and have no need/desire for it, I would like to make the appropriate amount of money off my fortune rather than be the fool who sells a 30g item for 2g on the AH.

Future expansion might be to allow the user to add to that list while still in game (like Junk Sellers allow you to add items to automatically sell).

Anyway, here is some psudeo-code of what I think I need to do to accomplish this:

On Load

    If FirstTimeRunningAddon = True Then
        SearchBags()
    End If

End

On NewItemInBag

    IsItemATwink = CompareItems(NewItem)
        If IsItemATwink = True Then
            TwinkItemFrame.Hidden = False
            PlaySound
        End If

End

OnRemovalofItemFromBag

    IsItemATwink = CompareItems(NewItem)
    If IsItemATwink = True Then
        If SellingToVendor OR DestroyingItem OR DisenchantingItem Then
            Remind User Item Is Twink
        ElseIf SellingOnAuctionHouse Then
            Remind User Item is Twink, Don't Sell Cheaply
        Else
            Throw Error--How did we get here?
       End If
    End If

End

SearchBags()

    For Each Bag
        For Each Item
            IsItemATwink = CompareItems(CurrentBag,CurrentItem)
            If IsItemATwink = True Then
                TwinkItemFrame.Hidden = False
                PlaySound
            End If
        Next Item
    Next Bag

End

CompareItems(Item)

    CompareItems = False

    For Each KnownTwinkItem
        If Item = KnownTwinkItem Then
            CompareItems = True
            Return
        End If
    Next KnownTwinkItem

End

 

Any ideas how to accomplish this?


[edited by: highflight1985 at 6:40 PM (GMT -6) on 14 May 2009]

Report this thread post

Well you have done the easy part. Now you have to take your pseudo code and find the appropriate Lua functions that line up with your code. Use the API on wowwiki and wowprogramming to find what you need. Since you already have that programming experience the rest should be cake. If you are not as experienced as you think you might be your best bet is to take another addon that is similar to what you want and break apart their code and see how they did it.

See my "Thread to end all threads thread" for the answer to your question!

Report this thread post

Thanks for the reply.

I have actually already looked through the API and found a few possible candidates. The only issue is that I don't understand how to format my list such that my code can access it, nor do I know how to do the actual accessing or saving back to the list. I was hoping someone might be able to point out which API functions/calls I need.

Report this thread post

Can anyone point me in the right directon to where I need to read about how to write my item database and retrieve it at runtime in lua?

Report this thread post

I don't know if this will help you, but you might want to have a look at how LightHeaded is written. You can find it here:  http://www.wowinterface.com/downloads/info7017-LightHeaded.html

"Sometimes, you've jost GOT to: Narfle the GARTHOK!"

Report this thread post
  • 1 page(s)
Subscribe to this thread: (you will receive emails when new posts are made)