Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 103 104 [105] 106 107 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1408073 times)

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1560 on: May 22, 2012, 08:12:10 pm »

:(

38>Time Elapsed 00:00:08.37
40>LINK : fatal error LNK1104: cannot open file '..\library\Debug\SDL-debug.lib'
40>
40>Build FAILED.

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: DFHack 0.34.10 r1
« Reply #1561 on: May 22, 2012, 08:31:49 pm »

I just watched all this talk of lua and branches and compiling... and my liberal arts brain popped, but seeing a new proper release makes me feel better. >.>
Hehe. As long as you don't delve into the developer stuff, you should be safe from any brain-popping craziness :)

However, DFHack always was more of a developer thing. Quoting the first post:
Quote
DFHack is an attempt to unite the various ways hack tools access DF memory and allow for easier development of new tools (and of course, make the game more enjoyable for players).

So, don't be surprised to see some developer talk in the thread :)

:(

38>Time Elapsed 00:00:08.37
40>LINK : fatal error LNK1104: cannot open file '..\library\Debug\SDL-debug.lib'
40>
40>Build FAILED.
There is no debug. I made debug builds impossible to complete because they aren't compatible with DF (instant crash). Switch your IDE to Release or RelWithDebInfo mode. RelWithDebInfo actually leaves some debugging info in the libs, so use that if you need to poke around with a debugger.

Also, hop on IRC :) It will be easier to resolve problems that way. It's #dfhack on freenode

thistleknot

  • Bay Watcher
  • Escaped Normalized Spreadsheet Berserker
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1562 on: May 22, 2012, 11:01:50 pm »

thank you guys, I got a dwarfexport2, so far it just has traits fixed.  The skills and labors have spaces hard coded elsewhere in their names that throw off the xml tagging.

so...

I got what I need for my lil mini project though, traits, and attributes.  It would be nice to have skills, but I think i'm good with what I got as I don't use skills for my calculations.

Rumrusher

  • Bay Watcher
  • current project : searching...
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1563 on: May 23, 2012, 12:20:19 am »

Code: [Select]
function allin(unit,item)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
r=getline()
if item==nil then
item=getItemAtPos(getxyz())
end

unit.riding_item_id=item.id
ref=df.general_ref_unit_riderst:new()
ref.unit_id=unit.id
item.itemrefs:insert("#",ref)
end

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 then --compare them
return vector[i] --return index
end
end

here the function with help of the dfhack community. this here will select any unit and place them on a currently riding minecart.
note you need to be riding in the cart for this to work.
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

vjek

  • Bay Watcher
  • If it didn't work, change the world so it does.
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1564 on: May 23, 2012, 05:55:53 pm »

So, my first foray into lua for dfhack, hopefully someone will find it useful:

Spoiler: elevate_physical.lua (click to show/hide)

Sample output is:

[DFHack]# lua c:\df_34_10_win\hack\scripts\elevate_physical.lua 2200
Old Physical Attributes for åblel
Strength: 1224 | Agility: 1122 | Toughness: 1223 | Endurance: 1075 | Recuperation: 716 | Disease Resistance: 1651
Updating Physical Attributes for åblel
New Physical Attributes for åblel
Strength: 2200 | Agility: 2200 | Toughness: 2200 | Endurance: 2200 | Recuperation: 2200 | Disease Resistance: 2200
[DFHack]#

If the consensus is this is a good & useful thing, I'll write up the mental attributes and personality traits in similar separate scripts.
EDIT: formatting
« Last Edit: May 24, 2012, 08:47:29 am by vjek »
Logged

TerryDactyl

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1565 on: May 24, 2012, 12:18:31 am »

;) need ;) a utility that changes values (in memory) from the 'announcements.txt' while the game is running. I like to fight battles with combat details appearing in a popup, but reading the combat rolls for sparring and gratuitous prisoner beatings is tedious. So is restarting DF every time I want to make a change.

......where do I start?

ab9rf

  • Bay Watcher
    • View Profile
    • ab9rf@github
Re: DFHack 0.34.10 r1
« Reply #1566 on: May 24, 2012, 12:25:22 am »

;) need ;) a utility that changes values (in memory) from the 'announcements.txt' while the game is running. I like to fight battles with combat details appearing in a popup, but reading the combat rolls for sparring and gratuitous prisoner beatings is tedious. So is restarting DF every time I want to make a change.

......where do I start?
By finding where in memory those values are stored.  IIRC, we don't know where that is anymore.
Logged

Martin

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1567 on: May 24, 2012, 01:25:36 am »

If the consensus is this is a good & useful thing, I'll write up the mental attributes and personality traits in similar separate scripts.


Holy shit! That's exactly what I needed for Morul. Yes, the mental/personality would be appreciated as well. I haven't gotten around to digging into those areas and working out what the values mean. Thank you for posting that.


I've got an okay, if tedious mechanism for raising his skills. Here's what I did to raise his stats after many failed efforts to do it more automatically:


Code: [Select]
function tools.morul(unit)
if unit==nil then
unit=getCreatureAtPointer()  --place the x pointer on top of the creature you want to change. best use is the look pointer and not 'v'
end
--Set the name. Surname is comprised of an array of references [words] into the language file. Each entry grabs a word fragment and the name is
--all of these catenated
  unit.name.first_name = "Morul"
  unit.name.words[0] = 1416
  unit.name.words[1] = 1304
 
  replace_labor = 1
  labor_rating = 20
  military_rating = 70
 
  --These are the skill ids we want to add
  skill = { 0,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,54,55,57,58,59,60,61,62,63,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,95,96,97,98,99,100,101,102,103,104,105,109,110,111,112,113,114,115 }
  --These are the military skills that will get higher values
  military = { 38,39,41,42,43,44,45,46,54,99,100,101,102,103,104,105 }


  replaced = false
  for sk,sv in ipairs(skill) do
    if (replaced == false) then
      replace_key = -1
      present = false
      for dk,dv in pairs(unit.status.souls[0].skills) do
        if (dv.id == sv) then
          present = true
          unit.status.souls[0].skills[dk].rating = labor_rating
          for _,v in ipairs(military) do
            if v == sv then
              unit.status.souls[0].skills[dk].rating = military_rating
            end
          end
          rating = unit.status.souls[0].skills[dk].rating
          unit.status.souls[0].skills[dk].experience = (rating * 500) + (rating * (rating - 1)) * 50
        end
        if (dv.id == replace_labor) then
          replace_key = dk
        end
      end
     
      if (present == false) and (replace_key > -1) then
        print("Replace with ", sv)
        unit.status.souls[0].skills[replace_key].id = sv
        unit.status.souls[0].skills[replace_key].rating = labor_rating
        for _,v in ipairs(military) do
          if v == sv then
            unit.status.souls[0].skills[replace_key].rating = military_rating
          end
        end
        rating = unit.status.souls[0].skills[replace_key].rating
        unit.status.souls[0].skills[replace_key].experience = (rating * 500) + (rating * (rating - 1)) * 50
        replaced = true
      end
    end
  end


  for sk,sv in ipairs(unit.status.souls[0].skills) do
    printall(sv)
  end
end
tools.menu:add("Morul",tools.morul)


I tried inserting skills to the skills array, but I couldn't get it to stop duplicating skills - so he'd wind up with 100 entries for legendary wax worker or whatever. It appeared that there was more involved in adding skills than just that, and as soon as it tried writing it out it went all wonky. This routine instead takes a list of skill ids that you want added, looks for them, sets them if it finds one, and writes the next new skill over top of something that you identify (I did woodcutting). So I had Morul go and cut down a tree, run the script which would replace woodcutting with mining or fish dissecting or whatever, set the level and experience, and then exit, wait for him to cut another tree, do it again, etc. Any help finding a way to build them all out at once would be appreciated in the event I need to regen. I got the skill codes (and other goodies) out of DwarfTherapist.


It also shows how to update the name, but it doesn't fix it in the description screen. Any help with that would also be appreciated.


Learning lua in the process didn't help much. It's kind of a wonky language.

ag

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1568 on: May 24, 2012, 01:52:03 am »

So I had Morul go and cut down a tree, run the script which would replace woodcutting with mining or fish dissecting or whatever, set the level and experience, and then exit, wait for him to cut another tree, do it again, etc.

You can't do that - the vector must be sorted by skill id.

Try:

Code: [Select]
utils = require 'utils'
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = ..., rating = ... }, 'id')
« Last Edit: May 24, 2012, 01:54:47 am by ag »
Logged

Martin

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1569 on: May 24, 2012, 02:08:48 am »

You can't do that - the vector must be sorted by skill id.


Ah, nice. I'll work on that tomorrow. If it works, I'll clean it up and post it.


There's a bit of stuff on the wiki. Should we dump this stuff there? Finding stuff here in the forum comments is pretty damn hit or miss.

peterix

  • Bay Watcher
    • View Profile
    • Dethware
Re: DFHack 0.34.10 r1
« Reply #1570 on: May 24, 2012, 07:00:57 am »

There's a bit of stuff on the wiki. Should we dump this stuff there? Finding stuff here in the forum comments is pretty damn hit or miss.
Yes. A wiki, any wiki, would be good for this kind of stuff.

vjek

  • Bay Watcher
  • If it didn't work, change the world so it does.
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1571 on: May 24, 2012, 08:46:08 am »

...Yes, the mental/personality would be appreciated as well. I haven't gotten around to digging into those areas and working out what the values mean. Thank you for posting that. ...

Ok, here's the elevate_mental.lua and brainwash.lua scripts.  Brainwash doesn't have the same style of "before and after" checking as the other two, but it works just fine.  These are written in such a way that others can take them and modify them, not for conciseness of code.  So feel free to adjust/modify as you wish!

Spoiler: elevate_mental.lua (click to show/hide)

Example:
[DFHack]# lua c:\df_34_10_win\hack\scripts\elevate_mental.lua
Old Mental Attributes for tobul
Analytical_Ability: 1491 | Focus: 1777 | Willpower: 1963 | Creativity: 1309 | Intuition: 937 | Patience: 1161 | Memory: 1336 | Linguistic_Ability: 1076 | Spatial_Sense: 1393 | Musicality: 512 | Kinesthetic_Sense: 823 | Empathy: 1054 | Social_Awareness: 1499
Updating Mental Attributes for tobul
New Mental Attributes for tobul
Analytical_Ability: 2600 | Focus: 2600 | Willpower: 2600 | Creativity: 2600 | Intuition: 2600 | Patience: 2600 | Memory: 2600 | Linguistic_Ability: 2600 | Spatial_Sense: 2600 | Musicality: 2600 | Kinesthetic_Sense: 2600 | Empathy: 2600 | Social_Awareness: 2600
[DFHack]#


Spoiler: brainwash.lua (click to show/hide)

Example:
[DFHack]# lua c:\df_34_10_win\hack\scripts\brainwash.lua
Previous personality values for kadol
ANXIETY                  = 45
...
CAUTIOUSNESS             = 32
New personality values for kadol
ANXIETY                  = 1
...
CAUTIOUSNESS             = 99
kadol has been brainwashed, happy happy, joy joy!
[DFHack]#


I didn't want to have to fire up a third party tool to get this functionality, and now I don't.  8)  Go go dfhack.
« Last Edit: May 24, 2012, 09:00:27 am by vjek »
Logged

TerryDactyl

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1572 on: May 24, 2012, 09:08:11 am »

;) need ;) a utility that changes values (in memory) from the 'announcements.txt' while the game is running. I like to fight battles with combat details appearing in a popup, but reading the combat rolls for sparring and gratuitous prisoner beatings is tedious. So is restarting DF every time I want to make a change.

......where do I start?
By finding where in memory those values are stored.  IIRC, we don't know where that is anymore.

What is the correct methodology?

Numbers

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.10 r1
« Reply #1573 on: May 24, 2012, 03:29:54 pm »

Trying to write some sort of a vampirism curse cure since one of my well respected and quite skillful dwarves seem to also be a bloodsucker that is sucking the life out of my fortress.

What I've done so far was to fetch him by

unit = dfhack.gui.getSelectedUnit()

cleared lists from

unit.curse.add_tags1
unit.curse.add_tags2

as well as

unit.curse.rem_tags1
unit.curse.rem_tags2

cleared names and all and I don't know what else should I clear because curseshow still shows him as cursed.

Any idea how to heal him completely from his curse?
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: DFHack 0.34.10 r1
« Reply #1574 on: May 24, 2012, 04:08:53 pm »

Set unit.curse_year to -1 and cursecheck should no longer detect it.
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.
Pages: 1 ... 103 104 [105] 106 107 ... 373