Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 203 204 [205] 206 207 ... 244

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

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.47.05-r2
« Reply #3060 on: August 30, 2021, 06:41:55 pm »

Is it starting at address 14E380h, then offsetting by rdx (7FF676350000h, resulting in byte_7FF67649E388 again,) then adding rax to that and moving the value there into eax? (With that value being an index for off_7FF67649E380?) Are my assumptions correct?
Yes, that's exactly what it's doing - in 64-bit binaries, VC++ implements switch() statement jump tables using 32-bit relative offsets for everything, probably because it makes the code smaller.
Why wouldn't it be something like "movzx eax, ds:(byte_7FF67649E388)[rax]" instead?
Because that would presumably require using a 64-bit absolute address (with fixup), and I'm not sure whether that's actually possible in amd64 assembly.
« Last Edit: August 30, 2021, 06:53:43 pm by Quietust »
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.47.05-r3
« Reply #3061 on: September 04, 2021, 02:11:34 pm »

New release! https://github.com/DFHack/dfhack/releases/tag/0.47.05-r3

Several new tools in this one, including dig-now and build-now. Try them out and let us know how they work!
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.

ldog

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3062 on: September 07, 2021, 10:51:43 am »

Does anyone know a way to make a pet not a pet?
I tried poking through gm-edit but I can't find anything obvious.
I absolutely despise livestock as pets, normally I teleport them into magma, but I'm looking for a "kinder, gentler" approach (and more meat).
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3063 on: September 08, 2021, 03:31:55 am »

Does anyone know a way to make a pet not a pet?
I tried poking through gm-edit but I can't find anything obvious.
I absolutely despise livestock as pets, normally I teleport them into magma, but I'm looking for a "kinder, gentler" approach (and more meat).
you could just force the slaughtering of the pet with dfhack by messing with the creature's unit flags to set to slaughter if you're already tossing them into magma.

Code: [Select]
function getxyz() -- this will return pointers x,y and z coordinates.
local x=df.global.cursor.x
local y=df.global.cursor.y
local z=df.global.cursor.z
return x,y,z -- return the coords
end

function getCreatureAtPos(x,y,z) -- gets the creature index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.units.all -- load all creatures
for i = 0, #vector-1 do -- look into all creatures offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end
--print("Creature not found!")
return nil

end

function Butcherunit(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit==nil then
error("Failed to Heal unit. Unit not selected/valid")
end
unit.flags2.slaughter = true
unit.flags1.tame = true

though this set of functions if you covert them into a lua script will require looking at the pet to target them for butchery also probably might also lead to butchery of say anyone you aim this at like sapient folks.
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

ldog

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3064 on: September 08, 2021, 07:31:42 am »

Does anyone know a way to make a pet not a pet?
I tried poking through gm-edit but I can't find anything obvious.
I absolutely despise livestock as pets, normally I teleport them into magma, but I'm looking for a "kinder, gentler" approach (and more meat).
you could just force the slaughtering of the pet with dfhack by messing with the creature's unit flags to set to slaughter if you're already tossing them into magma.

Code: [Select]
function getxyz() -- this will return pointers x,y and z coordinates.
local x=df.global.cursor.x
local y=df.global.cursor.y
local z=df.global.cursor.z
return x,y,z -- return the coords
end

function getCreatureAtPos(x,y,z) -- gets the creature index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.units.all -- load all creatures
for i = 0, #vector-1 do -- look into all creatures offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end
--print("Creature not found!")
return nil

end

function Butcherunit(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit==nil then
error("Failed to Heal unit. Unit not selected/valid")
end
unit.flags2.slaughter = true
unit.flags1.tame = true
though this set of functions if you covert them into a lua script will require looking at the pet to target them for butchery

That works! Thanks!
also probably might also lead to butchery of say anyone you aim this at like sapient folks.

Added bonus!
« Last Edit: September 08, 2021, 07:33:23 am by ldog »
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.

ldog

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3065 on: September 08, 2021, 11:27:52 am »

Setting the slaughter flag isn't enough :(
I've tried removing important historical figure too. No go. Need to find the pet flag and remove it.
Aha! I found it, relationship_ids, pet, set to -1

« Last Edit: September 08, 2021, 11:34:09 am by ldog »
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.47.05-r3
« Reply #3066 on: September 08, 2021, 12:56:18 pm »

Setting the slaughter flag isn't enough :(
I've tried removing important historical figure too. No go. Need to find the pet flag and remove it.
Aha! I found it, relationship_ids, pet, set to -1
You might also want to check for `histfig_hf_link_pet_ownerst` records and remove them, otherwise the owner is likely to get an unhappy thought about losing a pet.
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.

ldog

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3067 on: September 08, 2021, 01:46:56 pm »

Setting the slaughter flag isn't enough :(
I've tried removing important historical figure too. No go. Need to find the pet flag and remove it.
Aha! I found it, relationship_ids, pet, set to -1
You might also want to check for `histfig_hf_link_pet_ownerst` records and remove them, otherwise the owner is likely to get an unhappy thought about losing a pet.

Thanks!
Logged
Quote from: Dirst
For example, if you wanted to check if a unit was eligible to be a politician or a car salesman, you'd first want to verify that there is no soul present...

Quote from: gchristopher
The more appropriate question becomes, are they awesome and dwarven enough.

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3068 on: September 13, 2021, 07:35:00 pm »

Figured it's worth posting this here:

DF has a function for getting local time, which it uses in adventure mode to calculate tile temperature_2 and when sleeping until dawn (which infers it's used for the position of the sun as well.)
If I've got it correct, the function is this:
Code: [Select]
int32_t getLocalTime(int16_t region_x) //returns local time in hundredths of an hour
{
if (gametype == DWARF_ARENA || gametype == ADVENTURER_ARENA)
{
return world->arena_settings->time;
}
else
{
int32_t center_displace = region_x - world->world_data->world_width / 2;
return ( (center_displace + cur_year_tick%10 + cur_season_tick*10 + 1200) % 1200 )*2
}
}

If my math is correct, then the time difference from one side of a region to another is:
Code: [Select]
Pocket (17): 0.32 hours
Smaller (33): 0.64 hours
Small (65): 1.28 hours
Medium (129): 2.56 hours
Large (257): 5.12 hours

Any implications from this?
« Last Edit: September 13, 2021, 07:36:35 pm by Bumber »
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)?

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3069 on: October 02, 2021, 12:13:57 pm »

This does allow us to estimate the size of the DF world
Logged

Ziusudra

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3070 on: October 02, 2021, 06:40:02 pm »

Oh yeah. So, if a large DF "world" is 481km across and that is 5.12/24ths of a spherical globe that would give a equatorial circumference of 2,254.6875km - compared to the 40,075.017km of Earth. And that should be equatorial relative radiuses of 358.845km and 6,378.1km.
Logged
Ironblood didn't use an axe because he needed it. He used it to be kind. And right now he wasn't being kind.

Clément

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3071 on: October 03, 2021, 05:38:03 am »

Is DF world really spherical? Or is it cylindrical?
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3072 on: October 03, 2021, 12:25:13 pm »

DF's world is currently rectangular, although it could be considered to be a rectangular cut from a cylindrical world that has a considerably larger diameter than height. Past discussions indicates that Toady might eventually make the world wrap around horizontally (as a cylinder) with or without vertically (so leaving at the south edge would bring you to the north one), but spheres (and spheroids, lumpy potatoes, etc.) aren't on the table due to all the issues with coordinates not lining up and/or being of differing lengths.
Logged

Ziusudra

  • Bay Watcher
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3073 on: October 05, 2021, 12:03:11 am »

The problem with a cylindrical world is that you'd need some other mechanism to explain seasons and cold "pole(s)" (for those worlds that hav them), as both of those and differences in local time are presumably caused by curvature of the surface. There's already plenty of unnatural/magical things in DF, though.

Hmm, I would guess that DF worlds that do hav poles don't actually model having different seasons at opposite ends - but I also wouldn't be completely surprised if they do. If not, then that some other mechanism is already needed. Edit: Axial tilt of a cylindrical world alone could explain having only a single world-wide season at a time, but not the existence of poles.

(BTW, my math above works for either spherical or cylindrical.)
« Last Edit: October 07, 2021, 01:36:52 am by Ziusudra »
Logged
Ironblood didn't use an axe because he needed it. He used it to be kind. And right now he wasn't being kind.

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: DFHack 0.47.05-r3
« Reply #3074 on: October 05, 2021, 03:28:32 am »

Reverse engineering the DF announcement/report code, I noticed it uses '&' as an escape character. "&r" is used to split up an announcement, "&&" results in "&", and any other combination of '&' results in the next char being ignored.

I tried nicknaming a dwarf "&r&r&r&r", and it results in several newlines in announcements. That was with dfhack, but I don't have vanilla handy to test. If it's solely a result of dfhack, then the input needs to be sanitized as & -> &&, and the allowed length checked against that.

Edit: Looks like it's a vanilla bug. Toady can handle it in the announcement code without it affecting nickname length.
« Last Edit: October 05, 2021, 08:43:23 pm by Bumber »
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)?
Pages: 1 ... 203 204 [205] 206 207 ... 244