Changing Entity.lua

TimMcTimMc Join Date: 2012-02-06 Member: 143945Members
edited November 2012 in Modding
Nevermind its been fixed, removed code to avoid people wasting time reading it.

Comments

  • ChaosXBeingChaosXBeing Join Date: 2012-10-12 Member: 162114Members
    <!--quoteo(post=2026377:date=Nov 16 2012, 08:29 PM:name=TimMc)--><div class='quotetop'>QUOTE (TimMc @ Nov 16 2012, 08:29 PM) <a href="index.php?act=findpost&pid=2026377"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Entity.lua is updated to accept tables aswell as its old string.
    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->function GetEntitiesForTeam(className, teamNumber)

        assert(type(teamNumber) == "number")
        
        local function teamFilterFunction(entity)
            return HasMixin(entity, "Team") and entity:GetTeamNumber() == teamNumber
        end
        
        if type(className) == "string"
            return GetEntitiesWithFilter(Shared.GetEntitiesWithClassname(className), teamFilterFunction)
        [u][b]elseif[/b][/u]
            local entitySet = { }
            for i,v in ipairs(className) do
                for k,x in pairs(GetEntitiesWithFilter(Shared.GetEntitiesWithClassname(v), teamFilterFunction)) do table.insert(entitySet, x) end
            end
            return entitySet
        end

    end<!--c2--></div><!--ec2--><!--QuoteEnd--></div><!--QuoteEEnd-->

    For starters, you do have an elseif without a condition. An elseif is exactly what it sounds like; a combination of an 'if' and an 'else' statement. If you with to simply have the second part fire if the first part doesn't, just make it an else.
  • TimMcTimMc Join Date: 2012-02-06 Member: 143945Members
    edited November 2012
    <!--quoteo(post=2026695:date=Nov 17 2012, 02:11 AM:name=ChaosXBeing)--><div class='quotetop'>QUOTE (ChaosXBeing @ Nov 17 2012, 02:11 AM) <a href="index.php?act=findpost&pid=2026695"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->For starters, you do have an elseif without a condition. An elseif is exactly what it sounds like; a combination of an 'if' and an 'else' statement. If you with to simply have the second part fire if the first part doesn't, just make it an else.<!--QuoteEnd--></div><!--QuoteEEnd-->

    Ah bugger that was obvious. :X


    Edit: That didn't fix it. Still getting the error when these two files are included. Is there any way to scroll up in the game console? I see the end of an error (probably cascading down from this), but not where it begins.
  • kikaxakikaxa Join Date: 2012-08-19 Member: 155845Members
    ->> if type(className) == "string"
    missing "then"
    RTFM, lazy ***!
  • TimMcTimMc Join Date: 2012-02-06 Member: 143945Members
    <!--quoteo(post=2027027:date=Nov 17 2012, 11:55 AM:name=kikaxa)--><div class='quotetop'>QUOTE (kikaxa @ Nov 17 2012, 11:55 AM) <a href="index.php?act=findpost&pid=2027027"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->->> if type(className) == "string"
    missing "then"
    RTFM, lazy ***!<!--QuoteEnd--></div><!--QuoteEEnd-->

    Ah... yes.. honestly I hadn't look at it today. This is what I get for making threads at 2am before bed last night.

    On topic of debugging though, how do I read the entire console logs for NS2? I cannot scroll up.
  • kikaxakikaxa Join Date: 2012-08-19 Member: 155845Members
    C:\Users\kix\AppData\Roaming\Natural Selection 2\log-%n.txt
  • ChaosXBeingChaosXBeing Join Date: 2012-10-12 Member: 162114Members
    <!--quoteo(post=2027133:date=Nov 17 2012, 02:37 PM:name=kikaxa)--><div class='quotetop'>QUOTE (kikaxa @ Nov 17 2012, 02:37 PM) <a href="index.php?act=findpost&pid=2027133"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->C:\Users\kix\AppData\Roaming\Natural Selection 2\log-%n.txt<!--QuoteEnd--></div><!--QuoteEEnd-->


    It should be there, unless you're like me and the log doesn't generate.

    As an aside, it's nearly impossible to see console messages during world loading right now, but hopefully after the next patch all of the new console-spamming world gen code will be removed, so it'll be a lot easier. (The loading messages were put there in 229 so that UWE could track down some of the loading problems people have been having.)

    I'm going on vacation this week so the timing works out fairly well for me, but I imagine it'll make things difficult for you right now.
Sign In or Register to comment.