-
Posts
7,936 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Rick
-
Script incorrectly marked as changed
Rick replied to thehankinator's topic in Leadwerks Engine Bug Reports
I notice this all the time too. -
[SOLVED] Debugger Error when GetPosition
Rick replied to tipforeveryone's topic in Leadwerks Engine Bug Reports
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. -
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.
-
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?).
-
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.
-
System:GetProperty() fails to read long strings
Rick replied to Rick's topic in Leadwerks Engine Bug Reports
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! -
System:GetProperty() fails to read long strings
Rick replied to Rick's topic in Leadwerks Engine Bug Reports
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. -
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
-
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?
-
Very strange. That's not what I'm experiencing. My config file is getting totally wiped out on each run.
-
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.
-
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).
-
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!!!
-
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
-
Looks like a config file in AppData/Local/yourgame
-
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?
-
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().
-
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.
-
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)
-
What's the status on this? I see a bunch of errors when building with 2015.
-
Not being able to add animations by not having the base format is a no go. Maybe for prototyping but not for anything serious.
-
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
-
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.
-
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.
-
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.