Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 116 117 [118] 119 120 ... 244

Author Topic: DFHack 50.14-r1.1  (Read 891710 times)

Will_Tuna

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1755 on: May 14, 2019, 09:09:29 am »

Q: Can you make a Guest that is 'ready to leave' a permanent resident of the fortress? maybe with tweak makeown?

in the description of makeown, it says to "select the creature", is that using 'k' or 'v'?

thanks for the help and thanks for all the work on dfhack!

PS: It is a wild boar woman fighter
Logged
True story: In the year 2007: Surinder Singh Bajwa, the Deputy Mayor of Delhi, India, was warding off several Rhesus Macaque monkeys at his home and fell from a first-floor balcony, suffering serious head injuries. He later died from his injuries.

Prismatic

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1756 on: May 14, 2019, 10:14:24 am »

Basic learner's question. Looking through lua script examples from DFHack, I'm confused by this point: when should a global variable be used instead of a local variable?
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1757 on: May 14, 2019, 11:15:39 am »

@Prismatic: Almost never.
Most cases of global variables being used are probably bugs. A global variable clutters the Lua global variable space. The case where you MIGHT consider using a global variable is when you want to retain data between script invocations but don't want it to survive DF restart. Also note that you'd probably want to use a very specific variable name for that case to avoid two scripts using the same one accidentally. Writing/Reading to/from a file is a way to store data in way to survive restarts. There's also a DFHack method to store data in the DF save game, but I've never used it. There's also a way to start a script that makes callbacks either at trigger points or at specified intervals, allowing you to keep the local data inside the script.
Logged

Pvt. Pirate

  • Bay Watcher
  • Dabbling Linux User
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1758 on: May 14, 2019, 11:22:45 am »

added link to the working mousequery.plug.so https://www.dropbox.com/s/v3gjhco764p28uw/mousequery.plug.so?dl=0
could not find any .dll or whatever, but that might be because it's in the linuxLNP
Logged
"dwarves are by definition alcohol powered parasitic beards, which will cling to small caveadapt humanoids." (Chaia)

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.44.12-r2
« Reply #1759 on: May 14, 2019, 05:57:33 pm »

added link to the working mousequery.plug.so https://www.dropbox.com/s/v3gjhco764p28uw/mousequery.plug.so?dl=0
could not find any .dll or whatever, but that might be because it's in the linuxLNP
When lethosor asked for the dll/so/dylib, he meant that you should provide the one that matches your platform - DFHack uses .dll files for plugins on Windows, .so files on Linux, and .dylib files on MacOS.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1760 on: May 15, 2019, 07:46:47 pm »

Pvt Pirate: sorry, I should have been nicer about that.
e) Mephs lite + curses 800x600 font // Phoebus + curses 800x600 font
f) TWBT always on testing turning it off, but i think i remember it not changing a thing.
I'd appreciate it if you could test without TWBT and test with just the 800x600 font (i.e. set everything to use the 800x600 font, or maybe just all the same font - no separate text/map tiles). The potential issue with square tiles is that they take up more space than rectangular tiles, so fewer of them can fit on the screen. This could cause issues because the "20th tile from the top" could be close to the bottom of the screen in the map view, but not at all close in the menu view, if that makes sense.
It's also possible that TWBT is interfering with mousequery even when the tilesets are all the same size, which is why I suggest disabling it entirely too.

When lethosor asked for the dll/so/dylib, he meant that you should provide the one that matches your platform - DFHack uses .dll files for plugins on Windows, .so files on Linux, and .dylib files on MacOS.
Yup. I couldn't remember which platform you were using, so I included all the possible extensions.


Basic learner's question. Looking through lua script examples from DFHack, I'm confused by this point: when should a global variable be used instead of a local variable?
By "local variables" do you mean ones declared inside a function, or ones declared with the "local" keyword anywhere (including outside a function)?
Anything declared without the "local" keyword ends up in the global namespace for that script, even if it's only declared inside functions. This can cause all sorts of fun bugs, so you should always use the "local" keyword when doing that (unless you really want a global, see below). Globals also persist across runs of the same script, which allows them to store persistent state in memory until DF exits. They can also be accessed by other scripts if needed.

Anything with the "local" keyword is limited to the scope where it's declared, or any nested scopes (let me know if that doesn't make sense and I can give some examples). If it's in the main body of a script (outside of any function), it won't persist across runs of the script, unlike globals, and it can't be accessed by other scripts (it's essentially destroyed after the script finishes running, just like any local variable inside a function).

@Prismatic: Almost never.
Most cases of global variables being used are probably bugs. A global variable clutters the Lua global variable space. <snip - this was a good point, see above>. Also note that you'd probably want to use a very specific variable name for that case to avoid two scripts using the same one accidentally.
No, each script has its own completely separate environment where its globals live. Globals in one script are (almost) entirely separate from those in another. That's why reqscript() and dfhack.script_environment() exist. Granted, there are a few special ones that are shared between scripts (df, dfhack, and the built-in functions, and maybe something else I'm forgetting), but scripts cannot create their own globals that are shared across all scripts.

Granted, globals are generally not a good idea, but when you need them, you don't have to give them unique names to prevent clashes with other scripts.


Q: Can you make a Guest that is 'ready to leave' a permanent resident of the fortress? maybe with tweak makeown?

in the description of makeown, it says to "select the creature", is that using 'k' or 'v'?

thanks for the help and thanks for all the work on dfhack!

PS: It is a wild boar woman fighter
"tweak makeown" predates visitors/guests by many years, so I wouldn't expect it to work, although I don't think I've tried. It's definitely something I've wanted to work, though.
As for how to use it: it uses DFHack's standard unit-selection API, which allows selecting a unit with 'v', 'k' (although you also have to make sure the unit is actually selected in the sidebar for this to work), and pretty much anywhere else you can select a unit in-game, like the 'u' menu. Most things that ask you for a unit, item, building, etc. should use a standard API for it. If you find a tool that doesn't allow you to select a unit/building/whatever in a place where other tools do allow it, that's probably a bug, so feel free to report it.
« Last Edit: May 15, 2019, 09:36:15 pm by lethosor »
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Pvt. Pirate

  • Bay Watcher
  • Dabbling Linux User
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1761 on: May 16, 2019, 02:55:53 am »

Pvt Pirate: sorry, I should have been nicer about that.
e) Mephs lite + curses 800x600 font // Phoebus + curses 800x600 font
f) TWBT always on testing turning it off, but i think i remember it not changing a thing.
I'd appreciate it if you could test without TWBT and test with just the 800x600 font (i.e. set everything to use the 800x600 font, or maybe just all the same font - no separate text/map tiles). The potential issue with square tiles is that they take up more space than rectangular tiles, so fewer of them can fit on the screen. This could cause issues because the "20th tile from the top" could be close to the bottom of the screen in the map view, but not at all close in the menu view, if that makes sense.
It's also possible that TWBT is interfering with mousequery even when the tilesets are all the same size, which is why I suggest disabling it entirely too.
so with render mode "standard" and curses 800x600 it works.
now how do i get it working with TWBT and Meph's?
i mean if it works perfectly fine with a 16x16 set, why shouldn't we be able to make it work with a 32x32 too. (edit: doesn't work with twbt and 16x16 either)
is it necessary to define the scrolling border as the 20th tile or could one adjust that number to fit the tileset?
« Last Edit: May 16, 2019, 03:06:26 am by Pvt. Pirate »
Logged
"dwarves are by definition alcohol powered parasitic beards, which will cling to small caveadapt humanoids." (Chaia)

DerMeister

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1762 on: May 16, 2019, 02:58:59 pm »

I need know size of chain.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1763 on: May 16, 2019, 06:32:35 pm »

on the subject of getting guest to join the fort, it's possible with setting their civ and group ids to match the fort civ, usually another means is to retire before they leave so they permanently stay with the site on unretire, then mess with their civ and group ids so they join the fort proper mostly with gui/gm-editor.
Logged
I thought I would I had never hear my daughter's escapades from some boy...
DAMN YOU RUMRUSHER!!!!!!!!
"body swapping and YOU!"
Adventure in baby making!Adv Homes

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1764 on: May 16, 2019, 10:04:22 pm »

so with render mode "standard" and curses 800x600 it works.
Ok, good to know! I ought to be able to figure out why it's not working now.
Quote
now how do i get it working with TWBT and Meph's?
i mean if it works perfectly fine with a 16x16 set, why shouldn't we be able to make it work with a 32x32 too. (edit: doesn't work with twbt and 16x16 either)
is it necessary to define the scrolling border as the 20th tile or could one adjust that number to fit the tileset?
The "20" was just an example of how the number of rows in different parts of the screen can be different with TWBT; that number doesn't actually appear anywhere in mousequery.

Edit: I think I see a reason why it wouldn't behave properly with TWBT enabled. I want to make sure my fix doesn't break non-TWBT installs; then I'll put up a plugin for you to try.
« Last Edit: May 16, 2019, 10:17:51 pm by lethosor »
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1765 on: May 16, 2019, 11:16:40 pm »

You can grab a build of mousequery from my PR at https://files.dfhack.org/pr1440-1/dfhack-0.44.12-r2-pr1440-1-Linux-64-gcc-7/hack/plugins/ (for 64-bit Linux, GCC 7). Let me know if it fixes the issue.
If anyone wants a different build I can put it up there too.
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

Pvt. Pirate

  • Bay Watcher
  • Dabbling Linux User
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1766 on: May 17, 2019, 01:32:27 am »

You can grab a build of mousequery from my PR at https://files.dfhack.org/pr1440-1/dfhack-0.44.12-r2-pr1440-1-Linux-64-gcc-7/hack/plugins/ (for 64-bit Linux, GCC 7). Let me know if it fixes the issue.
If anyone wants a different build I can put it up there too.
thanks :) trying it.

IT WOOORKS! :D

Thank you again :)
« Last Edit: May 17, 2019, 01:46:54 am by Pvt. Pirate »
Logged
"dwarves are by definition alcohol powered parasitic beards, which will cling to small caveadapt humanoids." (Chaia)

DerMeister

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1767 on: May 17, 2019, 02:07:06 am »

I NEED KNOW SIZE OF CHAIN!
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1768 on: May 17, 2019, 07:35:47 am »


IT WOOORKS! :D
Would you mind testing with smaller map tiles than text tiles (zooming out in the map view should do the trick). I'm not sure how it'll handle that case.

I NEED KNOW SIZE OF CHAIN!
I'm not quite sure what you're looking for or why you need it. Can you explain what you need it for?

My understanding is that sizes of objects aren't necessarily fixed, although maybe chains are all the same size. If they have a size, it should be tracked somewhere, so looking for it through DFHack should be possible (I doubt anyone can tell you off the top of their head).
Logged
DFHack - Dwarf Manipulator (Lua) - DF Wiki talk

There was a typo in the siegers' campfire code. When the fires went out, so did the game.

DerMeister

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r2
« Reply #1769 on: May 17, 2019, 09:00:56 am »


IT WOOORKS! :D
Would you mind testing with smaller map tiles than text tiles (zooming out in the map view should do the trick). I'm not sure how it'll handle that case.

I NEED KNOW SIZE OF CHAIN!
I'm not quite sure what you're looking for or why you need it. Can you explain what you need it for?

My understanding is that sizes of objects aren't necessarily fixed, although maybe chains are all the same size. If they have a size, it should be tracked somewhere, so looking for it through DFHack should be possible (I doubt anyone can tell you off the top of their head).
I need chain size for weapon made from one trap component and one chain. I know trap component size, but not know chain size.
Logged
Pages: 1 ... 116 117 [118] 119 120 ... 244