Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 94 95 [96] 97 98 ... 244

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

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1425 on: August 22, 2018, 02:39:33 pm »

Absolutely. blahblah() always has access to its containing environment regardless of where it's called from.
Note that in the example you gave, re-running functions.lua (e.g. if you ran it at the command prompt) would reset somevalue to 0 ("somevalue = somevalue or 0" would avoid that). script_environment() usually won't reset that, but it might if the script file is modified. run_script() is what the DFHack console actually uses to run Lua scripts, I think, so it should always reset that.

I was planning on just using somevalue as a static/parameter (C/Fortran) value so no functions would ever change it, but if I do decide to make it a changing value I'll make sure to keep in mind that it will reset under certain circumstances.

EDIT: Looking through the currently written scripts I see there is full-heal which can heal and resurrect units (and it seems regrow limbs and such). Are there any scripts that replicate the animation of units and unit corpse pieces? I am going over some of the stuff I wrote which allows for more complex resurrections and reanimations, but it would be nice to have other working examples to go off of.

EDIT2: Or other wound heal scripts that aren't quite so full? Particularly ones that heal but don't necessary regrow lost limbs.
« Last Edit: August 22, 2018, 06:05:26 pm by Roses »
Logged

fortunawhisk

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1426 on: August 22, 2018, 10:18:00 pm »

Hi, I'm trying to retrieve the default belief values for a civilization, but I'm having a hard time determining how to get to them.
I can see them with gm-editor here: "gui/gm-editor world.cultural_identities.all". Unfortunately, I can't seem to get LUA to recognize the same location, and all my attempts fail with "attempt to index a nil value".
I've seen Atkana's script on setting them, but the location used there doesn't seem to work either (df.cultural_identity.find(upers.cultural_identity).values[beliefId]).
Can anyone throw out a lua print statement that dumps out the contents of "world.cultural_identities.all[0].values"?
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1427 on: August 22, 2018, 10:26:43 pm »

EDIT: Looking through the currently written scripts I see there is full-heal which can heal and resurrect units (and it seems regrow limbs and such). Are there any scripts that replicate the animation of units and unit corpse pieces? I am going over some of the stuff I wrote which allows for more complex resurrections and reanimations, but it would be nice to have other working examples to go off of.

EDIT2: Or other wound heal scripts that aren't quite so full? Particularly ones that heal but don't necessary regrow lost limbs.
If you mean in DFHack, no. We almost never make duplicate copies of tools just to remove features from one copy. If you want to modify full-heal to take more options to skip certain steps (I think there are some already), feel free, and feel free to submit a pull request as well.

I can see them with gm-editor here: "gui/gm-editor world.cultural_identities.all". Unfortunately, I can't seem to get LUA to recognize the same location, and all my attempts fail with "attempt to index a nil value".
Can you specify where exactly you're using this and what you've attempted? If you're literally using "world.cultural_identities.all" in a Lua script ("Lua" isn't an acronym, by the way), that won't work - you'll need to replace "world" with "df.global.world". A few scripts, such as the Lua interpreter (run "lua") and gui/gm-editor search for undefined variables in other places, including fields in df.global (so the "df.global." part can be dropped), but in normal scripts that won't work.
Quote
I've seen Atkana's script on setting them, but the location used there doesn't seem to work either (df.cultural_identity.find(upers.cultural_identity).values[beliefId]).
That looks like it should work to me. What exactly is the issue? Obviously "upers" needs to be defined as well, and I'm not sure what it's supposed to be (it's not an English word, at least).

Minor nitpick, but that's also just an expression - there's no location in there.
Quote
Can anyone throw out a lua print statement that dumps out the contents of "world.cultural_identities.all[0].values"?
(In case you're unaware, printall() might produce more useful output - it's also available as the "~" prefix in the Lua interpreter.)
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.

Atkana

  • Bay Watcher
  • [CURIOUSBEAST]
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1428 on: August 23, 2018, 01:42:03 am »

Hi, I'm trying to retrieve the default belief values for a civilization, but I'm having a hard time determining how to get to them.
I can see them with gm-editor here: "gui/gm-editor world.cultural_identities.all". Unfortunately, I can't seem to get LUA to recognize the same location, and all my attempts fail with "attempt to index a nil value".
I've seen Atkana's script on setting them, but the location used there doesn't seem to work either (df.cultural_identity.find(upers.cultural_identity).values[beliefId]).
Can anyone throw out a lua print statement that dumps out the contents of "world.cultural_identities.all[0].values"?

Code: [Select]
for k, v in pairs(df.global.world.cultural_identities.all[0].values) do
print(k .. " = " .. v)
end

Or yeah, just use printall(df.global.world.cultural_identities.all[0].values). Plus I think you can use df.cultural_identity.find(0).values as a slightly shorter way of writing out df.global.world.cultural_identities.all[0].values... I never really did learn how the find()s actually worked :b

Quote
I've seen Atkana's script on setting them, but the location used there doesn't seem to work either (df.cultural_identity.find(upers.cultural_identity).values[beliefId]).
That looks like it should work to me. What exactly is the issue? Obviously "upers" needs to be defined as well, and I'm not sure what it's supposed to be (it's not an English word, at least).

Minor nitpick, but that's also just an expression - there's no location in there.
I used upers as a shorthand for unit personality because if I'm going to be too lazy to type out unit.status.current_soul.personality every time, I figured I might as well go full shorthand :P

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1429 on: August 23, 2018, 01:45:22 am »

find() gets the object with that particular ID, which (esp. in the case of historical figures) may not line up with the array placement.

fortunawhisk

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1430 on: August 23, 2018, 01:10:48 pm »

Excellent, exactly what I needed. Thanks!
Logged

BassDwarf

  • Escaped Lunatic
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1431 on: August 30, 2018, 04:51:38 pm »

Unsure if there is a specific board for this or thread but a suggestion for a utility (which would most likely use DFHack), something similar to the RCT2 thoughts tab.
https://vignette.wikia.nocookie.net/rct/images/2/26/Rct-vandalism2.png/revision/latest?cb=20140121104704

I know that recently someone published the Sentient Dwarf Fortress/It was inevitable bot on twitter, but having something like that as a utility/window would be interesting, especially if it could tally up common thoughts like said RCT thoughts monitor, so the player could know the common issues of the fort and avoid mass negative thoughts.
Logged

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1432 on: August 30, 2018, 04:56:30 pm »

I made something like that in 0.34.11, before I knew how to write UIs (or, indeed, before I was any good at programming at all), but it only showed the most common. An in-game UI for this wouldn't be too difficult.

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1433 on: August 31, 2018, 02:19:17 am »

"I want to get off Mr. Urist's Wild Ride!"
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1434 on: September 02, 2018, 12:07:33 am »

Code: [Select]
function flymode()
local flyuser = df.global.world.units.active[0]
flyuser.enemy.unk_4406_1[4]=true -- dont know what these do
flyuser.enemy.unk_4406_1[10]=true --dont know what these do
flyuser.enemy.unk_4406_1[19]=true --this unlocks flymode
end
ok so broke down and figured out how to just Fly with out needing flier, so uhh now I guess the whole turning on ghostly flag being bugged is fixed with this.
also bonus silly things with testing with flying is the drag script causes the draggee to float up 1 tile if you drag them up there.
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

Atomic Chicken

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1435 on: September 02, 2018, 02:43:25 am »

Code: [Select]
function flymode()
local flyuser = df.global.world.units.active[0]
flyuser.enemy.unk_4406_1[4]=true -- dont know what these do
flyuser.enemy.unk_4406_1[10]=true --dont know what these do
flyuser.enemy.unk_4406_1[19]=true --this unlocks flymode
end
ok so broke down and figured out how to just Fly with out needing flier, so uhh now I guess the whole turning on ghostly flag being bugged is fixed with this.
also bonus silly things with testing with flying is the drag script causes the draggee to float up 1 tile if you drag them up there.

It's just become apparent to me that the bit array in
Code: [Select]
unit.enemy.unk_4406_1 corresponds to the creature token flags for the unit's caste, as found in
Code: [Select]
df.creature_raw.find(unit.race).caste[unit.caste].flags
Assuming this is correct, in Rumrusher's segment above:
flyuser.enemy.unk_4406_1[4] would be 'PATTERNFLIER'
flyuser.enemy.unk_4406_1[10] would be 'SWIMS_LEARNED'
flyuser.enemy.unk_4406_1[19] would be 'FLIER'

So I suppose it's possible to modify and set creature tokens for a single unit without affecting the entire race (though I imagine they'd be reset upon reloading).
« Last Edit: September 02, 2018, 02:45:40 am by Atomic Chicken »
Logged
As mentioned in the previous turn, the most exciting field of battle this year will be in the Arstotzkan capitol, with plenty of close-quarter fighting and siege warfare.  Arstotzka, accordingly, spent their design phase developing a high-altitude tactical bomber. 

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1436 on: September 02, 2018, 03:22:29 am »

I tested every unit on a map with this one-liner to corroborate this:

Code: [Select]
for _,unit in ipairs(df.global.world.units.all) do for k,v in ipairs(df.creature_raw.find(unit.race).caste[unit.caste].flags) do if unit.enemy.unk_4406_1[k]~=v then print(unit.id,k,v) end end end
Nothing printed at all, so that checks out.

I also checked if it saves with the world; it does not.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1437 on: September 02, 2018, 06:18:30 am »

I tested every unit on a map with this one-liner to corroborate this:

Code: [Select]
for _,unit in ipairs(df.global.world.units.all) do for k,v in ipairs(df.creature_raw.find(unit.race).caste[unit.caste].flags) do if unit.enemy.unk_4406_1[k]~=v then print(unit.id,k,v) end end end
Nothing printed at all, so that checks out.

I also checked if it saves with the world; it does not.
welp I just saved in the air with a giant wagon train, pulling off some neverending story nonsense.
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

taleden

  • Bay Watcher
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1438 on: September 03, 2018, 08:30:12 pm »

Is there any way for dfhack to make a "meeting zone" active for only animals or only dwarves?

The tendency for animals to try to path to a meeting zone can be a huge pain, in part because (for example) dozens of turkey chicks will escape the coop and run to the dining room the moment a dwarf opens the door, and in part because of the bug that makes animals try to path through pet-forbidden doors all the time regardless, killing FPS. So it'd be nice to just make pastures also be meeting zones to help encourage the occupants to want to stay there, but without having all the dwarves also want to hang out with the animals.
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: DFHack 0.44.12-r1
« Reply #1439 on: September 04, 2018, 05:10:23 am »

Don't know, but as a workaround, you can make your taverns zones be inactive/non-meeting zones immediatelly after designating the zone as tavern - dwarves will still use it as location even if the name is invisible when it isn't marked as meeting one, but animals will not path to it.

(You might need to add a way for dwarves to go there though if it turns out they won't (haven't done prolonged testing); station orders makes the location 'default idle area' even once it is turned off, and bedrooms, drink/food stockpiles or inactive barracks could maybe work as well.)
Pages: 1 ... 94 95 [96] 97 98 ... 244