Not signed in (Sign In)
  1.  
    I'd like to create a module (like Beancounter and Undercut) that would adjust the price. Meant to run after Beancount and Undercut has already run, the formula would be like this:

    Set Min Bid = Vendor + deposit
    If Min Bid = 0 then
    Min Bid = 1 copper (for the stack, not per item)

    If Buyout <= Min Bid then
    Clear Buyout so there is no buyout.

    Of course, if someone could create this module for me, that'd be awesome...
    • CommentAuthortestleK
    • CommentTimeApr 28th 2008
     
    Are you trying to figure out where you should start with writing this? Are you new to LUA or having any experience in addons? This would not be a hard market matcher to write even with little or no skill infact it is probably a great little way to get into coding for addons... I would start by taking a glance at how the competition market matcher is written...
    • CommentAuthorKinesia
    • CommentTimeApr 28th 2008
     
    Unfortunately the current setup for Matchers only enables you to change the Buyout, bid is always set from your Markdown % in the options.
    I do think we need to add the option for Matchers to adjust both prices though...
    • CommentAuthorRockSlice
    • CommentTimeApr 28th 2008
     
  2.  
    Yes, I'm new to LUA. I have a basic understanding of programming, and I consider myself quite good at it, I just don't know LUA's language. The variables, commands, formula, structure, etc.

    When you throw in variables/functions specific to WoW, it gets a little confusing trying to self-teach. WoW websites assume you know LUA and LUA websites never mention anything about WoW.

    I'm still picking away at it, though. What I'm trying to learn at the moment (not related to this module) is how matrices work in LUA. When it comes to this.that and this.theother, I don't know how to set these, change them, etc. There's an addon I use that's experiencing a nil error in one of those variables and I was trying to fix it but I can't. =/
    •  
      CommentAuthorHirsute
    • CommentTimeApr 29th 2008
     
    this.that, I believe is Library.function, at least in the Auc code I've messed with. So, AucAdvanced.Print is the Print function as defined in AucAdvanced (In Core-Util.lua, I believe). At the beginning of many of our files you'll find a line that looks like "lib = <some name here>". Whatever we set lib to will end up being how the functions get named. To use Core-Util.lua for AucAdvanced as an example again, the mentioned line there looks like "lib = AucAdvanced". Functions that are intended to be exposed beyond that particular file are usually defined using lib.FunctionName in the file. This results in AucAdvanced.FunctionName being the function that needs to be called. So lib.Print becomes AucAdvanced.Print, for example.

    HTH in that case.
    •  
      CommentAuthordinesh
    • CommentTimeApr 29th 2008
     
    more generally, "this.that" is an example of Lua tables. http://lua-users.org/wiki/TablesTutorial
    •  
      CommentAuthordinesh
    • CommentTimeApr 29th 2008
     
    Posted By: Hirsutethis.that, I believe is Library.function, at least in the Auc code I've messed with. So, AucAdvanced.Print is the Print function as defined in AucAdvanced (In Core-Util.lua, I believe). At the beginning of many of our files you'll find a line that looks like "lib = <some name here>". Whatever we set lib to will end up being how the functions get named. To use Core-Util.lua for AucAdvanced as an example again, the mentioned line there looks like "lib = AucAdvanced". Functions that are intended to be exposed beyond that particular file are usually defined using lib.FunctionName in the file. This results in AucAdvanced.FunctionName being the function that needs to be called. So lib.Print becomes AucAdvanced.Print, for example.

    This is probably a reasonable, practical explanation for one of the ways we use tables in Auctioneer, as a mechanism for exposing public method APIs while keeping the implementation of those functions local, and it will likely be helpful for anyone starting out in Auctioneer. But I should point out that it's not necessarily applicable to any other addon, or even generally how or why tables are used in Lua.
    •  
      CommentAuthordinesh
    • CommentTimeApr 29th 2008
     
    Posted By: Thortok2000There's an addon I use that's experiencing a nil error in one of those variables and I was trying to fix it but I can't.

    Often, this sort of thing is caused by referencing something like "tablename.specificitem" in your code, and you get a "tablename is nil" error because your code somehow didn't account for the fact that tablename might not even have been set yet, so it is nil by default.

    The best way to fix these sorts of errors is to follow through the code logic, and figure out WHY "tablename" hasn't been set yet, and fix it to always be set before calling your code, if that is appropriate. Sometimes, though, your code does need to run at a time when it may or may not be set.

    In these cases, you either want to enclose your code in an if block:
    if tablename then <other code including tablename.specificitem here> end

    or, if your code is actually part of an if statement, you just need to compound the if check and take advantage of the fact that Lua uses short-cut evaluation and won't evaluate unneeded terms:
    if (tablename and tablename.specificitem) then <other code here> end

    So in this case, it will check tablename, see that it is nil, and because you're using "and" it won't bother trying to evaluate tablename.specificitem (which would cause a nil error if it tried).
  3.  
    It's basically setting an RGB value. The variable is like color.red color.blue and color.green. Or something like that.

    What I was trying to do is "if color.red = nil, then set color.red = 0" or something. It ended up wiping my entire saved variables for that addon. =/ I'll take a look at that tutorial.

    Here's the bug, just for reference purposes (I intend to come back to this thread as I work on the bug):

    Date: 2008-03-15 20:30:51
    ID: 51
    Error occured in: Global
    Count: 3
    Message: ..\AddOns\Aloft\AloftTag.lua line 106:
    attempt to perform arithmetic on field 'healthBarR' (a nil value)
    Debug:
    WoWDigger\wowp.core.lua:223: ErrorHandler()
    [string "WOWX:ErrorHandler(...);"]:1: in main chunk
    Ace2\AceEvent-2.0\AceEvent-2.0.lua:299: TriggerEvent()
    Aloft\Aloft.lua:535: OnNameplateShow()
    Aloft\Aloft.lua:669: SetupNameplate()
    Aloft\Aloft.lua:291: ProcessChildFrames()
    Aloft\Aloft.lua:300:
    Aloft\Aloft.lua:296
    [C]: ?
    Ace2\AceEvent-2.0\AceEvent-2.0.lua:367:
    Ace2\AceEvent-2.0\AceEvent-2.0.lua:345

    lines 104-108 of AloftTag.lua:

    Aloft.TagData.HealthBarColor =
    {
    method = function(aloftData, value) return value and ("|cff%02x%02x%02x%s|r"):format(aloftData.healthBarR*255, aloftData.healthBarG*255, aloftData.healthBarB*255, value) end,
    noGuaranteeChange = true
    }
World of Warcraft™ and Blizzard Entertainment™ are trademarks or registered trademarks of Blizzard Entertainment, Inc. in the U.S. and/or other countries.