+ Reply to Thread
Results 1 to 8 of 8

  Click here to go to the first Rift Team post in this thread.   Thread: reading a lua file (not from Rift) then show it in game

  1. #1
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default reading a lua file (not from Rift) then show it in game

    To make it simple. I made a tool that tracks my auctions. Most of it is done manually in a web site.

    So I have to alt-tab pretty often in order to know for how much I should list an item. (depending on the results of the sale the tool will adjust the price upwards or downwards).

    I figured that I could export the content of my DB to a lua file (only specific records) and build a lua table that would have the following structure :

    items_price = {
    '23432HLKJ2JF' = 1234,
    '23LHJK5KJHJGH' = 23443,
    }

    --

    this is essentially a hash that contains the itemkey and prices of the items.

    What I would like to do is to be able to load this table in Rift and then when I rollover an item in my bag (or the AH) display the "price" from that table in a frame.


    My question is : does the current API allows such. I've looked at it, but haven't found something as explicit as "Event.mouse.rollover("bagSlot") or something like that.

    If it is possible what event should I look for ?

    Thanks !

  2. #2
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default got it working somewhat

    Managed to get Rift to read the file.

    However, the content seems to be loaded only when logging in. a Reload UI will overwrite its content. (makes sense since we save the data on reload)

    But calling the load function won't change what is loaded even if the saved variable file was edited outside of Rift.

    Is this behaviour intended ?

  3.   This is the last Rift Team post in this thread.   #3
    Rift Team
    Join Date
    Oct 2010
    Posts
    927

    Default

    Quote Originally Posted by Frostshizzle View Post
    Is this behaviour intended ?
    There's currently no way to stream data in in realtime, so, yes. If you want to write data to a file I recommend writing it to the addon's source files, then /reloadui will reload everything on demand.

  4. #4
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default

    Quote Originally Posted by ZorbaTHut View Post
    There's currently no way to stream data in in realtime, so, yes. If you want to write data to a file I recommend writing it to the addon's source files, then /reloadui will reload everything on demand.
    I see. well my work around is to log out. Overwrite the file, then relog.
    That way i get the new data.

    maybe something like /reloadsv ?
    which would simple reload the saved variable (without saving first). It could optionally receive and add-on name, so the reload is executed on this namespace only ?

    All in all thanks for your help Zorba, coding those tools have been very fun so far.

  5. #5
    Telaran
    Join Date
    Oct 2011
    Posts
    86

    Default

    Quote Originally Posted by Frostshizzle View Post
    I see. well my work around is to log out. Overwrite the file, then relog.
    That way i get the new data.

    maybe something like /reloadsv ?
    which would simple reload the saved variable (without saving first). It could optionally receive and add-on name, so the reload is executed on this namespace only ?

    All in all thanks for your help Zorba, coding those tools have been very fun so far.
    If I am understanding correctly, you will want to add this file to the addon folder, not to your saved variables folder. In the .toc, add it to be loaded. The addon should never modify it then and when you modify it through the web, just go back to game and /reloadui. Your mod can then reread the tables.

  6. #6
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default

    Why, didn't I thought of that. It should work indeed. And as a bonus, it wouldn't mess with the saved variables, as none are needed.

  7. #7
    Telaran
    Join Date
    Jan 2011
    Posts
    71

    Default

    Quote Originally Posted by Frostshizzle View Post
    My question is : does the current API allows such. I've looked at it, but haven't found something as explicit as "Event.mouse.rollover("bagSlot") or something like that.

    If it is possible what event should I look for ?
    AFAIK you can't know what item you are hovering over (unless you map your bag coordintes to screen coordinates and use Event.Mouse.Move and/or Inspect.Mouse), but you can pick it up and get its details with Event.Cursor.

    Code:
    	Event.Cursor
    		Event documentation:
    			Signals that the cursor has changed.
    				Event.Cursor(type, held)
    		Parameters:
    			type: The current cursor type. Valid values include "ability", "item", and "itemtype".
    			held: The blob describing the new element held. Generally, some kind of identifier used in another part of the addon system.
    In your event handler you can then call Inspect.Item.Detail to get useful info about the item (I guess you want to compare the item name?)

    Code:
    local MyAddon, PrivateTable = ...
    local my = {}
    
    function my.OnCursorChange(type, held)
      if type == "item" and held then
        local itemDetails = Inspect.Item.Detail(held)
        -- your logic
      end
    end
    
    table.insert(Event.Cursor, { my.OnCursorChange, MyAddon.identifier, "OnCursorChange" })
    Last edited by Matrix; 12-09-2011 at 10:19 AM.

  8. #8
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    130

    Default

    Interesting, I'll look into adding that.
    Thanks !

+ 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