Jump to content

Rick

Members
  • Posts

    7,936
  • Joined

  • Last visited

Everything posted by Rick

  1. I really think we need a checkbox in the properties tab for csg to collapse it or not. The mass/script just isn't intuitive I think.
  2. Yeah for the C++'ers it's annoying now how things are setup. If I work in a C++ project I usually gut all the C++ code that's there and start from scratch with my own setup.
  3. Interesting. A few months ago when we would check the box to only include used files we were getting similar errors this guy did and we were loading a fair amount of stuff via code. We unchecked that box and it would work. When we would look at the log it wasn't loading some resources that only got loaded via code so we made this conclusion. Might be a bug (or maybe you fixed/changed this in the last few months?).
  4. To elaborate on Haydenmango's comment, which is probably right, if you load a lot of assets via code only (ie those assets are not in the map file) then the engine doesn't know you want those assets as it doesn't seem to go through your code to see what assets you need but just looks at the map file.
  5. I'm writing it so it's less code on my side actually (code that I had to write anyway) The following works: -- for saving (instead of = I use ~) local mapSave = serializeTable(map, "map", true) System:SetProperty("profile1", mapSave) -- for loading local r = System:GetProperty("profile1") r = string.gsub(r, "~", "=") loadstring(r)() The 'map' table now has my data which is the variable used in my game. I'll relook at this later. For now it's good enough to keep me moving with the game. Thanks a lot Mack for the investigation. Always an amazing help you are!
  6. Ah, ok. I'll make a couple changes. I just figured each property is on it's own line and that Josh would be looking for the first equal sign only to determine the difference between key and value and everything after that is just considered part of the value string.
  7. Attached is what my config file looks like after I write to it via System:SetProperty(). However, when I close my exe and open it up again to try and read it, it's empty. When the exe closes this time the file itself is empty too. It's like it's able to write a long string but it's not able to read a long string correctly. Is there any way in your reading of properties that you can read in any length string? There must be a crash happening in that function that does the reading that causes it to just bail out and return an empty string. RTS.txt
  8. Wow, very strange stuff here. So I just did: System:SetProperty("test", "Rick") and it showed up and stayed up between runs when I commented it out after. Then I wrote my map table again which results in 451KB in size. I then closed the exe, commented out any set or get and reran. Once I closed again the file size went back down to 1KB and only had my test=Rick in it. Maybe it's a size thing of the file?
  9. Very strange. That's not what I'm experiencing. My config file is getting totally wiped out on each run.
  10. Right, so you are setting them there. Now restart the exe and only do the getting part. For me the config is empty when I do that. Even if I don't do the reading part. It's like the config file gets cleared out each run. I would think the idea of a config file would be to maintain itself between runs.
  11. Just curious, have you tried calling set in 1 run, and then only calling the get in a new run of the exe? The config file seems to be empty when I do that. If they are both in the same run it works, but that's not how we'd want it. I have the standard Main() setup when testing this and I do it after the window is created (other GetProperty()'s called).
  12. Was just looking at this today. Take a look at this post. It gives you an idea on how you can do it with images with a mask applied so you can make some interesting bars. http://www.leadwerks.com/werkspace/topic/4631-2d-masks/page__hl__masking The alpha value you set is really the % to show. So .5 is 50% health. You would have a max health and actual health and calc the % from those to determine that value in SetColor(). The download comes with and example you can play with to better understand. Thanks again Shadmar!!!
  13. Interesting that when I send the results directly from GetProperty() to Print() it errors but if I assign it to a variable first it works. System:Print(System:GetProperty("profile1")) vs local r = System:GetProperty("profile1") System:Print(r) The other thing is that I'm saving a table that I convert to string so it might be because of that. The jist that I'm trying to do is save a lua table to string, then read it back and convert it back to a table using loadstring() so I can treat this as a way to save game data, but so far the loadstring() is returning nil after reading the table back in. This is the code I'm using to convert table to string and it seems to work well. function serializeTable(val, name, skipnewlines, depth) skipnewlines = skipnewlines or false depth = depth or 0 local tmp = string.rep(" ", depth) if name then tmp = tmp .. name .. " = " end if type(val) == "table" then tmp = tmp .. "{" .. (not skipnewlines and "\n" or "") for k, v in pairs(val) do tmp = tmp .. serializeTable(v, k, skipnewlines, depth + 1) .. "," .. (not skipnewlines and "\n" or "") end tmp = tmp .. string.rep(" ", depth) .. "}" elseif type(val) == "number" then tmp = tmp .. tostring(val) elseif type(val) == "string" then tmp = tmp .. string.format("%q", val) elseif type(val) == "boolean" then tmp = tmp .. (val and "true" or "false") else tmp = tmp .. "\"[inserializeable datatype:" .. type(val) .. "]\"" end return tmp end
  14. Looks like a config file in AppData/Local/yourgame
  15. It looks like this doesn't write to file until the exe closes. Is there any way to flush this write to happen whenever we need it to?
  16. Code doesn't really work that way right. The function doesn't know the context in which it's called. You're really asking for a new function like CanMoveToPoint().
  17. Rick

    Delta Time

    I guess "makes sense" just depends on what you're used to , but seriously you use it the same you do delta don't you? You multiply your values by it.
  18. Rick

    Delta Time

    Just multiply your values by GetSpeed(). I'm not sure what's confusing about that? If your PC is the "perfect" timing GetSpeed() returns 1 (so multiplying your value by this does nothing to change it) If your PC is really fast GetSpeed() returns < 1 (so multiplying by this will reduce your value to slow it down) If your PC is really slow GetSpeed() returns > 1 (so multiplying by this will increase your value to speed it up)
  19. What's the status on this? I see a bunch of errors when building with 2015.
  20. Not being able to add animations by not having the base format is a no go. Maybe for prototyping but not for anything serious.
  21. Show us the script where you are assigning these values? If you think just because you have the script property "ID" that it'll get translated to a key/value name ID then you'd be wrong. You have to explicitly assign this in your scripts Start() function like: Script.ID = 0 --int "ID" function Script:Start() self.entity:SetKeyValue("ID", self.ID) end The name is a special field and Josh does set this script property to a key/value. [EDIT] It might be a cool idea to make a generic function that does this translation for people. You should be able to loop over 'self' and get all the fields and make them key/value and add to the entity (just ignore functions and tables when looping over). Then you could do something like the below and it'll be easier to do this for other objects. function Script:Start() MakePropertyKeyValues(self) end
  22. I guess you'd have to weigh if that makes things easier to understand for users vs removing flexibility, because it may remove more advanced use cases.
  23. Your other option, moving forward with other things, is to open the mdl (dbl click it) and in the model viewer add physics box to it and save. Then you can drag it in and it'll work right.
  24. We've asked before for the editor to be able to create key/value pairs that could be added by Josh to the entity via SetKeyValue(). This would allow anywhere to get the values and this would be the best solution I feel.
×
×
  • Create New...