Jump to content

Recommended Posts

Man, I am an IDIOT. I didn't understand your intended purpose for builds.lua. Brilliant! I am humbled before greatness. You and Ipsy really saved my arse! You will be duly noted in the thanks section. :victorious:

You're welcome. Test Tools is such an important mod, I'm glad I could aid in its development.

[MENTION=55]Ipsquiggle[/MENTION]I found 2 minor bugs in components/werebeast.lua, on lines 14 and 20. self:SetWere() and self:SetNormal() are being called when setting up the self.inst:DoTaskInTime() callback (which is not being set up, then, since those calls return nil), instead of being called from a callback.I'm not sure if this should be posted here or what, but since every bug report I've seen in the Bug Tracker that talks about code directly, explaining a bug's cause and how to fix it, seems to be ignored, I don't really know what would be the proper approach.---edit---And since I'm at it, could you look at [thread=23076]this bug report[/thread]? (ignoring my reply, since it's unfounded, invalid and makes no sense)This latter bug seems to be affecting one of my mods, and fixing it really amounts to erasing an extra line of code.

Edited by simplex

I'm currently the developer of the (I believe only) European Portuguese translation, and I've stumbled upon a problem that the user Simplex solved for me, and I've come to know other translators (namely, the user Mumbling, author of the Dutch translation) had that problem as well. Simplex then advised me to ask for an implementation of support for comments, that this thread would be a good place to do so.The problem was as follows: In the recent update I translated every new string, but when I went to initiate DS, some of the strings who had been replaced by others (such as the version name in the main screen and the wand and the amulet of ???) appeared as the old version. After some very helpful support by the aforementioned user Simplex, the problem was that low deep in the .po file, this strings still existed (they could be differentiated from the rest because they were the last ones, and their lines started with "~#" (note: this was only visible when opening the .po file with notepad++, not with the regular translation program).I believe this strings should be entirely removed seeing how they are not in use, and Simplex told me that implement support for comments would make them be ignored, as they should.Just trying to make it easier for future translators and myself in the future! Thanks for reading.

[MENTION=55]Ipsquiggle[/MENTION],Sorry if you're the wrong person to bug about this, but I was wondering if it was possible for you guys to add Lua's unpack function into the mod environment. I can think of a few ways it'd be useful (helping prevent mods from breaking on game update/changes). I suppose if you're at it, it'd probably be kinda cool to have coroutines too, although I cant immediately think of any uses for them off the top of my head

He's the right person. :p But I honestly don't know if requests like that fit better here or [thread=24358]there[/thread].I once said I felt the whole Lua standard library (with a few notable exceptions) should be inside the mod environment, so I agree with you. However, you can currently just import them youself, by writing
unpack = GLOBAL.unpackcoroutine = GLOBAL.coroutine
And oh, you might wanna know that the game's timed callbacks, such as inst:DoTaskInTIme(), are implemented using coroutines.

I felt the whole Lua standard library (with a few notable exceptions) should be inside the mod environment, so I agree with you. However, you can currently just import them youself, by writing

unpack = GLOBAL.unpackcoroutine = GLOBAL.coroutine
And oh, you might wanna know that the game's timed callbacks, such as inst:DoTaskInTIme(), are implemented using coroutines.
I thought I had tried that when I posted this and it didnt work, but I must have got something wrong. Like 5 minutes later I saw someone use it in a mod and I tried again with no problems. I forgot GLOBAL is just _g. Since this is the case, isnt every part of lua available inside the mod as long as you access it through GLOBAL.x? LUA is one part of this that is new to me, so Im still learning the few Gotchas and whatnot (not exactly sure what constitutes the standard library in LUA)

I thought I had tried that when I posted this and it didnt work, but I must have got something wrong. Like 5 minutes later I saw someone use it in a mod and I tried again with no problems. I forgot GLOBAL is just _g. Since this is the case, isnt every part of lua available inside the mod as long as you access it through GLOBAL.x? LUA is one part of this that is new to me, so Im still learning the few Gotchas and whatnot (not exactly sure what constitutes the standard library in LUA)

Yes, every part of Lua, and of the game environment (since that's just the global one), is accessible through GLOBAL[something]. Mod code isn't really sandboxed.The Lua standard library is quite small, since one of its goals is to be usable in embedded systems. It consists of the first two columns of what's listed here.---edit---Just a friendly warning: the game (in worldgen_main.lua) defines its own version of loadfile(), which has a different signature than the standard one. Edited by simplex

[MENTION=44092]simplex[/MENTION], have you run across any code that would allow setting an image's size? Not scale, but a specific size. In my Test Tools preview windows, some objects fill the screen, while the next might be a bee. Quite small. I'd like to do something like:if date.size < (x, x) thendata.SetSize (y,y)endI've found SetScale, but nothing like SetSize...Current code just pulling the preview:

self.objectSpinner = Spinner(objectOptions, 180, spinnerHeight, spinnerFont, spinner_atlas, spinner_images)		function self.objectSpinner:OnChanged(data)			this.working.objectPrefab = data			this:UpdateSelectedObject()			my_anim:SetScale(0.15,0.15,0.15) -- here everything is set to a specific scale, but Size if prefered
Here's a current screenshot by the way: Edited by tehMugwump

[MENTION=44092]simplex[/MENTION], have you run across any code that would allow setting an image's size? Not scale, but a specific size. In my Test Tools preview windows, some objects fill the screen, while the next might be a bee. Quite small. I'd like to do something like:if date.size < (x, x) thendata.SetSize (y,y)endI've found SetScale, but nothing like SetSize...

I haven't. And there doesn't seem to be a method in AnimState for that, since the only methods are:
SetLayerSetRayTestOnBBSetFinalOffsetSetManualBBSetOrientationGetSymbolPositionHideSetSortOrderClearOverrideSymbolSetBloomEffectHandleSetDepthWriteEnabledSetDepthTestEnabledShowPlayAnimationSetTimePauseResumeSetDeltaTimeMultiplierPushAnimationGetMultColourOverrideSymbolSetPercentSetAddColournewSetScaleSetBankPutOnGroundSetBuildSetErosionParamsLoadAnimationGetAddColourSetLightOverrideClearBloomEffectHandleSetDepthBiasAnimDoneSetMultColour
But [MENTION=55]Ipsquiggle[/MENTION] really is the one who can properly answer this, since we're talking about functions directly exported by the engine. I sure hope there's a way.Oh, and I think you meant to write "self" instead of "this" here:
self.objectSpinner = Spinner(objectOptions, 180, spinnerHeight, spinnerFont, spinner_atlas, spinner_images)		function self.objectSpinner:OnChanged(data)			this.working.objectPrefab = data			this:UpdateSelectedObject()			my_anim:SetScale(0.15,0.15,0.15) -- here everything is set to a specific scale, but Size if prefered

Yes, every part of Lua, and of the game environment (since that's just the global one), is accessible through GLOBAL[something]. Mod code isn't really sandboxed.

Is it not really? Feel free to correct me if (when) Im wrong since Im still just getting this, but Its all executed in a pcall, which runs it in a seperate env, yeah? But I suppose that doesnt properly modularize (probably not a real word...) the code/package/module like a require does. So I think I see what you're saying.

The Lua standard library is quite small, since one of its goals is to be usable in embedded systems. It consists of the first two columns of what's listed here.

Alright, Thats what I thought the Lua standard libraries were. Your statement that the entire library should be included made me unsure if there was anything else besides those libraries that made it up, since they they all are kinda accessable already through GLOBAL. but they arent added explicitly, so yeah I do agree. Reading through some of your comments in the API thread, I agree it would be nice to see everything properly environmented, but the way they have it no is certainly not super bad or anything by any means. [MENTION=10028]tehMugwump[/MENTION], just because I noticed your question to simplex as I was replying:I havnt done too much with animState and the animations in general, but could you not create your own SetSize function using SetScale?(Just a little pseudo something cause Im not sure exactly the parameters and functionality of those functions, but something like)
if data.currentSize < (x,x) then   targetSize = (y,y)  scaler = targetSize/data.currentSize  data.SetScale(scaler)end
or whatever. something like that?Also, TestTools really looks like its coming along nicely; rock on! Edited by dgweber

Is it not really? Feel free to correct me if (when) Im wrong since Im still just getting this, but Its all executed in a pcall, which runs it in a seperate env, yeah? But I suppose that doesnt properly modularize (probably not a real word...) the code/package/module like a require does. So I think I see what you're saying.

pcall() doesn't run the code in a different environment, it just stops error propagation. It's basically Lua's try/catch. require() also won't sandbox the code. module() will, putting it in an empty environment (though you can always import stuff locally before calling it).EDIT: As a side note, the fact that mod code is run by pcall(f) instead of xpcall(f, debug.traceback) is a huge annoyance...

[MENTION=10028]tehMugwump[/MENTION], just because I noticed your question to simplex as I was replying:I havnt done too much with animState and the animations in general, but could you not create your own SetSize function using SetScale?

If there is a way to get the current size of the animation box, then sure. But there doesn't seem to be one. Edited by simplex

module() will, putting it in an empty environment (though you can always import stuff locally before calling it).

interesting. I hadnt been exposd to module() in lua yet. time to learn!

EDIT: As a side note, the fact that mod code is run by pcall(f) instead of xpcall(f, debug.traceback) is a huge annoyance...

when I was looking through the pcall stuff I was wondering why they didnt do that as well...

If there is a way to get the current size of the animation box, then sure. But there doesn't seem to be one.

Bugger. I saw him do the "data.size()" in pseudocode, so I was hoping. but that sucks. Really cant wait for some of the animation improvements coming in supposedly coming in september. Ive mostly been avoiding trying to do anything with it because of how finicky it is.

Bugger. I saw him do the "data.size()" in pseudocode, so I was hoping. but that sucks. Really cant wait for some of the animation improvements coming in supposedly coming in september. Ive mostly been avoiding trying to do anything with it because of how finicky it is.

The engine certainly has that info, but apparently it's not exposed to Lua. I hope I'm wrong though and there's some obscure way of getting that info, but that's unlikely. If there were a way, it would be a method of AnimState.

The engine certainly has that info, but apparently it's not exposed to Lua. I hope I'm wrong though and there's some obscure way of getting that info, but that's unlikely. If there were a way, it would be a method of AnimState.

Agreed. While, the compiled engine definitely has the capability, trying to deal with it directly/dealing with userdata(I think thats what its called in lua?) is a pretty not great idea. The animation stuff is clearly some of the most unpolished stuff so far, which is too really too bad. But I mean, its really just a matter of time till they can get around to it.edit: actually [MENTION=44092]simplex[/MENTION], you can probably answer something thats been kind of bugging me:Is that what TheSim actually is? userdata or something? Ive got a kind of general idea of what it is and how it works, but not really concrete. Does anyone have a decent list of all of its functionality/methods (just for what they're worth) or anything like that? I havn't been around here long, and I dont use forums that often (so its very like Im just a little dumb here) but I cant the search results to show the actually post containing the result, so searching and just getting back 4 pages of threads isnt very helpful.Or even better, any of the pieces of userdata (Minimap, etc) and any documentation/functions for them Edited by dgweber

Quite frequently the answers to my obscure needs are "nope", so I don't expect a solution to the 'size' issue. Nor, a 'refresh' call which would keep each image from being plastered on top of the other over and over and over. (that's why I load the image box each time you load a new preview - to 'reset the stage' in a ham-handed way).

[MENTION=55]Ipsquiggle[/MENTION]On the current issue of character mods crashing, I faced it when running some tests on the [thread=26442]Link character mod[/thread]. It's happening whenever I try to exit to the main menu, which triggers a hard (engine level) crash (even after disabling everything in the mod other than the character itself). I used debug.sethook() at the end of mainfunctions.lua's SaveGame() to get some info on where it occurs (tracking every function call and every execution of a line of Lua code), and the output is the following, in the format "{file}:{line_number} {function_name}":

>>> scripts/saveindex.lua:286  SaveCurrent>>> scripts/screens/pausescreen.lua:42  cb>>> scripts/frontend.lua:122  Update>>> scripts/frontend.lua:123  Update>>> scripts/screen.lua:34  OnUpdate>>> scripts/frontend.lua:125  Update>>> scripts/update.lua:49>>> [C]  ProfilerPop>>> scripts/update.lua:50>>> scripts/update.lua:53>>> [C]  ProfilerPush>>> scripts/update.lua:54>>> scripts/emitters.lua:43  PostUpdate>>> scripts/mainfunctions.lua:338  IsHUDPaused>>> [C]  GetTimeScale>>> scripts/emitters.lua:44  PostUpdate>>> scripts/update.lua:55>>> [C]  ProfilerPop>>> scripts/update.lua:56
Immediately after that, the game crashes. So it's happening right after update.lua's PostUpdate() returns. And the lack of the function name for the PostUpdate() call clearly shows it's being called directly by the engine (and since the call returns, the crash must happen in the C++ code following its call).The code I used to do the hooking is this:
debug.sethook(function()        local info = debug.getinfo(2, 'Sln')        if info then                io.stderr:write(">>> ", tostring(info.short_src))                if info.currentline and info.currentline > 0 then                        io.stderr:write(":", info.currentline)                end                 if info.name then                        io.stderr:write("  ", info.name)                end                 io.stderr:write("\n")        else                   io.stderr:write(">>> NO INFO!!!")        endend, 'cl')
(this code will print duplicate lines whenever there's a Lua function call, which I erased manually)
Edited by simplex
  • Developer

@Ipsquiggle

I found 2 minor bugs in components/werebeast.lua, on lines 14 and 20. self:SetWere() and self:SetNormal() are being called when setting up the self.inst:DoTaskInTime() callback (which is not being set up, then, since those calls return nil), instead of being called from a callback.

I'm not sure if this should be posted here or what, but since every bug report I've seen in the Bug Tracker that talks about code directly, explaining a bug's cause and how to fix it, seems to be ignored, I don't really know what would be the proper approach.

---edit---

And since I'm at it, could you look at [thread=23076]this bug report[/thread]? (ignoring my reply, since it's unfounded, invalid and makes no sense)

This latter bug seems to be affecting one of my mods, and fixing it really amounts to erasing an extra line of code.

I definitely think these kinds of bugs should be posted in the bug tracker; they are bugs, and it's a good place to organize them. I'll have a review of the process to see what's going on.

As to these two issues (werebeast, and pickables) I've comitted a fix that will be in the next release.

Thanks!

Hello friends,lpsquiggle you're our new friend right?So I have a question you're a coder and what did you learn first?(Python or something like that?)Would be cool if you answer this question-estier

Edited by estier
  • Developer

@simplex, have you run across any code that would allow setting an image's size? Not scale, but a specific size. In my Test Tools preview windows, some objects fill the screen, while the next might be a bee. Quite small. I'd like to do something like:

if date.size < (x, x) then

data.SetSize (y,y)

end

I've found SetScale, but nothing like SetSize...

Current code just pulling the preview:

self.objectSpinner = Spinner(objectOptions, 180, spinnerHeight, spinnerFont, spinner_atlas, spinner_images)        function self.objectSpinner:OnChanged(data)            this.working.objectPrefab = data            this:UpdateSelectedObject()            my_anim:SetScale(0.15,0.15,0.15) -- here everything is set to a specific scale, but Size if prefered
Here's a current screenshot by the way:
You can do this for images, but not for anims; anims don't really have a concept of how big they are, only their scale. (A scale of 1 is however big the artist made it; and its actual dimensions vary frame to frame depending on symbols, animation, etc.)

Perhaps you could have everything scale to the same value (so they are relative to eachother in-game), and a few special cases for things like Deerclops?

  • Developer

Quite frequently the answers to my obscure needs are "nope", so I don't expect a solution to the 'size' issue. Nor, a 'refresh' call which would keep each image from being plastered on top of the other over and over and over. (that's why I load the image box each time you load a new preview - to 'reset the stage' in a ham-handed way).

I'm not sure what you mean by plastered on top?I would anticipate that you need to remove the old image before creating a new one, something like this:
function ChangeTheImage(newatlas, newimage)  if self.object_image then    self:RemoveChild(self.object_image)  end    self.object_image = self:AddChild(Image(newatlas, newimage))end
Alternatively you could change the texture using image:SetTexture(atlas, texture).Basically what I'm getting at is, you kind of do need to "reset" things when you swap out the image, or reuse existing items.
  • Developer

Hello friends,lpsquiggle you're our new friend right?So I have a question you're a coder and what did you learn first?(Python or something like that?)Would be cool if you answer this question-estier

I first learned Actionscript 2 for Flash way back in the day, and then spent a lot of time with Actionscript 3. Even though I think Flash is kind of a beast, I'll always love Actionscript because it's so easy to draw things with it and share them with people via the Flash Player.Processing, Javascript, and Python were also involved in my learning to program (I'm self-taught), basically high-level languages with good drawing/visual processing.When I started doing this professionally I moved into more serious languages, C++ and C# and Java and about a billion others (every game studio uses something different!). I've lost count. :p

I definitely think these kinds of bugs should be posted in the bug tracker; they are bugs, and it's a good place to organize them. I'll have a review of the process to see what's going on.As to these two issues (werebeast, and pickables) I've comitted a fix that will be in the next release.Thanks!

Wade is usually very thorough in replying to basically every single bug report, even duplicate ones. But for some reason whenever a bug report talks about code, it goes ignored (or at least that was the case with those I've seen reported). Though the bug on the Pickable component had also been reported in a "human readable format" [thread=23611]a few days later[/thread], to which I also replied by linking to [MENTION=56977]squeek[/MENTION]'s report, and strangely it also did not receive a reply.Thank you for taking the time to look into those bugs and, above of all, to review the process. This is something I have a personal involvement in, since one of my first interactions with the game code (before going into modding) was, shortly after the Underground update, spotting and proposing fixes for the bugs that affected the stacking of perishables, which had also gone ignored like squeek's report. It was only after I made some "noise" on the matter within the thread for the release notes of It's Not a Rock that the issue received attention, being fixed in Strange New Powers.

I first learned Actionscript 2 for Flash way back in the day, and then spent a lot of time with Actionscript 3. Even though I think Flash is kind of a beast, I'll always love Actionscript because it's so easy to draw things with it and share them with people via the Flash Player.Processing, Javascript, and Python were also involved in my learning to program (I'm self-taught), basically high-level languages with good drawing/visual processing.When I started doing this professionally I moved into more serious languages, C++ and C# and Java and about a billion others (every game studio uses something different!). I've lost count. :p

It's interesting to get a glimpse on your programming background. Those are also languages I know (plus quite a few others), except for ActionScript, C# and Processing. I just can't find the will to care about proprietary languages (and I had never heard of Processing before you mentioned it). :PThe first language I learned was C, followed by Lua, Assembly (x86 and x86-64) and then C++ (and after that the rest). But my favorite one is Haskell, without a doubt. Edited by simplex
excluding Processing as well
  • Developer

@Ipsquiggle

On the current issue of character mods crashing, I faced it when running some tests on the [thread=26442]Link character mod[/thread]. It's happening whenever I try to exit to the main menu, which triggers a hard (engine level) crash (even after disabling everything in the mod other than the character itself). I used debug.sethook() at the end of mainfunctions.lua's SaveGame() to get some info on where it occurs (tracking every function call and every execution of a line of Lua code), and the output is the following, in the format "{file}:{line_number} {function_name}":

>>> scripts/saveindex.lua:286  SaveCurrent>>> scripts/screens/pausescreen.lua:42  cb>>> scripts/frontend.lua:122  Update>>> scripts/frontend.lua:123  Update>>> scripts/screen.lua:34  OnUpdate>>> scripts/frontend.lua:125  Update>>> scripts/update.lua:49>>> [C]  ProfilerPop>>> scripts/update.lua:50>>> scripts/update.lua:53>>> [C]  ProfilerPush>>> scripts/update.lua:54>>> scripts/emitters.lua:43  PostUpdate>>> scripts/mainfunctions.lua:338  IsHUDPaused>>> [C]  GetTimeScale>>> scripts/emitters.lua:44  PostUpdate>>> scripts/update.lua:55>>> [C]  ProfilerPop>>> scripts/update.lua:56
Immediately after that, the game crashes.

So it's happening right after update.lua's PostUpdate() returns. And the lack of the function name for the PostUpdate() call clearly shows it's being called directly by the engine (and since the call returns, the crash must happen in the C++ code following its call).

The code I used to do the hooking is this:

debug.sethook(function()        local info = debug.getinfo(2, 'Sln')        if info then                io.stderr:write(">>> ", tostring(info.short_src))                if info.currentline and info.currentline > 0 then                        io.stderr:write(":", info.currentline)                end                 if info.name then                        io.stderr:write("  ", info.name)                end                 io.stderr:write("\n")        else                   io.stderr:write(">>> NO INFO!!!")        endend, 'cl')
(this code will print duplicate lines whenever there's a Lua function call, which I erased manually)

This one took a while to track down... it was related to the dynamic loading business from last release. I have a fix in for the upcoming release. :)

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...