Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 149 150 [151] 152 153 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1443908 times)

Greendogo

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2250 on: August 19, 2012, 12:13:33 am »

Hey, just to make sure I didn't make an untrue conjecture/statement somewhere else, can DFHack be used to pass all of DF's menu and GUI commands back to DF from another program?  For a very specific example, could someone alter Stonesense (or another visualizer) so that you could lay a mining designation from the Stonesense application, and then automatically pass that information back to DF without switching back to it?
Logged
Sail - The end reminds me of a goblin choking a kobold.  No ponies, sorry.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.34.11 r1
« Reply #2251 on: August 19, 2012, 12:57:18 am »

Hey guys,

I think it would be possible to write a dfhack plugin that run scripts automatically by reading the gamelog. So if I would say... do a reaction in the temple that is called: Invoke the spell of insight, and the gamelog says: dwarf1 has transformed into a dwarf struck by a vision... and dfhack reads that in the gamelog, and automatically runs reveal, and after 30 secons unreveal, than that would be awesome. Using dfhack as a game-feature :)

I just need a friendly dfhack-developer that know about lua-plugins to cooperate with me, to write a handful of scripts/spells/prayers. Please let me know if the idea is realistic, and if someone has interest in helping out :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2252 on: August 19, 2012, 07:49:42 am »

You can certainly have the script run every so often (based on number of ticks, unpaused ticks, days, months, or years) and check, but that would kill your framerate. I don't think there's an event for the announcements yet, but it should be possible.

Edit: it probably wouldn't kill your framerate. You can do something like this:

Code: [Select]
dfhack.timeout(1,'days',functionName);
where functionName checks the announcements list for the event you want. Make sure to reregister the function inside it or it'll only get called once.
« Last Edit: August 19, 2012, 08:53:00 am by expwnent »
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2253 on: August 19, 2012, 08:52:26 am »

There are already plugins that do checks every frame or so, and have no appreciable effect on FPS.
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2254 on: August 19, 2012, 09:51:00 am »

I think warmist and I have been working on functions that did this for most of last year to this year, kinda stop when DFhack swallowed dfusion and had to rewrite most of the old code, though now this just means recreating the on function. hey looks like I just found the "func.PrintMessage_()" function warmist work on before jumping on the on function function. if I'm luckly I can set up commands that will check if the game internally and send out a message into the game. This means I can set up hotkeys then code in the game to prompt that hotkey is pressed through dfuse.
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

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.34.11 r1
« Reply #2255 on: August 19, 2012, 04:50:27 pm »

Thanks, so it is possible. So all I need is to give a keyword and the script will find it ?

In my example I said "transformed into a dwarf struck by a vision" and as soon as "vision" appears in the gamelog, the script runs? I would still very much like to ask someone to write this for me, I only have a netbook and not much time at hand. Otherwise I do it myself in a few weeks, when I am back at a PC. I would just give a small list of keywords and the effect/script that should be run. I hope it doesnt take too much of your time.
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

terkiey

  • Bay Watcher
  • chicken what i need
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2256 on: August 19, 2012, 05:12:33 pm »

Is anyone getting problems where this is found to be a trojan dropper?
Logged
Quote from: Meistermoxx
Quote from: Knigel
Does anything bad happen if you accuse someone of being a night creature and they aren't?
Yes, they call you a rasict, and then they shot you and take your cocaine.
[(√[1]/∞)+3!+|Chicken|] / [100^(1/2)]

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r1
« Reply #2257 on: August 19, 2012, 08:04:39 pm »

Thanks, so it is possible. So all I need is to give a keyword and the script will find it ?

In my example I said "transformed into a dwarf struck by a vision" and as soon as "vision" appears in the gamelog, the script runs?
If you want to detect stuff in the gamelog, it's probably easier to just look in world.status.reports and/or world.status.announcements (i.e. get it directly from the Announcements screen).
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.

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2258 on: August 19, 2012, 08:17:45 pm »

That said, if you are worried about speed issues, you may want to write the plugin directly in C++, rather than lua, but somebody who knows more than me on the subject would have to verify that.
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r1
« Reply #2259 on: August 19, 2012, 10:02:06 pm »

As an example of how long things take to do in Lua, I wrote a simple "reveal" script and ran it on a 4x4 embark with 88 Z-levels. On my system (Core 2 Quad 2.4GHz), it took 1 minute and 6 seconds to reveal the entire map, while DFHack's "reveal" plugin (written in C++) takes a tiny fraction of a second even though it does even more stuff (checking each map block for local features [adamantine tubes] and global features [Hell] to see if it's safe to reveal, and saving a backup copy of every single tile's 'hidden' state for the "unreveal" command).

Code: [Select]
for i,j in pairs(df.global.world.map.map_blocks) do
    for x=0,15 do
        for y=0,15 do
            j.designation[x][y].hidden = 0
        end
    end
end
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.

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2260 on: August 19, 2012, 10:16:03 pm »

Yes, C++ is faster, but also more difficult.

Meph: I'll look into it and we'll see how far I get. No promises about having time to work on it in the future, but I'll try.
Logged

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2261 on: August 20, 2012, 02:09:13 am »

The best balance is probably C++ for stuff that needs to do a lot of boring work quickly, and lua for controlling what to do and when. Here it may be a c++ plugin that monitors logs, and then invokes a lua callback once it finds something.

P.S. In that reveal example above, I suspect a large percent of the time is memory allocation and garbage collection - it creates tons and tons of wrapper objects around native structures.
« Last Edit: August 20, 2012, 02:13:00 am by ag »
Logged

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2262 on: August 20, 2012, 04:40:06 am »

okay so with onfunction you can hook up a function to a callback ie

Code: [Select]
onfunction.SetCallback("ReactionFinish",Reaction)
though this means you only get 1 function per callback, though you could set up a function folder to store all the other functions you want to hook up to the callback ie
Code: [Select]
function Reactionfolder()
     spawndog
     spawncat
     teleport
     transmuteitem
end

onfunction.SetCallback("ReactionFinish",Reactionfolder)

dfusion will read the folder and do all the functions in said folder when ever someone finish a reaction. so combine this with dfuse hotkeys and you can have dfusion onfunctions running behind the scenes with little use of looking at dfusion or dfhack.
 

oh wait looks like I'm wrong both onfunction and triggers are severely outdated
« Last Edit: August 21, 2012, 12:17:23 pm 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

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.11 r1
« Reply #2263 on: August 21, 2012, 09:21:15 pm »

Some exciting new stuff has been added to DFHack over the past few days - thanks to angavrilov, it's now possible to override virtual methods on classes, and some new helper code has been added for manipulating the screen buffers. So far, 3 tools have been written making use of this:

1. A simple development plugin which overrides viewscreen_titlest::render() in order to superimpose the DFHack version on the title screen.
2. A Lua script which, when triggered under the appropriate circumstances (in Dwarf mode, using the [q] cursor, and hovering over a lever or a triggerable building), creates an overlay which lets you browse which buildings are linked to a particular lever (or which levers are linked to a particular building, depending on what you selected).
3. A plugin which hooks viewscreen_unitlistst::feed(...) and checks for presses of the [l]abors key (as used from the [v] cursor), at which point it opens a new viewscreen which implements a very simple (and currently incomplete) Therapist-style labor manager within Dwarf Fortress itself.

Stay tuned for further developments.
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.

vjek

  • Bay Watcher
  • If it didn't work, change the world so it does.
    • View Profile
Re: DFHack 0.34.11 r1
« Reply #2264 on: August 21, 2012, 10:48:14 pm »

... 2. A Lua script which, when triggered under the appropriate circumstances (in Dwarf mode, using the [q] cursor, and hovering over a lever or a triggerable building), creates an overlay which lets you browse which buildings are linked to a particular lever (or which levers are linked to a particular building, depending on what you selected). ...

The other two are nifty, but that one right there is a big ol' bag of AWESOME-SAUCE!
Well done!
Pages: 1 ... 149 150 [151] 152 153 ... 373