Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 6 7 [8] 9 10 ... 244

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

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #105 on: June 21, 2017, 03:10:52 pm »

Gonna look over those style/shortcut suggestions again now that I'm free, lethosor, btw.
Edit: think I got them all and pushed to the dfhack/scripts properly, I missed the change from the name-scripts style to the current fork>dfhack/scripts version completely.
pondering about creating new worldgen events in adventure mode, like is it possible to just get an retired adventurer to be kidnapped by a night troll?
Code: [Select]
df.global.world.history.events:new()
 df.global.world.history.events:insert('#',{new=df.history_event_hist_figure_abductedst,
year = *desired year*,
seconds = *desired tick in the year*,
id = df.global.hist_event_next_id,
target = *you*.id,
snatcher = *night troll*.id,
site = *your retired site*,
region = *uh, df.world_region.find(*a link to your df.global.world.world_data.region_map[k].sites[v].id=*your site*)*
*maybe? not sure what a viable shortcut for that is*
layer = *however the fuck you get the layer from the region link?*
}
)
df.global.hist_event_next_id = df.global.hist_event_next_id+1
Then you'd toss in the links to the relevant corrupting events I suppose?
« Last Edit: June 21, 2017, 11:36:58 pm by Max™ »
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #106 on: June 22, 2017, 04:39:34 pm »

sweet probably adapt this into some kind of script that adds world changing events.
now to see if setting a dwarf to abduct someone causes their victims to turn into a dwarf?
hmm looks like this doesn't work, or well messing with the history logs doesn't convert a person.
so it something else.
also doesn't seem to pop up in legends either
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

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #107 on: June 22, 2017, 04:54:55 pm »

Hmmm, there are a few more links you'll need to add I guess, but that's the format I used to have artifakes show up properly in legends.
Logged

scourge728

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #108 on: June 22, 2017, 11:38:45 pm »

Didn't there used to be a command that would clear the dead unit list? what happened to that

Max™

  • Bay Watcher
  • [CULL:SQUARE]
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #109 on: June 23, 2017, 03:29:02 am »

Isn't it fix/dead-units?
Logged

assasin

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #110 on: June 23, 2017, 08:11:52 am »

I downloaded dfhack source to play around with and damn the build process has been a mission. Current problem. It keeps trying to download a files for stonesense that don't seem to exist anymore. I'm trying a win32 build. I think I've traced where the problem is. I believe the problem is gna.org has shut down and so the files have disappeared into the aether.


dfhack\plugins\stonesense\CMakeLists.txt
Code: [Select]
# windows
ELSE(UNIX)
    SET(ALLEGRO_DOWNLOAD_DIR ${stonesense_SOURCE_DIR}/win${DFHACK_BUILD_ARCH})
    IF(DFHACK_BUILD_64)
        download_file("http://download.gna.org/allegro/allegro-unstable-bin/5.1.12/allegro-msvc2015-x64-5.1.12.zip"
                      ${ALLEGRO_DOWNLOAD_DIR}/allegro-msvc2015-x64-5.1.12.zip
                      "3abb0bd88251efde001a8b65fdf17683")
        execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${ALLEGRO_DOWNLOAD_DIR}/allegro-msvc2015-x64-5.1.12.zip
                        WORKING_DIRECTORY ${ALLEGRO_DOWNLOAD_DIR})
        download_file("http://download.gna.org/allegro/allegro-deps/1.2.0/allegro_deps-msvc2015-x64-1.2.0.zip"
                      ${ALLEGRO_DOWNLOAD_DIR}/allegro_deps-msvc2015-x64-1.2.0.zip
                      "eb8d0f4569b84c36bef3733b40b00c72")
        execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${ALLEGRO_DOWNLOAD_DIR}/allegro_deps-msvc2015-x64-1.2.0.zip
                        WORKING_DIRECTORY ${ALLEGRO_DOWNLOAD_DIR})
    ELSE()
        download_file("http://download.gna.org/allegro/allegro-unstable-bin/5.1.12/allegro-msvc2015-x86-5.1.12.zip"
                      ${ALLEGRO_DOWNLOAD_DIR}/allegro-msvc2015-x86-5.1.12.zip
                      "86e6aeea828743107dc1f3a3d562e53d")
        execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${ALLEGRO_DOWNLOAD_DIR}/allegro-msvc2015-x86-5.1.12.zip
                        WORKING_DIRECTORY ${ALLEGRO_DOWNLOAD_DIR})
        download_file("http://download.gna.org/allegro/allegro-deps/1.2.0/allegro_deps-msvc2015-x86-1.2.0.zip"
                      ${ALLEGRO_DOWNLOAD_DIR}/allegro_deps-msvc2015-x86-1.2.0.zip
                      "be096bfef256cb113e25dbb2eb7fd410")
        execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ${ALLEGRO_DOWNLOAD_DIR}/allegro_deps-msvc2015-x86-1.2.0.zip
                        WORKING_DIRECTORY ${ALLEGRO_DOWNLOAD_DIR})


I have no experience in large projects or tools like git/automated builds/etc. I don't quite know the etiquette. I apologise if I've screwed u[ anywhere.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #111 on: June 23, 2017, 08:43:53 am »

Yeah, it looks like that site is down. I'm not entirely sure where to get Allegro for Windows, then. Maybe https://github.com/liballeg/allegro5/releases would work, but those builds all contain "mingw" in their names, which worries me a bit. You might be better off disabling Stonesense for now unless you specifically want to work with it.
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.

assasin

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #112 on: June 23, 2017, 09:31:54 am »

Yeah, it looks like that site is down. I'm not entirely sure where to get Allegro for Windows, then. Maybe https://github.com/liballeg/allegro5/releases would work, but those builds all contain "mingw" in their names, which worries me a bit. You might be better off disabling Stonesense for now unless you specifically want to work with it.

Disabled stonesense and everything seems to work fine. Good enough for now I guess. Thanks.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #113 on: June 23, 2017, 09:41:53 am »

islandofcalmness pointed me to here: https://web.archive.org/web/20170306031002/http://download.gna.org/allegro/

I won't be able to update Stonesense right away, but you should be able to find the files you need there. (You can download them and place them in CMake/downloads to have CMake recognize them, using the process for offline builds outlined in Compile.rst.)
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.43.05-r1
« Reply #115 on: June 27, 2017, 10:54:27 pm »

Had some fun working on an autogems UI yesterday. Next up is a similar one for autochop.

Spoiler: main view (click to show/hide)
Spoiler: diamonds (click to show/hide)
Spoiler: dark red gems (click to show/hide)
Spoiler: rough gems on the map (click to show/hide)
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.43.05-r1
« Reply #116 on: June 28, 2017, 11:59:43 am »

Can anybody work out a reason why this code continues after being cancelled, or is it a bug with repeat-util?
Code: [Select]
local blah = 1
local id = "foo"
local repeatUtil = require 'repeat-util'

local function doStuff()
print("Blah: " .. blah)
blah = blah +1
print("Blah is now " .. blah)
if blah > 10 then
print("Blah is more than 10. Stopping.")
print("Has supposedly cancelled = " .. tostring(repeatUtil.cancel(id)))
end
end

repeatUtil.scheduleEvery(id,50,"frames",doStuff)

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #117 on: June 28, 2017, 04:49:00 pm »

Can anybody work out a reason why this code continues after being cancelled, or is it a bug with repeat-util?
Code: [Select]
local blah = 1
local id = "foo"
local repeatUtil = require 'repeat-util'

local function doStuff()
print("Blah: " .. blah)
blah = blah +1
print("Blah is now " .. blah)
if blah > 10 then
print("Blah is more than 10. Stopping.")
print("Has supposedly cancelled = " .. tostring(repeatUtil.cancel(id)))
end
end

repeatUtil.scheduleEvery(id,50,"frames",doStuff)

Thanks for the example!

It looks like the issue is that repeat-util's scheduleEvery() calls your callback, then sets a timeout for the next one after your callback returns, regardless of what your callback did. Here's the relevant part of repeat-utils.lua:

Code: [Select]
function scheduleEvery(name,time,timeUnits,func)
 cancel(name)
 local function helper()
  func()
  repeating[name] = dfhack.timeout(time,timeUnits,helper)
 end
 helper()
end

helper() gets called repeatedly, which calls func() (your callback), then sets up a new timeout. This has the advantage that if func() raises an error, it won't get rescheduled indefinitely (i.e. swapping "func()" with the line below would be a bad idea). However, it also means a repeating function can't cancel itself. I think it could track calls to cancel() and make sure that func() didn't cancel itself before rescheduling it, though, if you'd find that useful.

Edit: added this as an issue: https://github.com/DFHack/dfhack/issues/1122
« Last Edit: June 28, 2017, 04:53:54 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.

Hesperid

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #118 on: June 29, 2017, 11:14:14 am »

I thought repeating functions not being able to cancel their own scheduling was a deliberate design decision.

The workaround that suggests itself is to have an infrequently running auxiliary function handle canceling of other functions. While the repeaters are waiting to be canceled, they are prevented from running by a guard variable. In my implementation, the guard variable and cancel signal are the same variable.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.43.05-r1
« Reply #119 on: June 29, 2017, 12:06:00 pm »

I thought repeating functions not being able to cancel their own scheduling was a deliberate design decision.
Why would it be? Expwnent seems to agree that it's unintentional. I can't see much of an advantage from preventing repeating functions from cancelling themselves (particularly since they can cancel other ones already).

Atkana: you might also find the "gui.script" module useful, by the way. Something like this could work:

Code: [Select]
local script = require 'gui.script'

script.start(function()
    for blah = 1, 10 do
        print("Blah: " .. blah)
        script.sleep(50, "frames")
    end
end)
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.
Pages: 1 ... 6 7 [8] 9 10 ... 244