Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 237 238 [239] 240 241 ... 243

Author Topic: DFHack 50.13-r2.1  (Read 824397 times)

Tachytaenius

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3570 on: October 31, 2023, 05:13:53 pm »

Custom tokens - I see that custom tokens are now supported by DFHack, which is very nice. I had previously done this using curly brackets and parsing the raws when the game was started (see examples below). Looking through the custom-raw-tokens.lua code it seem that multi-line tokens aren't a thing though, is this correct? No problem if it is, I can just change my stuff to be a single line(s) as needed.

Hi, yea, custom-raw-tokens' dev (wolfboyft) here. I'm glad you like it! It's been a while since I made it, I don't really remember the reasonings behind everything, but yeah, it does indeed only support single line tokens, and only once in an instance of item subtype or whatever. It's just a search for the first instance of a token, returning the token's extra info. It's basically just for simple key:value(s) stuff, not working with/like the raw parsing state machine, like vanilla tokens often do. It's not super gorgeous in how it does it either, in that multiple instances of a tag don't raise errors (iirc), etc. Multi-line tokens would be pretty cool, though. I can't think off the top of my head how they would work, but I've forgotten a lot so...

Glad to see some interest! Good luck with your projects.
« Last Edit: October 31, 2023, 05:15:28 pm by Tachytaenius »
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3571 on: October 31, 2023, 06:59:27 pm »

<sniped>

Thanks, that all sounds like it's fairly similar to the old system, just moved around a little. Should make my plans much easier.

Custom tokens - I see that custom tokens are now supported by DFHack, which is very nice. I had previously done this using curly brackets and parsing the raws when the game was started (see examples below). Looking through the custom-raw-tokens.lua code it seem that multi-line tokens aren't a thing though, is this correct? No problem if it is, I can just change my stuff to be a single line(s) as needed.

Hi, yea, custom-raw-tokens' dev (wolfboyft) here. I'm glad you like it! It's been a while since I made it, I don't really remember the reasonings behind everything, but yeah, it does indeed only support single line tokens, and only once in an instance of item subtype or whatever. It's just a search for the first instance of a token, returning the token's extra info. It's basically just for simple key:value(s) stuff, not working with/like the raw parsing state machine, like vanilla tokens often do. It's not super gorgeous in how it does it either, in that multiple instances of a tag don't raise errors (iirc), etc. Multi-line tokens would be pretty cool, though. I can't think off the top of my head how they would work, but I've forgotten a lot so...

Glad to see some interest! Good luck with your projects.

Hmm, only allowing a single use of a token per raw and it just being simple key:value means it probably won't work for my intentions. I'll have to see what I can do. I'd rather not go back to using the curly bracket method, but it might be the simplest method. I'll have to think about it some more.
Logged

myk

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3572 on: November 01, 2023, 02:25:52 pm »

Extending the custom-raw-tokens functionality to support your use case is likely possible too. If you need it, others might as well.
Logged

Roses

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3573 on: November 01, 2023, 09:29:14 pm »

Extending the custom-raw-tokens functionality to support your use case is likely possible too. If you need it, others might as well.

Yeah, it's something I am looking into as well. Reading through the code I think it would be possible to extend it to encompass my use case, but I've gotta think more on what that would look like.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 50.11-r2
« Reply #3574 on: November 04, 2023, 09:42:31 am »

ok so it seems like I forgot to dump
this cage unit script... though I guess it seem to have a weird quirk with non-historical figures where it just also selects an artifact slab.
so it's mostly stable-ish but probably save before using it.


Code: ("cage-unit.lua") [Select]
local dlg=require("gui.dialogs")
--script that selects a unit from the active unit list and shove them in the currently selected cage
--for nameless units probably nickname them to make it easier to pick them out of the list
--might crash and or try to shove an artifact item in the list if you mess with non-historical figure units
function deitysummoning()
local Ark={}
for k,v in pairs(df.global.world.units.active) do
BoaName=dfhack.TranslateName(v.name)
if v.flags1.inactive==false then
table.insert (Ark,{dfhack.TranslateName(v.name).." "..v.name.nickname ..df.global.world.raws.creatures.all[v.race].creature_id,nil,v})

end
end
local f=function(Name,C)
  shove(C[3])
end
dlg.showListPrompt("unit list","Select a unit for shoving into a cage",COLOR_WHITE,Ark,f)
end

function shove(unit)
for ko,vo in pairs(df.global.world.buildings.other.IN_PLAY) do
if vo.id==df.global.game.main_interface.view_sheets.viewing_bldid then
vo.assigned_units:insert("#",unit.id)
end
end

end


deitysummoning()


so for folks who want to cage trap any visitors that shows up and or wildlife with out needing to go through the cage trap set up.


edit: crud uhh I need more space for this next post
so  uhh finish working on a necromancy in fort mode script and a bunch of gui side scripts that mess with that.



Code: ("necrobook.lua") [Select]
--this is a gui warmist spellbook modification to house a bunch of Curse tomb modification scripts/rumpack/DisTomb
 -- there one spell the create tomb cursor one that you want to do first or the other spell scripts wouldn't work
 -- the other spells are used for editing the curse tomb you selected if you make more uhh hope you remember which triggering point is which.
local dlg=require("gui.dialogs")

function getItemAtPos(x,y,z) -- gets the item index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.items.all -- load all items
for i = 0, #vector-1 do -- look into all items 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  and df.item_corpsest:is_instance(vector[i]) or cx==x and cy==y and cz==z and df.item_corpsepiecest:is_instance(vector[i]) then --compare them
return vector[i] --return index
end
end
--print("item not found!")
return nil

end


function Tomb2()
local Ark2={}
for k,v in pairs(df.global.world.cursed_tombs) do
--BoaName=dfhack.TranslateName(v.name)
table.insert (Ark2,{k.." "..k,nil,v})
--end
end
local f=function(Name,C)
  Tombmaker5(C[3])
end
dlg.showListPrompt("Tomb list","Select a tomb to start the next part",COLOR_WHITE,Ark2,f)
end
function Tomb3()
local Ark2={}
for k,v in pairs(df.global.world.cursed_tombs) do
--BoaName=dfhack.TranslateName(v.name)
table.insert (Ark2,{k.." "..k,nil,v})
--end
end
local f=function(Name,C)
  Tombmaker2(C[3])
end
dlg.showListPrompt("Tomb list","Select a tomb to start the next part",COLOR_WHITE,Ark2,f)
end
function Tomb3a()
local Ark2={}
for k,v in pairs(df.global.world.cursed_tombs) do
--BoaName=dfhack.TranslateName(v.name)
table.insert (Ark2,{k.." "..k,nil,v})
--end
end
local f=function(Name,C)
  CorpsePoint(C[3])
end
dlg.showListPrompt("Tomb list","Select a tomb to start the next part",COLOR_WHITE,Ark2,f)
end
function Tomb4()
local Ark2={}
for k,v in pairs(df.global.world.cursed_tombs) do
--BoaName=dfhack.TranslateName(v.name)
table.insert (Ark2,{k.." "..k,nil,v})
--end
end
local f=function(Name,C)
  Tombfinder(C[3])
end
dlg.showListPrompt("Tomb list","Select a tomb to start the next part",COLOR_WHITE,Ark2,f)
end
function Tomb5()
local Ark2={}
for k,v in pairs(df.global.world.cursed_tombs) do
--BoaName=dfhack.TranslateName(v.name)
table.insert (Ark2,{k.." "..k,nil,v})
--end
end
local f=function(Name,C)
  Tombmove(C[3])
end
dlg.showListPrompt("Tomb list","Select a tomb to start the next part",COLOR_WHITE,Ark2,f)
end

function Tombmaker2(e)
local Ark2={}
for k,v in pairs(df.global.world.items.other.IN_PLAY) do
    if df.item_corpsest:is_instance(v) or df.item_corpsepiecest:is_instance(v) then -- checked_item.flags.in_building then
--if v.unit_id=nil then else
--if v.hist_figure_id=nil then end

for k2,v2 in pairs(df.global.world.units.active) do
if v.unit_id==v2.id and v2.flags1.inactive==true then
BoaName=dfhack.TranslateName(v2.name)
table.insert (Ark2,{dfhack.TranslateName(v2.name).." "..v2.name.nickname,nil,v.id})
end
end
end
end
local f=function(Name,corpse)
e.coffin_skeletons:insert("#",corpse[3])
end
dlg.showListPrompt("Corpse list","Select a body to add to the cursed tomb",COLOR_WHITE,Ark2,f)
end


function Tombfinder(e)
e.triggered=false
end

function Tombmaker5(e)
local Ark2={}
for k1,v1 in pairs(df.global.world.raws.interactions) do
for k,v in pairs(v1.effects) do
    --if df.interaction_effect_animatest:is_instance(v.effects) or df.interaction_effect_resurrectst:is_instance(v.effects) then -- checked_item.flags.in_building then
    if df.interaction_effect_animatest:is_instance(v) or df.interaction_effect_resurrectst:is_instance(v) then -- checked_item.flags.in_building then

table.insert (Ark2,{v1.name.." "..v1.id,nil,v1.id})
end
end

end
local f=function(Name,C)
e.disturbance=C[3]
end
dlg.showListPrompt("spell list","Select a interaction for shoving into a tomb",COLOR_WHITE,Ark2,f)
end

function Tombmove(e)
e.coffin_pos.x=df.global.cursor.x
e.coffin_pos.y=df.global.cursor.y
e.coffin_pos.z=df.global.cursor.z
local v1=df.global.cursor.x-1
local v2=df.global.cursor.y-1
local v3=df.global.cursor.x+1
local v4=df.global.cursor.y+1
local v5=df.global.cursor.z

e.trigger_regions[0].x_min=v1
e.trigger_regions[0].y_min=v2
e.trigger_regions[0].z_min=v5
e.trigger_regions[0].x_max=v3
e.trigger_regions[0].y_max=v4
e.trigger_regions[0].z_max=v5


end


function SpellSeal()

function Tombmaker(v1,v2,v3,v4,v5,corpse,necro)
Mum=df.global.world.cursed_tombs
Mum:insert("#",{new=true,triggered=false,disturbance=necro,site_id=df.global.plotinfo.site_id})
local clu2=Mum[#Mum-1]
if necro==nil then
necro=Tombmaker6(clu2)
end
clu2.coffin_pos.x=df.global.cursor.x
clu2.coffin_pos.y=df.global.cursor.y
clu2.coffin_pos.z=df.global.cursor.z

clu2.trigger_regions:insert("#",{new=true,
x_min=v1,
y_min=v2,
z_min=v5,
x_max=v3,
y_max=v4,
z_max=v5})

end

function Tombmaker6(e)
local Ark2={}
for k,v in pairs(df.global.world.raws.interactions) do
    if df.interaction_effect_animatest:is_instance(v.effects) or df.interaction_effect_resurrectst:is_instance(v.effects) then -- checked_item.flags.in_building then

table.insert (Ark2,{v.name.." "..v.id,nil,v.id})
end
end
local f=function(Name,C)
e.disturbance=C[3]
end
dlg.showListPrompt("spell list","Select a spell for shoving into a tomb",COLOR_WHITE,Ark2,f)
end

Tombmaker(df.global.cursor.x-1,df.global.cursor.y-1,df.global.cursor.x+1,df.global.cursor.y+1,df.global.cursor.z,nil,12)

--dofile("hack/scripts/rumpack/DisTomb.lua")
end
function CorpsePoint(e)

corpse=getItemAtPos(pos2xyz(df.global.cursor))
e.coffin_skeletons:insert("#",corpse.id)
end
function doNothing()
print("doing nothing real good but here have a message")
end

listofspells={
{text="nothing", spell=doNothing,icon='*'},
{text="Necro:Alter Spell", spell=Tomb2,key="CUSTOM_V"},
{text="Necro:Add Corpses", spell=Tomb3,key="CUSTOM_M"},
{text="Necro:Add Corpses-cursor", spell=Tomb3a,key="CUSTOM_X"},
{text="Necro:Reset Curse", spell=Tomb4,key="CUSTOM_T"},
{text="Necro:Move Tomb-cursor", spell=Tomb5,key="CUSTOM_O"},
{text="Necro:CreateTomb-cursor", spell=SpellSeal,key="CUSTOM_N"},
}
 
dlg.showListPrompt("Directions","Choze order",nil, listofspells,function(index,choice) choice.spell() end)
ok so the list of working spell commands
'alter spell' is the script that lets you choose an interaction to be slotted in the 'disturbance' section of the curse tomb which takes in from what I tested resurrection and animation focus spells the script filters the others out for just those with those effects
'add corpses' and 'add corpses-cursor' will slot in a corpse and corpse piece into the cursed tomb data the cursor one lets you just use the in game keyboard cursor to select a corpse item.
the 'reset curse' will toggle the 'trigger' flag state to false. priming the cursed tomb to animate/resurrect(these are two different interactions) the corpses you added when someone step in the trigger zone
'move tomb-cursor' is to move the triggering zone good for re-aligning a spot to a place with more units wandering about to prox the spell and 'create tomb-cursor' is the command that creates a cursed-tomb though it's filled with mostly dummy data with idea of the player setting it up with the other spell commands also there the whole site id stuff which is align to the player's fort site... also the structure data I found isn't needed for the script but it probably goes to the civ zone building for the tomb.
overall was  rough set of days getting this to work and figuring out if it work.

so now you can revive your dead dwarves if they didn't get mangled and turn them into revenants/intel undead and or mummies.
this probably goes well with mods that dip into resurrection and animation interactions.

so stability warning uhh you are messing with necromancy and making someone a necromancer in form of a mummy if you mess with this ... or a revenant. expect old grudges to spring up and folks getting murdered in droves.

edit 2024: updated the images
edit 2024 april/3: updated for df50.12 changes with the unit selector that broke the script.
« Last Edit: April 03, 2024, 10:14:32 am by Rumrusher »
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

Überzwerg

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3575 on: November 08, 2023, 03:46:01 pm »

I have the problem that every few hours the game is taking over 5 minutes to start when DFHack is enabled. When I rename the dfhooks.dll it's starting instantly, with the dll in place it's taking ages again.

I figured out that it is the Windows Defender Cloud Protection that is slowing the start down. I can see it in the Windows event log. And in the task manager you see that the antimalware process is taking minimal processor load, but that it is generating network traffic.
It seems to upload and check every plugin. When I abort the start of the game I see in the stderr.log that it always had stopped at some "loading plugin" entry.

Funnily this does not happen when you freshly install the game and DFHack. I reinstalled it several times at first because I was under the impression that my install is broken. A fresh install is starting instantly, but after a few hours it will take ages again. When you wait until it is done (5 minutes later...) it will start again instantly on the next restarts. Until a few hours later it will again taking ages.

I'm using the free 50.11 version of DF, which is not signed, so Windows is classifying it as PUA.

I'm mostly writing this down so that the devs of DFHack know this issue when reports of the game not starting anymore may come in.
(And I don't understand why that cloud shit is taking so long, my upload is not the bottleneck with 40 MBit/s.)
« Last Edit: November 08, 2023, 03:51:33 pm by Überzwerg »
Logged

myk

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3576 on: November 08, 2023, 10:45:48 pm »

Binary signing is a complicated area -- anything involving crypto and trust is, really. According to https://github.com/sigstore/fulcio/issues/250 **maybe** we could get free signing services. It wouldn't be perfect since the root CA wouldn't be trusted by Windows, but it may (and that's just a "may" since I don't really understand the entire signing system and how what we would get would interact with it) result in fewer warnings for players overall. Those like you who know more about what they're doing could potentially install the signpath root CA and avoid the warnings/slowdowns altogether, but again, I'm not sure about that. The GitHub issue I was reading refers to "Smart Screen" which may or may not be the same (or react the same) as Windows Defender Cloud Protection.

It would at least involve building a relationship with signpath and changing our build and release process to involve the remote servers, and I don't really have a sense for how much work that would be.

Edit: After some discussion on the Discord server, the consensus is that what you describe is *not* normal behavior for Windows Defender Cloud Protection. This assessment is somewhat bolstered by the fact that we have never heard of issues like this before, despite being used by tens of thousands of people. It may be that your system is having some other basic trouble or misconfiguration, or even potentially a malware infection that is doing its best to hide from AV, and thus making it malfunction. I hope that's not the case here, but I'm not sure where to point you next.
« Last Edit: November 08, 2023, 11:25:29 pm by myk »
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 50.11-r2
« Reply #3577 on: November 09, 2023, 02:51:40 am »

sitting here thinking about 'yeah it does take a while for DF to boot up' but then I just figured that due to how I store DF which is on an external drive.
but I guess loading DF onto the cloud probably takes a bit more longer than just having it on the harddrive or some external drive.
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

Überzwerg

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3578 on: November 09, 2023, 11:36:20 am »

Binary signing is a complicated area ...
That "smart screen" warning is caused by the Dwarf Fortress.exe, not from DFHack, because Dwarf Fortress itself isn't signed. When running Dwarf Fortress.exe the first time it's triggering the warning:
"Windows Protected your PC
Microsoft Defender SmartScreen prevented an unrecognized app from starting. Running this app might put your PC at risk.
..."

Installing and running DFHack (by starting Dwarf Fortress) isn't causing any warning. And the first cloud scan is only starting after about 6 hours.

I can imagine that DFHack is suspicious for the scanner because it is hooking in another app, just like malware would do it.
And I imagine that most of your user base is now on the Steam version of DF, while I am using the free version. I'm curious if you could replicate it with the free version. You need to have set "cloud protection" and "automatic sample submission" both on ON. (I did set "automatic sample submission" OFF some time ago when I was developing some program, but some upgrade installation of Windows must have turned it back to ON...)

I checked my event log again and the cloud protection is only triggered by DFHack regulary. Other cloud scans I can find are rare and only every few months one entry. (It's under Applications and Services/Microsoft/Windows/Windows Defender/Operational in the event viewer, search there for "cloud").

My main intention to post this behaviour was that your are aware of this when others report that DF isn't starting anymore with DFHack (such a long starting time is looking at first like it isn't starting at all). And there isn't much you can do, expect telling affected users to wait it out or to disable the "automatic sample submission" or to set an exception for the DF folder in the Defender.
Logged

myk

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3579 on: November 09, 2023, 04:03:17 pm »

The warning is appreciated -- as you can probably tell, I don't have much experience with recent (that is, < 20 years old) Windows AV.

For the record, DFHack no longer hooks into DF by replacing the SDL library and intercepting the calls. DF detects the DFHack library and *intentionally* loads it into its process space. There's a proper API nowadays. Of course, the scanner might still disapprove of other things DFHack is doing.

I'll add your advice to our docs!

By the way, I've heard that there is a "this file was downloaded from the internet" checkbox that you can untick before extracting DFHack from its distribution archive. Do you happen to remember if you unticked that box?
« Last Edit: November 09, 2023, 04:05:01 pm by myk »
Logged

Überzwerg

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3580 on: November 09, 2023, 06:10:04 pm »

...
By the way, I've heard that there is a "this file was downloaded from the internet" checkbox that you can untick before extracting DFHack from its distribution archive. Do you happen to remember if you unticked that box?
I didn't touched that checkbox. The "df_50_11_win.zip" and the "dfhack-50.11-r2-Windows-64bit.zip" were still marked with this text (under file properties):
"Security: This file came from another computer and might be blocked to help protect this computer."
Followed by a checkbox: "Unblock".
When you click "unblock" this text and the checkbox will go away.

So I checked my install and the various .exe from DFHack had this security warning text (The .dlls under plugins also had that text, but not the dfhooks.dll?!?). The "Dwarf Fortress.exe" did not had that text anymore, confirming the SmartScreen dialog when opening it first seems to do the same as clicking the "Unblock" checkbox.

Did a new install now with the archives "unblocked". Then I didn't got a SmartScreen dialog for "Dwarf Fortress.exe". And of course the warning text is gone from all .exe and .dll files. So far it's working fine and starting fast (while my old install is just again taking a while to start).

I'm quiete sure that this was the trick, but I will report back tomorrow.
« Last Edit: November 09, 2023, 06:18:15 pm by Überzwerg »
Logged

Le Zenith Troglodyte

  • Escaped Lunatic
    • View Profile
Re: DFHack 50.11-r2
« Reply #3581 on: November 10, 2023, 02:10:20 pm »

Hello everyone! Was wondering if there are any plans to add classic keyboard support and keybinds to the .50 version of the game? Really missing those old keybinds.
Logged

ab9rf

  • Bay Watcher
    • View Profile
    • ab9rf@github
Re: DFHack 50.11-r2
« Reply #3582 on: November 10, 2023, 06:43:06 pm »

I can imagine that DFHack is suspicious for the scanner because it is hooking in another app, just like malware would do it.
DFHack behaves just like any other DLL. There's nothing in DFHack that will look like malware to a heuristic scanner. DFHack does not "hook" another app, it actually loads as an invited DLL (using the 'dfhooks' mechanism provided by Bay12) and uses Bay12's published endpoints to connect to DF.
Logged

Überzwerg

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3583 on: November 10, 2023, 07:25:59 pm »

The problem is solved, the long loading times are gone.
All that was needed is to remove the warning "Security: This file came from another computer and might be blocked to help protect this computer" from the downloaded archive by clicking unblock.

Thanks myk for that piece of advice, I couldn't see the forest for the trees.

RANT: I don't get why the cloud scan is not performed at the first execution of those as "unsafe" marked files. Instead Windows let me run those files without problems, but then hours later it will decide to check those files now by sending them to the cloud. And because Windows isn't trusting those files it's sending them to their cloud every 6 hours, again and again...
Logged

PatrikLundell

  • Bay Watcher
    • View Profile
Re: DFHack 50.11-r2
« Reply #3584 on: November 11, 2023, 02:43:44 am »

Hello everyone! Was wondering if there are any plans to add classic keyboard support and keybinds to the .50 version of the game? Really missing those old keybinds.
Toady One has said that keyboard support will be restored (July last year), although there's no time line. This is not a DFHack issue, but one for the base game.

Note that you won't get the old key bindings back, but rather new ones. The plan is to use the same set of keys for the same actions everywhere (not a lot of different schemes for cursor movement in different places), and while things are shaken up keys will be assigned to more logical characters (rather than the gradual accumulation of assignment to one of the unused keys over the decades). It won't be possible to restore the old key bindings even if there's a rebinding option (unknown if one will be provided), as functionality has been moved around, so some things have been split or even rearranged such that part of the functionality now is in one action together with other stuff, while other parts may be in another action.
Logged
Pages: 1 ... 237 238 [239] 240 241 ... 243