Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 278 279 [280] 281 282 ... 360

Author Topic: DFHack 0.43.03-r1  (Read 1123298 times)

Abadrausar

  • Bay Watcher
  • empowering ideas
    • View Profile
    • ♫♪♀HDFPS♂♪♫
Re: DFHack 0.40.24-r5
« Reply #4185 on: April 25, 2016, 07:26:32 pm »

One point missed though. We have almost working lua socket replacement that uses csockets(our socket lib) and is mostly compatible. However I lacked the necessary experience at that time to get it as bug free as possible.
Plain ridiculous, that you try to justify one half backed intellectual creation, that had not worked as you originally intended for years, attacking the people that states the same fact that you just recognize. You are better than that! Or should aspire to be at least... If you do not have the willpower, the competence or the time to finish one project, please free yourself recognizing it!
Oh and generally: you can spam the #dfhack channel in freenode irc and/or open issues on everything. Currently we are not (yet) that big that the issue count would be (pardon the pun) an issue :) Just try searching before posting.
If you really think, that anyone in this forum needs or ask your authorization or consent, to freely express his own opinions or state facts as they are perceived, you should pardon yourself for the image that you are giving of your personality. You are being acquiescent and childish there, and you know it. If you act like a scoundrel with other people there are few chances that they could respect you, or even that you should be able to respect yourself.
That said, anyone  can have a bad day, if that is the case, for me all this is over. Otherwise, next time you need a victim to spit upon your frustrations, consider to do it in other forums, people here have self respect and dignity and would not suffer gladly such behaviours.
« Last Edit: April 26, 2016, 09:01:50 am by Abadrausar »
Logged
::: Humble Dwarf Fortress Publishing System ♫♪♀HDFPS♂♪♫ Mods Push Published in DFFD are auto updated in local Players Catalog :::

kane_t

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4186 on: April 25, 2016, 07:28:20 pm »

There are a number of cases where it will refuse to move items, including that. I don't know if there are specific reasons behind all of those cases, or if it was just too much effort to make it handle everything properly.

(The relevant function that moveToGround() calls out to is detachItem() in library/modules/Items.cpp, if you want to take a look.)

I actually did check it, right after posting that, and found out that it doesn't move things that are currently in a job.  I hadn't realised they were in a job--because nobody was doing anything, it was one of those jobs that exists in the list but nobody will ever claim, ever, because of burrow restrictions--so that hadn't occured to me.  Forbid/unforbid and now they're movable.

Incidentally, the other problem was that it refuses to move things that are listed in a UI viewscreen, which I actually had learned last year when I wrote a script to combine drinks in a stockpile, but had since forgotten.  That's the other problem I was having, since I was trying to move things I had selected in the UI.

So, if anyone's having the same problem, make sure the items aren't visible in the UI (meaning, you can't use gui.getSelectedItem(), you have to store them in a variable), and forbid them to kill any jobs pointing to them.
Logged

Dirst

  • Bay Watcher
  • [EASILY_DISTRA
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4187 on: April 25, 2016, 07:33:59 pm »

There are a number of cases where it will refuse to move items, including that. I don't know if there are specific reasons behind all of those cases, or if it was just too much effort to make it handle everything properly.

(The relevant function that moveToGround() calls out to is detachItem() in library/modules/Items.cpp, if you want to take a look.)

I actually did check it, right after posting that, and found out that it doesn't move things that are currently in a job.  I hadn't realised they were in a job--because nobody was doing anything, it was one of those jobs that exists in the list but nobody will ever claim, ever, because of burrow restrictions--so that hadn't occured to me.  Forbid/unforbid and now they're movable.

Incidentally, the other problem was that it refuses to move things that are listed in a UI viewscreen, which I actually had learned last year when I wrote a script to combine drinks in a stockpile, but had since forgotten.  That's the other problem I was having, since I was trying to move things I had selected in the UI.

So, if anyone's having the same problem, make sure the items aren't visible in the UI (meaning, you can't use gui.getSelectedItem(), you have to store them in a variable), and forbid them to kill any jobs pointing to them.
So basically you're writing moveToGroundSeriouslyIMeanItThisTime()? :)
Logged
Just got back, updating:
(0.42 & 0.43) The Earth Strikes Back! v2.15 - Pay attention...  It's a mine!  It's-a not yours!
(0.42 & 0.43) Appearance Tweaks v1.03 - Tease those hippies about their pointy ears.
(0.42 & 0.43) Accessibility Utility v1.04 - Console tools to navigate the map

kane_t

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4188 on: April 25, 2016, 09:14:02 pm »

So basically you're writing moveToGroundSeriouslyIMeanItThisTime()? :)

I considered writing "goddamnitDoWhatIWantRightNow()" but it seemed like too large a project scope.

(Actually, I'm still having problems, because detachItem() actually does fail out when an item is stored in a building.  Fails if there's a BUILDING_HOLDER general ref.  Still not sure why, or what the danger is of proceeding in that case.)
Logged

Warmist

  • Bay Watcher
  • Master of unfinished jobs
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4189 on: April 25, 2016, 11:32:59 pm »

So basically you're writing moveToGroundSeriouslyIMeanItThisTime()? :)

I considered writing "goddamnitDoWhatIWantRightNow()" but it seemed like too large a project scope.

(Actually, I'm still having problems, because detachItem() actually does fail out when an item is stored in a building.  Fails if there's a BUILDING_HOLDER general ref.  Still not sure why, or what the danger is of proceeding in that case.)
I have an issue in github about just that. It's not very hard to drastically improve the functionality of detach item and in turn to moveTo* functions.

kane_t

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4190 on: April 26, 2016, 11:15:40 am »


I have an issue in github about just that. It's not very hard to drastically improve the functionality of detach item and in turn to moveTo* functions.

I've been looking through the code myself, mainly just out of curiosity, but a lot of files seem to be missing from the github repo.  Stuff like the more than 1,200 headers that should be in include\df.  Is there a second repository somewhere that has the core DFHack files?
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4191 on: April 26, 2016, 11:25:09 am »

Those are all generated at compile time from df-structures.
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.

kane_t

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4192 on: April 26, 2016, 12:33:44 pm »

Those are all generated at compile time from df-structures.

Ah, very clever.  In retrospect, I should've guessed that myself.

The reason I was looking into it was because I possibly noticed a problem with job-duplicate, and wanted to take a look at the df::job copy constructor to see if there was a bug there.  Basically, it was changing the input item/material weirdly on duplication.  I'll put in a proper bug report when I have a chance to sit down and do some testing to see what the exact conditions are.
Logged

lethosor

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4193 on: April 26, 2016, 01:43:01 pm »

There aren't any generated copy constructors that I'm aware of, so the problem is likely with however job-duplicate is copying jobs.
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.

kane_t

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4194 on: April 26, 2016, 01:51:36 pm »

There aren't any generated copy constructors that I'm aware of, so the problem is likely with however job-duplicate is copying jobs.

It's definitely using a copy constructor:
Code: [Select]
df::job *DFHack::Job::cloneJobStruct(df::job *job, bool keepEverything)
{
    CHECK_NULL_POINTER(job);

    df::job *pnew = new df::job(*job);

And it uses the copy constructor for job_item, too:
Code: [Select]
    for ( size_t a = 0; a < pnew->job_items.size(); a++ )
        pnew->job_items[a] = new df::job_item(*pnew->job_items[a]);

Those are probably compiler-generated, though, instead of generated from the XML, in which case I'd assume they're correct.
Logged

Droggarth

  • Bay Watcher
  • Ischrotaur Axe Lord [SUPERNATURAL][STRANGE_MOODS]
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4195 on: April 27, 2016, 08:14:49 am »

And as usual I still don't have an answer to how to I make an item like sword into an artifact with it's own name? Please I need help here. I asked this a few pages ago.

Since then I now also need answers to how do I turn my character into a necromancer with DFhack? As I don't have any necromancer towers whatsoever and I'm missing out a part of the game here because of it.
Logged
"I'll make my own way." - Max Rockatansky

kane_t

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4196 on: April 27, 2016, 05:33:08 pm »

And as usual I still don't have an answer to how to I make an item like sword into an artifact with it's own name? Please I need help here. I asked this a few pages ago.

Since then I now also need answers to how do I turn my character into a necromancer with DFhack? As I don't have any necromancer towers whatsoever and I'm missing out a part of the game here because of it.

I actually have a partial explanation for this.  I recently needed to write a script to turn things into artifacts, and it looks like this:
Code: [Select]
function findImage(id, subid)
local result = nil
for _,i in ipairs(df.global.world.art_image_chunks) do
if i.id == id then
result = i.images[subid]
end
end
return result
end

local item = dfhack.gui.getSelectedItem()

if not item then
print("No item selected")
else

local already_artifact = false
for i,v in ipairs(item.general_refs) do if df.general_ref_is_artifactst:is_instance(v) then already_artifact = true end end
if already_artifact then
print("Already an artifact")
else

local artifact_record = df.artifact_record:new()
local artifact_ref = df.general_ref_is_artifactst:new()
local history_event = df.history_event_artifact_createdst:new()

artifact_record.id = df.global.artifact_next_id
artifact_record.item = item
artifact_record.anon_1 = -1000000
artifact_record.anon_2 = -1000000
artifact_record.anon_3 = -1000000

artifact_ref.artifact_id = artifact_record.id

item.flags.artifact = true
item.flags.artifact_mood = true
item:setQuality(5)
for _,v in ipairs(item.improvements) do
v.quality = 5
end

if item.masterpiece_event == -1 then
history_event.year = df.global.cur_year
history_event.seconds = df.global.cur_year_tick_advmode
else
local masterpiece_event = df.global.world.history.events[item.masterpiece_event]
history_event.year = masterpiece_event.year
history_event.seconds = masterpiece_event.seconds
end
history_event.id = df.global.hist_event_next_id
history_event.artifact_id = artifact_record.id
history_event.hfid = item.maker
history_event.unit_id = df.historical_figure.find(item.maker).unit_id
history_event.site = df.global.world.world_data.active_site[0].id

item.general_refs:insert('#', artifact_ref)
df.global.world.artifacts.all:insert('#', artifact_record)
df.global.artifact_next_id = artifact_record.id + 1
df.global.world.history.events:insert('#', history_event)
df.global.hist_event_next_id = df.global.hist_event_next_id + 1

-- Look for a name
local named_image = nil
if df.item_figurinest:is_instance(item) then
print("is figurine")
local image = findImage(item.image.id, item.image.subid)
print("found image") print(image)
if image and image.name.has_name then
print("set name")
named_image = image
end
end
if not named_image then
for _,i in ipairs(item.improvements) do
if df.itemimprovement_art_imagest:is_instance(i)
or df.itemimprovement_illustrationst:is_instance(i)
or df.itemimprovement_sewn_imagest:is_instance(i) then

local image = findImage(i.image.id, i.image.subid)
if image and image.name.has_name then
named_image = image
end
end
end
end

if named_image then
for i=0,6 do
artifact_record.name.words[i] = named_image.name.words[i]
artifact_record.name.parts_of_speech[i] = named_image.name.parts_of_speech[i]
end
artifact_record.name.language = named_image.name.language
artifact_record.name.has_name = true
end
end
end

Note: this is very sketchy, but should be enough to work off of.  The script currently looks for a name on a decoration on the item and, if it finds one, just copies that name into the artifact record.  But, you could manually edit the artifact_record::name through the interactive Lua interface.  You can find the word IDs (for name::words) at df.global.world.raws.language.words.  They're actually just indexed in the order they appear in language_words.txt.  The parts_of_speech is the specific variant of the word to use.  0 and 1 are singular and plural noun, for example.

You could also just skip all this, set all the words to -1, and then set the first_name to whatever you want, but that's less fun.

For an artifact weapon, you'll want to manually set the sharpness and such to the correct values for an artifact weapon.  Search on Google for a script called "artifake," which I based mine off of.  It sets the sharpness, so you can see how to do that from there.

EDIT: BTW, here's a useful thing for getting the word IDs:
Code: [Select]
for i,v in ipairs(df.global.world.raws.language.words) do dfhack.printerr(v.word .. ': ' .. i) endThat'll print the words and their IDs out to DFHack's error log.  Copy/paste them into a text file, and you'll have a reference for any time you need to look up word IDs.

I considered writing a script to parse language_names from plain text, which would actually not be too hard, since everything's there in raws.language.words.  The only tricky bit is the first, compound word.  You'd have to first search for single words matching it, then try every split position until you find one that gives you two valid words.  It ended up being overengineered for what I needed, though, so I've just been doing it manually when I need to.
« Last Edit: April 30, 2016, 03:10:05 pm by kane_t »
Logged

Droggarth

  • Bay Watcher
  • Ischrotaur Axe Lord [SUPERNATURAL][STRANGE_MOODS]
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4197 on: April 27, 2016, 07:10:10 pm »

-snip-

Thanks! Will look into this tomorrow or the day after in my currently on-halt adventure as I have sword that just needs it's own name and be registered as an artifact in the legends. Even if I can't achieve the latter, I'll be just content having at least my own sword with a custom name so I know that it has artifact quality.
And.. thanks! :)

Still need scripts/clues for DFhack sorcery to make my adventurer a necromancer. Honestly, all the worlds I've created I've noticed not a single necromancer tower. Probably because I always set the world age to generate only up to 5 years as to avoid lag and also because to be an ancient being in the DF world at the end of it's cycle. Kinda like the mighty Vikings with their gods of old with their stories of Ragnarök and gods doing battle with evil (Thor has always been my favorite of the Viking lore along with the hammer he has, Mjölnir).

EDIT: Ugh. I feel like my head is about to shutdown and my stomach lose it's lunch. Good grief, I just can't make heads and tails of coding stuff. I look at it, try to understand it and fail, fail after a fail, after a fail, after a fail, after a fail, after a fail, after a fail, after a fail, after a fail... somebody give me better brain. Or better yet.
A finished script with in-depth instructions of what the actual fuck I'm supposed to do.
« Last Edit: April 28, 2016, 11:17:42 am by Droggarth »
Logged
"I'll make my own way." - Max Rockatansky

kane_t

  • Bay Watcher
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4198 on: April 28, 2016, 12:06:47 pm »

BTW, for the folks working on df-structures, I've identified a flag for you.  This may already be known by now, but item_flags2[3] is the flag that indicates if a quire has a writing on it.  It's used along with a check for an itemimprovement_writingst in the quire's improvements list to determine if an item matches the "written-on quire" requirement for the "bind book" job.  (That requirement looks to be "HAS_WRITING_IMPROVEMENT," so that's maybe a good name for the flag.)

Incidentally, if you set the flag on a book binding, the job won't recognise it as a book binding anymore.  And the secondary check for an itemimprovement_writingst for the actual quire doesn't look to see if there's any actual writing on there, it'll queue up just fine with an empty anon_1 vector.

And, speaking of which, the anon_1 vector is the list of IDs of the writings on the quire.  Each one is a reference into df.global.world.written_contents.  I mentioned that a few pages back, though.

(EDIT: Also, written_content_type 23 is "star chart")
« Last Edit: April 28, 2016, 12:20:59 pm by kane_t »
Logged

Droggarth

  • Bay Watcher
  • Ischrotaur Axe Lord [SUPERNATURAL][STRANGE_MOODS]
    • View Profile
Re: DFHack 0.42.06-r1
« Reply #4199 on: April 28, 2016, 02:32:37 pm »

I gave up on the artifact/item naming thing for the time being as getting to be a necromancer is more important. Just went over all of the worlds in legends mode I've had adventurers in and NONE of them have necromancers and their towers in them, something to do with 'Age of Myth' and only 5 years in?

How old most the world be for them to generate!? Why of why can't I just turn my character into a necromancer!?? I have DFhack and don't know how to use it properly or at all, or barely. FUCK!!! >:(

*takes deep breather*

Look I'm just exhausted and furious from all the modding and reading and I just wanna play and enjoy the game and try out the necromancer in DF. To put it simply: I'm running on a very low thinking battery as of late when it comes to having to do something complicated.

By the way, do at least tombs have necromancers or slabs about necromancy in them because I seem to have alot of tombs in my generated worlds.
Logged
"I'll make my own way." - Max Rockatansky
Pages: 1 ... 278 279 [280] 281 282 ... 360