Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 151 152 [153] 154 155 ... 185

Author Topic: Text Will Be Text - dfhack plugin  (Read 799212 times)

YetAnotherLurker

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2280 on: December 10, 2017, 02:35:29 am »

Apologies if this has been answered, but I didn't find anything on a quick search. Does anyone know the correct overrides for constructed bookcases or instruments?
Logged

jecowa

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2281 on: December 10, 2017, 03:36:31 am »


I haven't tested, but here's the vanilla raws version of what Meph uses for the Bookcase: 
[OVERRIDE:240:I:TOOL:TOOL:13:_overridesfile_:2]

I'm kind of suspicious about it being marked as "I" instead of "B", but it's not like I really understand how they work. And if that was wrong it probably would have been noticed before now.

I'm kind of curious about how to override the new Pedestal and Display Case if any has found the Overrides codes for either of them.
Logged

Clément

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2282 on: December 10, 2017, 04:12:48 am »

My overrides for bookcases in 43.05 (item and building):
Code: [Select]
[OVERRIDE:240:I:TOOL:TOOL:23:furniture:0]
[OVERRIDE:240:B:30:Bookcase::furniture:0]

Edit: try this dfhack lua script. It prints overrides for the current selected item/building. It prints all possible ids, you should choose the most specific one.
Code: [Select]
local function make_override(letter, object, other_vector, type_enum)
if object then
local type = object:getType()
local subtype = object:getSubtype()
for id,objects in pairs(other_vector) do
for _,other_object in ipairs(objects) do
if other_object == object then
print ('[OVERRIDE:<old_tile>:' ..
       letter .. ':' ..
       id ..  ':' ..
       type_enum[type] ..  ':' ..
       (subtype ~= -1 and subtype or '') ..
       ':<tileset>:<new_tile>]')
break
end
end
end
end
end

make_override ('I', dfhack.gui.getSelectedItem(),
       df.global.world.items.other,
       df.item_type)
make_override ('B', dfhack.gui.getSelectedBuilding(),
               df.global.world.buildings.other,
       df.building_type)

Output example:
Code: [Select]
[OVERRIDE:<old_tile>:I:IN_PLAY:CABINET::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:I:ANY_FURNITURE:CABINET::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:I:CABINET:CABINET::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:I:ANY_GENERIC128:CABINET::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:IN_PLAY:Cabinet::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:ANY_ACTUAL:Cabinet::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:ANY_HOSPITAL_STORAGE:Cabinet::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:ANY_STORAGE:Cabinet::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:ANY_BARRACKS:Cabinet::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:CABINET:Cabinet::<tileset>:<new_tile>]
You should keep only the line with the "CABINET" id.
« Last Edit: December 10, 2017, 06:25:49 am by Clément »
Logged

YetAnotherLurker

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2283 on: December 10, 2017, 06:51:22 am »

Ooh. That looks exceptionally useful, will give it a try when I have the time. Thanks!
Logged

Amostubal

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2284 on: December 10, 2017, 11:27:03 am »

My overrides for bookcases in 43.05 (item and building):
Code: [Select]
[OVERRIDE:240:I:TOOL:TOOL:23:furniture:0]
[OVERRIDE:240:B:30:Bookcase::furniture:0]

Edit: try this dfhack lua script. It prints overrides for the current selected item/building. It prints all possible ids, you should choose the most specific one.
Code: [Select]
local function make_override(letter, object, other_vector, type_enum)
if object then
local type = object:getType()
local subtype = object:getSubtype()
for id,objects in pairs(other_vector) do
for _,other_object in ipairs(objects) do
if other_object == object then
print ('[OVERRIDE:<old_tile>:' ..
       letter .. ':' ..
       id ..  ':' ..
       type_enum[type] ..  ':' ..
       (subtype ~= -1 and subtype or '') ..
       ':<tileset>:<new_tile>]')
break
end
end
end
end
end

make_override ('I', dfhack.gui.getSelectedItem(),
       df.global.world.items.other,
       df.item_type)
make_override ('B', dfhack.gui.getSelectedBuilding(),
               df.global.world.buildings.other,
       df.building_type)

Output example:
Code: [Select]
[OVERRIDE:<old_tile>:I:IN_PLAY:CABINET::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:I:ANY_FURNITURE:CABINET::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:I:CABINET:CABINET::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:I:ANY_GENERIC128:CABINET::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:IN_PLAY:Cabinet::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:ANY_ACTUAL:Cabinet::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:ANY_HOSPITAL_STORAGE:Cabinet::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:ANY_STORAGE:Cabinet::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:ANY_BARRACKS:Cabinet::<tileset>:<new_tile>]
[OVERRIDE:<old_tile>:B:CABINET:Cabinet::<tileset>:<new_tile>]
You should keep only the line with the "CABINET" id.


Ooooohhhhhhh NICE!!!!!!!!!!

I need that, Is it apart of a large script or did you upload it somewhere?  That needs to be a part of the DFHack or TWBT scripts.
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

Clément

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2285 on: December 10, 2017, 11:49:09 am »

I just wrote it, it is not a part of a bigger script. You can copy the code in a .lua file in your hack/scripts folder and run it.

You can also add
Code: [Select]
local c = df.global.cursor
local tiletype = dfhack.maps.getTileBlock(c.x, c.y, c.z).tiletype[c.x%16][c.y%16]
print ('[OVERRIDE:<old_tile>:T:'..df.tiletype[tiletype]..':<tileset>:<new_tile>]')
to get the tile type under the cursor. I am not sure about the coordinate stuff, but it seemed to work well for me.

I am still a newbie at dfhack/lua scripting (I mostly used it for debugging DT), it can surely be improved. I don't even know how the get the size of the vector to automatically find the best id instead of printing all of them.
Logged

endoftheline

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2286 on: December 10, 2017, 05:27:49 pm »

I made a script that should make creating Linux version patches easier. Needs Python3.6, radare2 (I installed from git sources) and r2pipe for python (should be installable with pip)
Logged

Amostubal

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2287 on: December 10, 2017, 08:26:50 pm »

I just wrote it, it is not a part of a bigger script. You can copy the code in a .lua file in your hack/scripts folder and run it.

You can also add
Code: [Select]
local c = df.global.cursor
local tiletype = dfhack.maps.getTileBlock(c.x, c.y, c.z).tiletype[c.x%16][c.y%16]
print ('[OVERRIDE:<old_tile>:T:'..df.tiletype[tiletype]..':<tileset>:<new_tile>]')
to get the tile type under the cursor. I am not sure about the coordinate stuff, but it seemed to work well for me.

I am still a newbie at dfhack/lua scripting (I mostly used it for debugging DT), it can surely be improved. I don't even know how the get the size of the vector to automatically find the best id instead of printing all of them.

I  will admit I got a little excited at first, Yeah I can see this needs a little more work.  I can put it in the list of stuff I'm writing and see if I can get it up to working order, give it a full wrapper so you only need to make one call and have it display for whatever is selected.  If you don't mind me jumping on the concept.  It may take me a bit of time, I have many commitments, probably a week.
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

Clément

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2288 on: December 11, 2017, 05:38:17 am »

No problem, go ahead.

A few more details about the id part. If I understand twbt code correctly, it look for every item/building in the other[id] vector. So, using the most generic id (IN_PLAY) would work, but for efficiency the smallest vector should be preferred. (Can you confirm that, mifki?) The improved script should look for the smallest vector containing a reference to the item/building and use only this id.
Logged

mifki

  • Bay Watcher
  • works secretly...
    • View Profile
    • mifki
Re: Text Will Be Text - dfhack plugin
« Reply #2289 on: December 11, 2017, 06:05:33 am »

No problem, go ahead.

A few more details about the id part. If I understand twbt code correctly, it look for every item/building in the other[id] vector. So, using the most generic id (IN_PLAY) would work, but for efficiency the smallest vector should be preferred. (Can you confirm that, mifki?) The improved script should look for the smallest vector containing a reference to the item/building and use only this id.

Right, please don't use IN_PLAY, that will be terribly slow (well, computers are fast now, so at least terribly inefficient). For all items/buildings there should be only one id (apart from generic ones) that in most cases named after item/building type, so it should be easy to find. As I understand, the problem is only with the new display furniture because its id is not named properly in dfhack yet.

I'll eventually reimplement overrides more efficiently which is now possible with the "Next" version, and override specification will be simplified too.

I made a script that should make creating Linux version patches easier. Needs Python3.6, radare2 (I installed from git sources) and r2pipe for python (should be installable with pip)

That's cool, I was going to do that for a long time, maybe now I'll finally automate patching for other platforms as well.

Amostubal

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2290 on: December 12, 2017, 11:26:31 pm »


I'll eventually reimplement overrides more efficiently which is now possible with the "Next" version, and override specification will be simplified too.

I really want to know exactly the meaning of this line... I am really interested in what you have planned "Next".
Logged
Legendary Dwarf Fortress
Legendary Discord Group
"...peering into the darkness behind the curtains, evokes visions of pixies being chased by dragons while eating cupcakes made of coral iced with liquid fire while their hearts burn out with unknown plant substances..." - a quote from the diaries of Amostubal

jecowa

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2291 on: December 13, 2017, 01:10:34 am »

I really want to know exactly the meaning of this line... I am really interested in what you have planned "Next".

It's in the second screenshot of the OP:
And it's already been merged back into the main build.

Tips if you can't figure out what's going on in the screenshot:
  • Look at what is underneath the chairs and the caskets.
  • Also look at the color of the blades of the weapons on the weapons rack. Look at the color of the sheets on the bed and the color of the armor on the armor stand.

I'm really interested in those simplified Overrides. Those things are kind of hard for me.
Logged

Clément

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2292 on: December 13, 2017, 08:38:38 am »

I changed my dfhack script so it only prints the best id. I does not always work well if there are multiple best IDs (if all items/buildings in a generic category are the same type, it is the same size as the most specific category).
Logged

Acolyte

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2293 on: December 14, 2017, 10:29:18 pm »

I asked in another thread - would TWBT-Next be able to render a stockpile with transparent parts so that you can see the floor underneath?

   - Shane
Logged

point08

  • Bay Watcher
    • View Profile
Re: Text Will Be Text - dfhack plugin
« Reply #2294 on: December 15, 2017, 02:15:18 pm »

Hopefully this is the right place to mention this, but I'm having issues while using TWBT on the newest DF version (using the Alpha of DF Hack).  When I set my game to play in a window and use TWBT, it cuts some off of the top and bottom of the window....it looks like about the size of the window title bar.  I noticed this because the FPS counter gets blocked out.

If I change to TWBT Classic, 2D, etc then the screen fits in the window fine.  TWBT works fine in full screen as well, it's only cut off in the windowed mode.  I've attempted changing the init.txt to different values for the windowed mode and it doesn't correct the issue.  Any ideas on what's going on?  I can provide screenshots if you like.
Logged
Pages: 1 ... 151 152 [153] 154 155 ... 185