+ Reply to Thread
Results 1 to 2 of 2

Thread: Need help with recursion and event release

  1. #1
    Plane Touched
    Join Date
    Jan 2011
    Posts
    209

    Default Need help with recursion and event release

    I kind of brute-forced together a simple auction-data dumper that takes a list of ItemIDs and dumps out the last N days of their sales. It works, but it's rather clunky (failing to fully output all the items 2 out of three attempts) and leaves a bunch of extra data in the output buffer whenever I look at stuff in the AH because I haven't figured out how to properly release the Event.Auction.Statistics attachment I made...

    I figure I can make it lot more reliable if I replace the giant list of Command.Auction.Analyze statements with a recursive call to a list of ItemIDs for which Command.Auction.Analyze is invoked for each item. I'm not sure how to structure that, though.

    I've tried to figure out how to properly use the Command.Event.Release, but I can't seem to get it to work correctly.

    Can a more experienced LUA scriptwriter help me out? Thank you very much in advance!!!

    main.lua code is below, with about 100 lines of Command.Auction.Analyze removed for simplicity.


    Code:
    function slash_tomAD(handle, parameter)
    
    Command.Auction.Analyze("I1091DE8137246EB9,EAFD7219AC1D485E,,,,,,", Inspect.Time.Server()-1209600, Inspect.Time.Server() )
    Command.Auction.Analyze("I1091DE8745B004B8,0B5E3063DF685777,,,,,,", Inspect.Time.Server()-1209600, Inspect.Time.Server() )
    Command.Auction.Analyze("I0950846DB676B5E7,F3C29B2C42E2029A,,,,,,", Inspect.Time.Server()-1209600, Inspect.Time.Server() )
    Command.Auction.Analyze("I1091DE83116726AF,1CE39086AAAB7486,,,,,,", Inspect.Time.Server()-1209600, Inspect.Time.Server() )
    Command.Auction.Analyze("I1091DE8573665437,E294B493E311FC08,,,,,,", Inspect.Time.Server()-1209600, Inspect.Time.Server() )
    Command.Auction.Analyze("I50A53B9488A8D7C4,1C928C161D0812FC,,,,,,", Inspect.Time.Server()-1209600, Inspect.Time.Server() )
    
    end
    
    Command.Event.Attach(Event.Auction.Statistics, function(handle, itemtype, data)  print(itemtype) dump(data) end, "TomAD")
    Command.Event.Attach(Command.Slash.Register("TomAD"), slash_tomAD, "TomAD")

  2. #2
    Shield of Telara Adelea's Avatar
    Join Date
    Mar 2011
    Posts
    734

    Default

    There is no Command.Event.Release, I guess you mean Command.Event.Detach ?

    The following is what I do when I need to do something once, when the player finishes loading:

    Code:
    local addon, SX = ...
    
    function SX.Event_Unit_Availability_Full(h,t)
    	for k,v in pairs(t) do
    		if v == "player" then
    			Command.Event.Detach(Event.Unit.Availability.Full, nil, nil, nil, addon.identifier)
    			-- do stuff
    		end
    	end
    end
    
    Command.Event.Attach(Event.Unit.Availability.Full, SX.Event_Unit_Availability_Full, "Event.Unit.Availability.Full")
    http://forums.riftgame.com/image.php?type=sigpic&userid=125779&dateline=13553  38065

+ 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