+ Reply to Thread
Results 1 to 12 of 12

Thread: Info on addon making?

  1. #1
    Rift Disciple
    Join Date
    Jul 2016
    Posts
    151

    Question Info on addon making?

    EDIT - i have found imhotars guide in the forums, i guess the all-mighty google doesn't give you everything. Reading through now.


    During the recent EU shard downtime i decided i would finally get to doing some addon stuff i wanted to do for a while. However i am only able to find very basic information on how to actually create them. All the information i could find is incomplete and from years ago.

    What i want is an in-dept tutorial on how addons function in general - how the frames are created and handled, event handlers, that sort of thing.

    I have found wiki.riftui.com, which was useful for getting a first frame going, but then i got stuck. How do i make it do stuff? If there are resources i don't know about, feel free to call me [not smart] and send me in the right direction.

    Also, are addons from [that other game] any different and can i use the basics from these addons to learn how to create them in rift? Functions may not be the same, but i would think the basic logic and how everything is done should be similar.
    Last edited by Alleja zaviel; 11-06-2016 at 02:08 PM.
    Quote Originally Posted by TrionBrasse View Post
    Accept that the egregious and obvious mistake you want fixed may be implemented by design and may not be a mistake at all.
    If we see it as an egregious and obvious mistake, maybe there should be more communication to tell us that it is not?
    Alleja Illvana Mjolln Imalla Ketllina <Servants of None> @zaviel

  2. #2
    General of Telara
    Join Date
    Sep 2010
    Posts
    994

    Default

    The Addon API Development Forum (especially Lynx3d) and https://www.seebs.net/rift/live/ (Full API Doc) was a great help to me.

    Try to find out how you work with events and how you can read information from the tables.
    Last edited by Bamul; 11-07-2016 at 02:48 PM.

  3. #3
    Rift Disciple
    Join Date
    Jul 2016
    Posts
    151

    Default

    Quote Originally Posted by Bamul View Post
    The Addon API Development Forum (especially Lynx3d) and https://www.seebs.net/rift/live/ (Full API Doc) was a great help to me.

    Try to find out how you work with events and how you can read information from the tables.
    I was able to find a few resources and start experimenting. However i could not figure out how to manage guild storage for addon info. The command functions point to event ones, and the event seems to just say that they got it. I failed to find any relevant info on it and how to actually read/write to it. Are there any resources on that anywhere?
    Quote Originally Posted by TrionBrasse View Post
    Accept that the egregious and obvious mistake you want fixed may be implemented by design and may not be a mistake at all.
    If we see it as an egregious and obvious mistake, maybe there should be more communication to tell us that it is not?
    Alleja Illvana Mjolln Imalla Ketllina <Servants of None> @zaviel

  4. #4
    General of Telara
    Join Date
    Mar 2014
    Posts
    967

    Default

    Hm what do you mean with "manage guild storage for addon info"?
    Do you mean just guild vault items handling, or sharing addon data with guild members?

    Generally, outside of UI manipulation, most API members fall in one of 3 categories:
    Event: This requires to register a function that will get called whenever the connected event happens
    Inspect: Functions to get detailed information about something, e.g. an item ID you get passed in an event
    Command: Functions to do something that affects game play, e.g. move an item

    The basic way to do anything is to pick some event and register your callback. In that event callback you use the Inspect and possibly Command functions to react to the things that changed and triggered the associated event.

    For guild storage for example, you could listen to Event.Interaction so you know when the player opens the guild bank, use Inspect.Item.List() and Inspect.Item.Detail() to scan the items. On some other event, like clicking a button in your addon UI, you could use Command.Item.Move to move items from/to guild bank.
    Dimension Addon 'Tinker Tools' is now available on Curse!
    Or grab the latest development code on GitHub.

  5. #5
    Rift Disciple
    Join Date
    Jul 2016
    Posts
    151

    Default

    Quote Originally Posted by Lynx3d View Post
    Hm what do you mean with "manage guild storage for addon info"?
    Do you mean just guild vault items handling, or sharing addon data with guild members?

    Generally, outside of UI manipulation, most API members fall in one of 3 categories:
    Event: This requires to register a function that will get called whenever the connected event happens
    Inspect: Functions to get detailed information about something, e.g. an item ID you get passed in an event
    Command: Functions to do something that affects game play, e.g. move an item

    The basic way to do anything is to pick some event and register your callback. In that event callback you use the Inspect and possibly Command functions to react to the things that changed and triggered the associated event.

    For guild storage for example, you could listen to Event.Interaction so you know when the player opens the guild bank, use Inspect.Item.List() and Inspect.Item.Detail() to scan the items. On some other event, like clicking a button in your addon UI, you could use Command.Item.Move to move items from/to guild bank.
    I did mean guild addon files storage. The confusing part is how command passes the list of storage entries to an event. what do i do with it? Who's the player if i want to acces guild storage?

    A clear example on how i would read everything in addon storage, add my own and then read it afterwards.
    Quote Originally Posted by TrionBrasse View Post
    Accept that the egregious and obvious mistake you want fixed may be implemented by design and may not be a mistake at all.
    If we see it as an egregious and obvious mistake, maybe there should be more communication to tell us that it is not?
    Alleja Illvana Mjolln Imalla Ketllina <Servants of None> @zaviel

  6. #6
    Rift Disciple xcal1's Avatar
    Join Date
    Apr 2015
    Posts
    169

    Default

    Quote Originally Posted by Alleja zaviel View Post
    I did mean guild addon files storage. The confusing part is how command passes the list of storage entries to an event. what do i do with it? Who's the player if i want to acces guild storage?

    A clear example on how i would read everything in addon storage, add my own and then read it afterwards.
    Have you taken a look at how Imhothar's Bags handles the guild storage?
    -- xcal

  7. #7
    Rift Disciple
    Join Date
    Jul 2016
    Posts
    151

    Default

    Quote Originally Posted by xcal1 View Post
    Have you taken a look at how Imhothar's Bags handles the guild storage?
    imhotar's bags access in game guild bank, thats not what im after. Trion gives each guild a little bit of storage to addons so say an officer with an addon post sth within the addon, then the addon saves that into the guild storage and then anyone within the guild that runs the addon can access the information even when the officer who originaly posted wasnt online. Guild calendars use that, maybe some other addons as well.
    Quote Originally Posted by TrionBrasse View Post
    Accept that the egregious and obvious mistake you want fixed may be implemented by design and may not be a mistake at all.
    If we see it as an egregious and obvious mistake, maybe there should be more communication to tell us that it is not?
    Alleja Illvana Mjolln Imalla Ketllina <Servants of None> @zaviel

  8. #8
    General of Telara
    Join Date
    Mar 2014
    Posts
    967

    Default

    Ah that storage...haven't really worked with it.

    Quote Originally Posted by Alleja zaviel View Post
    The confusing part is how command passes the list of storage entries to an event. what do i do with it? Who's the player if i want to acces guild storage?

    A clear example on how i would read everything in addon storage, add my own and then read it afterwards.
    Since the communication is asynchronous/throttled, it's one of those cases where you get data in events. But the basic concept is still the same.

    You first attach your function to process the list or entries to Event.Storage.List or Event.Storage.Get resoectively. Then you call Command.Storage.List() / Command.Storage.Get() and whenever the data is available, the event fires.
    I can't tell you what to do with the data though because I don't know what you intend to put there...that's totally up to you.

    Minimum example (you want to use some useful callback instead of "dump" though):
    Code:
    Command.Storage.Set("player", "test", "public", "private", "this is a test", dump)
    Command.Event.Attach(Event.Storage.Get, function(h, target, segment, identifier, read, write, data) print(identifier .. ":" .. data) end, "TestCallback")
    Command.Storage.Get(Inspect.Unit.Detail("player").name, "player", "test", dump)
    Command.Storage.Clear("player", "test", dump)
    Last edited by Lynx3d; 11-09-2016 at 08:39 PM.
    Dimension Addon 'Tinker Tools' is now available on Curse!
    Or grab the latest development code on GitHub.

  9. #9
    Rift Disciple
    Join Date
    Jul 2016
    Posts
    151

    Thumbs up

    Quote Originally Posted by Lynx3d View Post
    Ah that storage...haven't really worked with it.



    Since the communication is asynchronous/throttled, it's one of those cases where you get data in events. But the basic concept is still the same.

    You first attach your function to process the list or entries to Event.Storage.List or Event.Storage.Get resoectively. Then you call Command.Storage.List() / Command.Storage.Get() and whenever the data is available, the event fires.
    I can't tell you what to do with the data though because I don't know what you intend to put there...that's totally up to you.

    Minimum example (you want to use some useful callback instead of "dump" though):
    Code:
    Command.Storage.Set("player", "test", "public", "private", "this is a test", dump)
    Command.Event.Attach(Event.Storage.Get, function(h, target, segment, identifier, read, write, data) print(identifier .. ":" .. data) end, "TestCallback")
    Command.Storage.Get(Inspect.Unit.Detail("player").name, "player", "test", dump)
    Command.Storage.Clear("player", "test", dump)
    That cleared a few things up. But:
    -How would the Command.Storage.List work with the event? From what i see they trigger an event and then give the event variables to work with, what would the variables be called? Just an array called identifier or sth different?.
    -And this one requires both segment and player. If the segment is guild, who would the player be? The one accessing or who?
    -How do i know what variables the function in event.attach takes?

    You did clear up how the command -> event thing works, i can start experimenting now.
    Last edited by Alleja zaviel; 11-09-2016 at 10:06 PM.
    Quote Originally Posted by TrionBrasse View Post
    Accept that the egregious and obvious mistake you want fixed may be implemented by design and may not be a mistake at all.
    If we see it as an egregious and obvious mistake, maybe there should be more communication to tell us that it is not?
    Alleja Illvana Mjolln Imalla Ketllina <Servants of None> @zaviel

  10. #10
    General of Telara
    Join Date
    Mar 2014
    Posts
    967

    Default

    Quote Originally Posted by Alleja zaviel View Post
    That cleared a few things up. But:
    -How would the Command.Storage.List work with the event? From what i see they trigger an event and then give the event variables to work with, what would the variables be called? Just an array called identifier or sth different?.
    Command.Storage.List() works just like Command.Storage.Get(), it will deliver the result with Event.Storage.List to whatever functions are registered to this event. Note that the names of function parameters are generally your choice. More details below...

    Quote Originally Posted by Alleja zaviel View Post
    -And this one requires both segment and player. If the segment is guild, who would the player be? The one accessing or who?
    Someone from the guild you are interested in, if it's your own guild use yourself. I'm not sure, but it seems that the player referenced must be online.

    Quote Originally Posted by Alleja zaviel View Post
    -How do i know what variables the function in event.attach takes?
    From the API Docs.
    http://www.seebs.net/rift/live/Stora...t.Storage.List
    Event.Storage.List(target, segment, identifiers)

    Event callbacks always take the event handle as first argument (not very interesting for global events really), so Event.Storage.List takes expects a function like
    Code:
    function MyStorageListHandler(handle, target, segment, identifiers) .....
    The docs also say that identifiers is a list (well Lua table actually) of the format {identifier = checksum}

    I should also note that unless it's a trivial function, you don't want to define the event handler anonymously inside another function call like I did above...
    So putting it together, iterating over the list of identifiers in your guild would work it like:
    Code:
    local function MyStorageListHandler(handle, target, segment, identifiers)
        for id, checksum in pairs(identifiers) do
            -- <do something with identifier and checksum>
        end
    end
    
    Command.Event.Attach(Event.Storage.List, MyStorageListHandler, "<SomeDescriptiveName>")
    
    local function success(failure, message)
        if failure then print("could not access guild storage") end
    end
    
    Command.Storage.List(Inspect.Unit.Detail("player").name, "guild", success)
    Last edited by Lynx3d; 11-09-2016 at 11:43 PM.
    Dimension Addon 'Tinker Tools' is now available on Curse!
    Or grab the latest development code on GitHub.

  11. #11
    Rift Disciple
    Join Date
    Jul 2016
    Posts
    151

    Default

    Quote Originally Posted by Lynx3d View Post
    Command.Storage.List() works just like Command.Storage.Get(), it will deliver the result with Event.Storage.List to whatever functions are registered to this event. Note that the names of function parameters are generally your choice. More details below...


    Someone from the guild you are interested in, if it's your own guild use yourself. I'm not sure, but it seems that the player referenced must be online.


    From the API Docs.
    http://www.seebs.net/rift/live/Stora...t.Storage.List
    Event.Storage.List(target, segment, identifiers)

    Event callbacks always take the event handle as first argument (not very interesting for global events really), so Event.Storage.List takes expects a function like
    Code:
    function MyStorageListHandler(handle, target, segment, identifiers) .....
    The docs also say that identifiers is a list (well Lua table actually) of the format {identifier = checksum}

    I should also note that unless it's a trivial function, you don't want to define the event handler anonymously inside another function call like I did above...
    So putting it together, iterating over the list of identifiers in your guild would work it like:
    Code:
    local function MyStorageListHandler(handle, target, segment, identifiers)
        for id, checksum in pairs(identifiers) do
            -- <do something with identifier and checksum>
        end
    end
    
    Command.Event.Attach(Event.Storage.List, MyStorageListHandler, "<SomeDescriptiveName>")
    
    local function success(failure, message)
        if failure then print("could not access guild storage") end
    end
    
    Command.Storage.List(Inspect.Unit.Detail("player").name, "guild", success)
    Got it now. Guess the event.storage documentation gives info on variables for the handler function, not the actual event. Gonna try and write sth basic that uses guild storage, and see how it goes. Thanks for the help!
    Quote Originally Posted by TrionBrasse View Post
    Accept that the egregious and obvious mistake you want fixed may be implemented by design and may not be a mistake at all.
    If we see it as an egregious and obvious mistake, maybe there should be more communication to tell us that it is not?
    Alleja Illvana Mjolln Imalla Ketllina <Servants of None> @zaviel

  12. #12
    General of Telara
    Join Date
    Mar 2014
    Posts
    967

    Default

    Quote Originally Posted by Alleja zaviel View Post
    Got it now. Guess the event.storage documentation gives info on variables for the handler function, not the actual event. Gonna try and write sth basic that uses guild storage, and see how it goes. Thanks for the help!
    Not sure what you mean, even though the documentation presents events the same way as functions, they are in fact just dummy tables used as handle for EventAttach().
    So yes the parameters the documentation lists are what will get passed to the callback you attached to that event, omitting the first parameter which is always the event handle (has some additional functions for frame events, see handleEventFrame).
    Dimension Addon 'Tinker Tools' is now available on Curse!
    Or grab the latest development code on GitHub.

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts