+ Reply to Thread
Results 1 to 7 of 7

Thread: OK I give, need help.

  1. #1
    Soulwalker
    Join Date
    Sep 2013
    Posts
    20

    Default OK I give, need help.

    I have been running around in circles, and others code to try and find out why this worked 1 time and never again. I tried all sorts of variation from others code that works. Don't even need the first function print_r, same thing changing print_r in second function to dump, gives same results, just easier to read

    What I want it to do is, list the tooltip info my cursor is on, which works great. But I can not for the life of me get it to save the info again. Would be nice if it could update right away, and keep adding another each time, But I would settle for even saving one at a time even.

    Reason for this is, so I can update RuneCraftHelper data base, and maybe others I have not thought about yet. Also would love to create something like it for other crafts. Since we can not Copy from chat window other wise would not need a log file lol.

    P.S. only reason for printing it out, is so I know it registered the command.

    So anyone able to make this work?

    Code:
    local rcsRiftInfo = nil
    
    function print_r (t, indent, done)
    
      done = done or {}
      indent = indent or ''
      local nextIndent -- Storage for next indentation value
      if(t ~= nil) then
          for key, value in pairs (t) do
            if type (value) == "table" and not done [value] then
              nextIndent = nextIndent or
                  (indent .. string.rep(' ',string.len(tostring (key))+2))
                  -- Shortcut conditional allocation
              done [value] = true
              print (indent .. "[" .. tostring (key) .. "] => Table {");
              print  (nextIndent .. "{");
              print_r (value, nextIndent .. string.rep(' ',2), done)
              print  (nextIndent .. "}");
            else
              print  (indent .. "[" .. tostring (key) .. "] => " .. tostring (value).."")
            end
          end
       else
          print  (indent .. "[nil]")   
       end
    end
    
    local function rcsSlashCommand(hEvent, rcslist)
    	if( (rcslist ~= nil) and (rcslist ~= "")) then
       
    		if (rcslist == "info") then  
    			local rcsi,id = Inspect.Tooltip()			
    			rcsRiftInfo = print_r(Inspect.Item.Detail(id))
    		end
    		
    	end	
    end
    
    Command.Event.Attach(Event.Addon.SavedVariables.Save.End, rcsSlashCommand, "Event.Addon.SavedVariables.Save.End")
    Command.Event.Attach(Command.Slash.Register("rcs"), rcsSlashCommand, "Command.Slash.Register")
    Last edited by Morathie; 05-17-2017 at 08:23 PM.

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

    Default

    I'm still not quite sure what you actually want to do...

    But why do you attach rcsSlashCommand to Event.Addon.SavedVariables.Save.End? Doesn't make sense to me, although it apparently won't do anything anyway.

    Also doing "rcsRiftInfo = print_r(Inspect.Item.Detail(id)" is pretty pointless when print_r doesn't ever return anything, so rcsRiftInfo will always be nil.
    And without seeing your RiftAddon.toc I don't know which variable you actually want to be saved.

    And btw. instead of creating print_r, you could've just used Utility.Serialze.Full()
    Dimension Addon 'Tinker Tools' is now available on Curse!
    Or grab the latest development code on GitHub.

  3. #3
    Soulwalker
    Join Date
    Sep 2013
    Posts
    20

    Default

    This is reality this is all I need, and started with. I just did not delete all the last attempts I did to get a no "nil" value to save. This did the min I wanted, but would like the info to save to file, for easy copy paste to another file.

    I am not the best lua coder, but I can hack my way though it. Struggling to make things save to file. Not sure how to utilize Utility.Serialize.Full()

    Code:
    local function rcsSlashCommand(hEvent, rcslist)
    	if( (rcslist ~= nil) and (rcslist ~= "")) then
       
    		if (rcslist == "info") then  
    			local a,b= Inspect.Tooltip()			
    			dump(Inspect.Item.Detail(b))
    		end
    		
    	end	
    end
    
    Command.Event.Attach(Command.Slash.Register("rcs"), rcsSlashCommand, "Command.Slash.Register")

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

    Default

    Well there's no direct way to write to a file, you basically have two choices: log your chat output, or declare a saved variable in RiftAddon.toc and accumulate the data so it gets saved to a file when Rift unloads addons.

    But it's still not really clear which option you're after. In any case you don't keep any of the item details you query, but dump it in your chat tab.

    Utility.Serialize.Full() is pretty much a fancy version of dump(), i.e. is not limited by what fits in one line but creates the kind of lua code that also gets created for SavedVariables files.
    Dimension Addon 'Tinker Tools' is now available on Curse!
    Or grab the latest development code on GitHub.

  5. #5
    Soulwalker
    Join Date
    Sep 2013
    Posts
    20

    Default

    Thank worked just as I wanted. although still have to logout or reload UI, no big. Just created that for 10 macros.

    I am not sure why though it adds in extra \'s into the save though, before each " and end of line. But also the Icon should read icon = "Data/\\UI\\item_icons\\rune_0_c_yellow.dds" instead of whats below.

    Code:
    "category = \"consumable enchantment\"\
    icon = \"Data/\\\\UI\\\\item_icons\\\\rune_0_c_yellow.dds\"\
    id = \"IFA1DC2B8829CE7A5,837E3C0E07A4575C,,,,,,\"\
    name = \"Gleaming Deft Rune\"\
    rarity = \"uncommon\"\
    sell = 3042\
    stackMax = 99\
    type = \"IFA1DC2B8829CE7A5,837E3C0E07A4575C,,,,,,\"\
    "
    Last edited by Morathie; 05-18-2017 at 10:31 PM.

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

    Default

    Ehm seems like serialization done twice, which has to escape all string delimiters and backslashes (again). If you let Rift save your variables, you don't need to serialize yourself.

    But reading your original post again, I forgot about one possibility, if you want to copy&paste manually anyway, you can use a RiftTextfield. I use that in Tinker Tools for the text export of saved sets.
    Dimension Addon 'Tinker Tools' is now available on Curse!
    Or grab the latest development code on GitHub.

  7. #7
    Soulwalker
    Join Date
    Sep 2013
    Posts
    20

    Default

    Quote Originally Posted by Lynx3d View Post
    But reading your original post again, I forgot about one possibility, if you want to copy&paste manually anyway, you can use a RiftTextfield. I use that in Tinker Tools for the text export of saved sets.
    Not sure how to get this to work on this. But have I got it to save properly, as with serialize I could not. This also lets me pull specific items out.
    Code:
    local function rcsSlashCommand(hEvent, rcslist)
    	if (rcslist == "1") then
    		local rcsi,id = Inspect.Tooltip()		
    		local rcsinfo = Inspect.Item.Detail(id)
    			RiftInfo_1 = rcsinfo
    			print("saved 1")
    	end
    end
    Command.Event.Attach(Command.Slash.Register("rcs"), rcsSlashCommand, "Command.Slash.Register")
    Problem I found with this when actually trying to use this for Runes and not Items. This does not pull info from the Tooltip it seems, or Tootip prints stuff not listed under Item.Detail or another. shown below you can see the Rune stat boost, item level required and usable slot. But in what this pulled out, none of these 3 were saved to file Any suggestions?

    Code:
    RiftInfo_1 = {
    	category = "consumable enchantment",
    	icon = "Data/\\UI\\item_icons\\rune_0_c_yellow.dds",
    	id = "IFA1DC2B8829CE7A5,837E3C0E07A4575C,,,,,,",
    	name = "Gleaming Deft Rune",
    	rarity = "uncommon",
    	sell = 3042,
    	stackMax = 99,
    	type = "IFA1DC2B8829CE7A5,837E3C0E07A4575C,,,,,,"
    }
    This will pull the stat and statrune info separately off items that a rune has boosted. But seems stats shown are not actually part of this rune item, code does not pick it up.

+ 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