Bay 12 Games Forum

Dwarf Fortress => DF Modding => Mod Releases => Topic started by: Raidau on January 19, 2015, 04:55:29 am

Title: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Raidau on January 19, 2015, 04:55:29 am
Hi guys, while my mod is not ready for release, i decided to upload a standalone version of one of my last scripts.

It shows vast amount of useful information on item view screen. Armor and weapon properties, important material stats. Easy and convenient - does not need to be manually activated every time, works in fortress and adventure modes. Custom descriptions can be added to every kind of item or material - they are stored in txt files and thus easily moddable. Also spports moddable ASCII images for every creature and item in the game. Double tap Enter of ESC to close ASCII image popup.

Download here (http://dffd.bay12games.com/file.php?id=10471) (or from GitHub (https://github.com/Raidau/public_scripts/blob/master/nb_item_info.lua))

Desription repository - feel free to contribute! (http://www.bay12forums.com/smf/index.php?topic=147886.0)

Here are examples how it looks:

(http://i.imgur.com/weMw6gt.png)
(http://i.imgur.com/AYsXC4b.png?1)
(http://i.imgur.com/WL4ueaC.png)
(http://i.imgur.com/pdFqYzm.jpg)

Currently shows user-defined text, material info and temperature for all non-caste items (and even bone body parts 8) ), armor properties, weapon stats for weapons and combat-usable tools, food properties for suitable items. Does not replace existing lines (like reactions and ore metals).

Material strength data percentages are relative to IRON inorganic, or if it is absent (in your mod), to the first inorganic defined in the raws.

ASCII images are loaded from txt files. You may add your custom ascii images for every creature and items, usind their raw tokens (see modding instructions in the mod archive). To enable ASCII use "ascii_item" and "ascii_unit" arguments (in any order), e.g. run script with command "nb_item_info ascii_item"

Custom description guide:
Spoiler (click to show/hide)

I would really appreciate corrections related to phrases used by the script, since english is not my first language.

Tested with DFHack 0.40.23-r1 on Windows

Changelog:
Spoiler (click to show/hide)
Title: Re: [Utility script] Extended item viewscreen
Post by: Putnam on January 19, 2015, 10:54:20 pm
http://www.bay12forums.com/smf/index.php?board=29.0

Also:

df.item_type[type] gives you the ID, you don't need that table lookup. df.item_type[id] gives you the type, as well.
Title: Re: [Utility script] Extended item viewscreen
Post by: Raidau on January 20, 2015, 12:01:24 am
http://www.bay12forums.com/smf/index.php?board=29.0

Also:

df.item_type[type] gives you the ID, you don't need that table lookup. df.item_type[id] gives you the type, as well.

Thanks, i even have created a separate topic and asked how to get the id... Now I have the answer :)
Title: Re: [Utility script] Extended item viewscreen
Post by: PeridexisErrant on January 20, 2015, 06:59:57 am
This looks great!  Is there anywhere with all your scripts, and have you considered adding them to standard DFHack?
Title: Re: [Utility script] Extended item viewscreen
Post by: Raidau on January 20, 2015, 07:38:53 am
This looks great!  Is there anywhere with all your scripts, and have you considered adding them to standard DFHack?

Well.. this is the first script i posted so far, the mod is WIP and everything is being tested/redone quite often, this one is quite simple and vanilla-compatible, so I feel it was ready to be released stand-alone. I hope new DFHack will arrive soon (planning to release the alpha for 40.24)
Title: Re: [Utility script] Extended item viewscreen
Post by: Deon on January 20, 2015, 07:53:43 am
Is there a chance for this to add/parse any additional information like description which is not visible to DF parser? It would be amazing to use this to actually explain what weapons/armors are and what they fit for.
Title: Re: [Utility script] Extended item viewscreen
Post by: Raidau on January 20, 2015, 08:09:58 am
Is there a chance for this to add/parse any additional information like description which is not visible to DF parser? It would be amazing to use this to actually explain what weapons/armors are and what they fit for.

Any next can be split into separate lines and added like this (i dont know if there is any limit of how many lines it shows). Even from external text file. I would not be hard to add this. (Actually i was thinking on making a separate mod that loads custom item description and shows it in pop-up window, but i gave up that idea in favor of this one.). I even think i know how to organize folder with custom descriptions to make it easily understandable for anyone who wish to expand the description database. Yeah, I feel like I gonna do this :)
Title: Re: [Utility script] Extended item viewscreen
Post by: Deon on January 20, 2015, 08:48:52 am
That would be amazing, I always missed this possibility to describe what you add to total conversion mods so people would not be so confused.
Title: Re: [Utility script] Extended item viewscreen
Post by: Raidau on January 20, 2015, 10:59:08 am
That would be amazing, I always missed this possibility to describe what you add to total conversion mods so people would not be so confused.

Done, now there is a possibility to make descriptions for every item. I did not add any descriptions except some examples. Instructions also included in this release. I really hope people will be interested in this and fill descriptions for vanilla items (may just be short summaries from the wiki)
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Dirst on January 20, 2015, 11:29:00 am
Item descriptions... awesome!

This is a thing.  This specific thing is a noun.  It is composed of matter, and has both a size and an appearance.

I like that the descriptions file wouldn't interfere with anything if the script is not installed, but it might be better to have it tucked in a corner of the raw folder.  That way it should copy with a save and pack nicely with a mod.

No sweat if that's not feasible, it's not like Stonesense puts its custom item data under raw either.
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Raidau on January 20, 2015, 11:33:51 am
Item descriptions... awesome!

This is a thing.  This specific thing is a noun.  It is composed of matter, and has both a size and an appearance.

I like that the descriptions file wouldn't interfere with anything if the script is not installed, but it might be better to have it tucked in a corner of the raw folder.  That way it should copy with a save and pack nicely with a mod.

No sweat if that's not feasible, it's not like Stonesense puts its custom item data under raw either.

Thats just the initial release, I consider moving descriptions to raw folder too :) Though it needs to open save folder if you wish to update your descriptions, which is less convenient... But yes, people use different mod with different descriptions. So it gets moved to the raw folder
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Deon on January 20, 2015, 01:44:22 pm
That would be amazing, I always missed this possibility to describe what you add to total conversion mods so people would not be so confused.

Done, now there is a possibility to make descriptions for every item. I did not add any descriptions except some examles. Instructions also included in this release. I really hope people will be interested in this and fill descriptions for vanilla items (may just be short summaries from the wiki)
Wooo, thank you very much for including it straight away! I am making my new mod from the scratch, so it's easier to include everything as I go and add items (and I mean it, I think I'm making everything but base materials) than to go through everything later and add descriptions.
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Raidau on January 20, 2015, 02:05:18 pm

Wooo, thank you very much for including it straight away! I am making my new mod from the scratch, so it's easier to include everything as I go and add items (and I mean it, I think I'm making everything but base materials) than to go through everything later and add descriptions.

I tell you more - right now im working on the same thing for materials - so every material can also be manually described and included in item description :)
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Meph on January 20, 2015, 02:18:50 pm
If you knew how many people wished for something like that. This is amazing. Truly. In terms of user-friendlyness, this trumps twbt's itemgraphics by far.

Custom descriptions of items.  :o

Damn...
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Raidau on January 20, 2015, 02:24:19 pm
If you knew how many people wished for something like that. This is amazing. Truly. In terms of user-friendlyness, this trumps twbt's itemgraphics by far.

Custom descriptions of items.  :o

Damn...

If you put some labor in the text file.. you can even have ASCII images of the items XD

Or this could be handy in-game wiki articles replacement, though it need a lot of time to fill everything...
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: IndigoFenix on January 20, 2015, 02:27:57 pm
Nice...That's all that could be said.  Well done.
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Deon on January 20, 2015, 02:34:17 pm
If you knew how many people wished for something like that. This is amazing. Truly. In terms of user-friendlyness, this trumps twbt's itemgraphics by far.

Custom descriptions of items.  :o

Damn...

If you put some labor in the text file.. you can even have ASCII images of the items XD

Or this could be handy in-game wiki articles replacement, though it need a lot of time to fill everything...
Hell yeah, DOOM Roguelike-style! Does it support colored characters?
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Raidau on January 20, 2015, 02:43:41 pm

Hell yeah, DOOM Roguelike-style! Does it support colored characters?

I dont think so, i didnt find any possibility to give strings a new color. BUT spatter lines are greeen, and contained items are always brown. Anyway, I doubt that its possible to make different color characters appear within same line.
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Deon on January 20, 2015, 02:52:01 pm
I am not sure but I think back in the days when I was working with WTF editor modifying announcements/dialogue for traders, I've seen some code which was translated into color. If I find it, I will let you know.
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Meph on January 20, 2015, 02:54:44 pm
Yes, I was thinking of an ingame manual replacement. At least concerning items.

I do that already with my "===SKILL x===" reactions in workshops, to let players know which skill they need in workshops. But this? Its much better.

The less outside info I have to force-feed players (through third-party means, like a manual), the more accessable the mod will be.
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Putnam on January 20, 2015, 02:57:36 pm
Yes, I was thinking of an ingame manual replacement. At least concerning items.

I do that already with my "===SKILL x===" reactions in workshops, to let players know which skill they need in workshops. But this? Its much better.

The less outside info I have to force-feed players (through third-party means, like a manual), the more accessable the mod will be.

You could also write more in-game help files with the WTF editor.
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Raidau on January 20, 2015, 03:07:02 pm

You could also write more in-game help files with the WTF editor.

What is that thing? :)
Title: Re: Extended item viewscreen, custom item desctiptions!
Post by: Meph on January 20, 2015, 03:09:01 pm
I tried that once, but thats both more work for me and the player to read/write than an external manual. Text-only navigation in text-only pages with a rather rigid formatting is not very user friendly.

@Raidau: It lets you alter the ingame help sites, embark message and messages that caravans and liaisons show the player. Some mods, mostly total conversion, use it to create a nicer atmosphere, for example Deons Fallout mod, or a reference to the other playable races in Masterwork.
Title: Re: Extended item viewscreen, custom item descriptions!
Post by: Deon on January 20, 2015, 03:17:25 pm
Sadly DFHack is not officially supported for .24. But it's not a problem, I guess by the time I am done with the first release of the mod, it will be supported.

Just a few screenshots of happiness.

Taffer's tileset and graphics:
(http://img.prntscr.com/img?url=http://i.imgur.com/8ueuhZL.png)

Raidau's custom item description:
(http://img.prntscr.com/img?url=http://i.imgur.com/aCWkC3P.png)

You guys are the absolute best.
Title: Re: Extended item viewscreen, custom item descriptions!
Post by: Dirst on January 20, 2015, 03:26:48 pm
That's the editor I was looking for... thanks for saving me time by ninja'ing :)

The nice thing about the WTF format is that it allows hyperlinks.  I don't know if it's possible to put WTF text on an arbitrary bit of screen (and if that's do-able with Lua), but it would allow the player to go from an iron pick to iron to hematite to stone to layer stone to marble to flux to ...

Okay, maybe reproducing the entire wiki in-game isn't a good idea.  A better use of help pages would be mod-specific concepts. 

A different idea doesn't require this tool to understand WTF itself: is it possible to launch a browser page from within DFHack?  A single alt-h command could call up a help page with the item's title, falling back to the wiki in a browser for the vast majority of times that such a help page doesn't exist.  Might require a special line at the top of the description file to designate the help-file and URL.
Title: Re: Extended item viewscreen, custom item descriptions!
Post by: Meph on January 20, 2015, 03:34:29 pm
You can put URLs in it, and if the player presses ENTER then DF will minimize and the link will open in the default browser. I tested that.
Title: Re: Extended item viewscreen, custom item descriptions!
Post by: Raidau on January 20, 2015, 03:43:59 pm
Ok, here is version 3.0  8)

It supports custom descriptions for materials. Either by creating separate files, or by adding a special reaction class to the material itself, the reaction class points to filename to load description from.
Title: Re: Extended item viewscreen, custom item descriptions!
Post by: Raidau on January 20, 2015, 04:21:13 pm
There was a bug that caused the script to crash... just fixed that. I hope noone experienced the problems :)

its 3.1 now
Title: Re: Extended item viewscreen, custom item descriptions! v 3.1
Post by: Deon on January 20, 2015, 04:49:52 pm
Thanks, going to bed now, I will make sure to test it tomorrow. I cannot explain how happy I am that this exists.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.1
Post by: Meph on January 20, 2015, 05:44:59 pm
Thanks, going to bed now, I will make sure to test it tomorrow. I cannot explain how happy I am that this exists.
Same here :)

Its perfect for Peridexis beginner pack too. More player info is always nice.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.1
Post by: PeridexisErrant on January 20, 2015, 06:51:54 pm
Thanks, going to bed now, I will make sure to test it tomorrow. I cannot explain how happy I am that this exists.
Same here :)

Its perfect for Peridexis beginner pack too. More player info is always nice.

Wow, yeah. This is awesomely helpful for new players  - and like TwbT item tiles, easy to set up for vanilla.  This is going to be awesome.
Title: Re: Extended item viewscreen, custom item descriptions!
Post by: Dirst on January 20, 2015, 08:19:35 pm
You can put URLs in it, and if the player presses ENTER then DF will minimize and the link will open in the default browser. I tested that.
That's in WTF text. Since I don't know how complicated it would be to render WTF on the item description screen, I was asking if it's possible to launch a URL from DFHack (from an alt-h command or something).

Of course, if WTF is trivial then it's a moot point.

Edit: Link to the WTF editor (http://dffd.bay12games.com/file.php?id=4175).  Still don't know what it takes to render WTF text to the screen.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.1
Post by: Bloax on January 21, 2015, 01:18:17 am
Item descriptions are like the one thing that have been missing since forever because how are you even supposed to know that a Kisre is a tiny dagger and a Kisraee is a huge two-handed sword and a Bisbeth is actually a spear.

jesus fuck finally
thanks
Title: Re: Extended item viewscreen, custom item descriptions!
Post by: Raidau on January 21, 2015, 08:50:31 pm
You can put URLs in it, and if the player presses ENTER then DF will minimize and the link will open in the default browser. I tested that.
That's in WTF text. Since I don't know how complicated it would be to render WTF on the item description screen, I was asking if it's possible to launch a URL from DFHack (from an alt-h command or something).

Of course, if WTF is trivial then it's a moot point.

Edit: Link to the WTF editor (http://dffd.bay12games.com/file.php?id=4175).  Still don't know what it takes to render WTF text to the screen.

Thanks for the link. I perfectly understand the format of text in text viewer screen and my script could do anything with default DF description page, but i have no idea how to make text screen update after it has been loaded. It seems that only source text can be easilty changed (i use gm-editor), not the one already on the screen... If anyone knows how to make game refresh text viewscreen, i could make the script that lets you alter it, with colors and all the cool stuff.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.1
Post by: Putnam on January 21, 2015, 09:08:47 pm
The main problem is that Lua interacts with the text viewscreen really weirdly. AFAIK it's a char[], but it just treats it as a char or something so it displays wrongly.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.1
Post by: Raidau on January 22, 2015, 12:17:21 am
The main problem is that Lua interacts with the text viewscreen really weirdly. AFAIK it's a char[], but it just treats it as a char or something so it displays wrongly.

The text on the screen does not change when I alter source_text fields in gm-editor. BUT if i change indents, the changes can be seen.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Putnam on January 22, 2015, 12:20:11 am
I meant formatted_text, sorry.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 22, 2015, 12:39:14 am
I meant formatted_text, sorry.

Anyway, do you have any ideas how to make the screen actually update itself? :)
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Grimlocke on January 22, 2015, 01:05:27 am
My rantings prayers have been answered! Can't believe I didn't see this earlier.

I will be using the hell out of this.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 22, 2015, 05:34:41 am
Good news. Seems that now I understand how I can add ASCII images for EVERYTHING in game (visible once you open its text description)

Does anyone know what runtime data should i alter to change zoom level? Or is it possible to give different size to popup characters?

(http://i.imgur.com/VzbztXJ.jpg)
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Meph on January 22, 2015, 06:11:39 am
 :o

Omg, that will be such a fun project. Large ascii item and creature graphics for vanilla, I think I might do that. :D

Once you release this, please make sure to include an idiot-proof manual plus example for people to work with.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 22, 2015, 06:40:18 am
:o

Omg, that will be such a fun project. Large ascii item and creature graphics for vanilla, I think I might do that. :D

Once you release this, please make sure to include an idiot-proof manual plus example for people to work with.

Sure :) i think i will use same filename algorythm as with extended item view, so people dont confuse so much if they are familiar with raw tokens
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 22, 2015, 09:11:28 am
Quite easy, to be honest.

Now there can be an ASCII image for every item type (and subtype), and every creature/caste pair.

They are quite large and tend to occupy most of screen space, but that problem is to be solved in the future. I need some advice on how to make popup window stick to the bottom of the screen and how to dinamically change game's zoom level.

A good ASCII artist could make small images that look cool, but I just used avaliable image converter to make some examples.

I did not add any fancy things like different quality images or different images for different professions yet, but its quite possible.

(http://i.imgur.com/GZ7XItn.png?1)
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Meph on January 22, 2015, 09:30:35 am
I think black and white ascii is perfectly fine.

Is the size affected by the tileset you use? Did you try this out with Twbt? It looks like you got a pretty high screen resolution, I'm just wondering what happens to people that play on a netbook/laptop.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 22, 2015, 09:38:22 am
I think black and white ascii is perfectly fine.

Is the size affected by the tileset you use? Did you try this out with Twbt? It looks like you got a pretty high screen resolution, I'm just wondering what happens to people that play on a netbook/laptop.

Its twbt. ASCII is not compatible with traditional tileset mode, most  it looks like rubbish :). I tried that earlier. Yeah, I m ising 1920x1080 monitor, ASCII with fullscreen but in small window its not enough screen space to show whole large image (like example ones).
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Meph on January 22, 2015, 09:44:07 am
Best to figure out which resolution works best with which size. I could imagine that a 1024 set and a set for 1920 would be reasonable. Same images, just compressed size for the people with smaller screens.

Do you have an extra tileset for this? Like a text-only tileset, or is your ascii image displayed in actual characters/glyphs/text?
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 22, 2015, 10:52:01 am
Best to figure out which resolution works best with which size. I could imagine that a 1024 set and a set for 1920 would be reasonable. Same images, just compressed size for the people with smaller screens.

Do you have an extra tileset for this? Like a text-only tileset, or is your ascii image displayed in actual characters/glyphs/text?

That is default text tileset for TWBT. Default game with ASCII graphics will have the same look (in text view screen). I did not put any time into making special artwork or tileset variation. People always can manually switch between ascii image sets (i think LNP mod merge will work).
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Dirst on January 22, 2015, 11:24:13 am
The TWBT, Rendermax and Stonesense demonstrated that you can do something other than putting standard-color glyphs on the screen, though it does require delving into C++.

As with the Dwarf Visualizer, this is the kind of utility that could really, really use a way to blit a bitmapped image onto the DF screen.  Or even a pop-up window from DFHack.  Then there's no need to convert everything into ASCII, and scaling is much easier.

The Rube-Goldberg method would be to put a WTF link on the page that links to a local image file that would appear in the user's default browser.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 22, 2015, 12:28:57 pm
The TWBT, Rendermax and Stonesense demonstrated that you can do something other than putting standard-color glyphs on the screen, though it does require delving into C++.

As with the Dwarf Visualizer, this is the kind of utility that could really, really use a way to blit a bitmapped image onto the DF screen.  Or even a pop-up window from DFHack.  Then there's no need to convert everything into ASCII, and scaling is much easier.

The Rube-Goldberg method would be to put a WTF link on the page that links to a local image file that would appear in the user's default browser.

I tried to find a way to paint a colored pixel image, but DFHack screen painting system is too complicated for me, have no idea how to make something actually appear on the screen :) ... Thats a task for DFHack devs, not me (at least at this moment).
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Dirst on January 22, 2015, 12:39:46 pm
The TWBT, Rendermax and Stonesense demonstrated that you can do something other than putting standard-color glyphs on the screen, though it does require delving into C++.

As with the Dwarf Visualizer, this is the kind of utility that could really, really use a way to blit a bitmapped image onto the DF screen.  Or even a pop-up window from DFHack.  Then there's no need to convert everything into ASCII, and scaling is much easier.

The Rube-Goldberg method would be to put a WTF link on the page that links to a local image file that would appear in the user's default browser.

I tried to find a way to paint a colored pixel image, but DFHack screen painting system is too complicated for me, have no idea how to make something actually appear on the screen :) ... Thats a task for DFHack devs, not me (at least at this moment).
Sorry if I wasn't clear, the idea was for a plugin jockey to suggest something about viewing images.  An image capability that would really helpful to this project, but actually building it is obviously out of scope.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Meph on January 22, 2015, 01:40:22 pm
Regardless of the possibility of actual pictures, I personally would like ascii pics more. They fit the theme of DF better.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 22, 2015, 10:59:12 pm

Sorry if I wasn't clear, the idea was for a plugin jockey to suggest something about viewing images.  An image capability that would really helpful to this project, but actually building it is obviously out of scope.

The algorythm may be simple as shit, but i wish somebody explained me how to paint on DF screen using lua syntax :)
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Putnam on January 22, 2015, 11:19:35 pm
Depends what you mean by "paint".
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 22, 2015, 11:39:18 pm
Depends what you mean by "paint".

Changing tile characters and color of those characters . (That could also be just DFHack popup with colored tiles instead of text)
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Putnam on January 22, 2015, 11:45:47 pm
https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst#screen-api

There's a description of the "pen" object there.
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 22, 2015, 11:47:27 pm
https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst#screen-api

There's a description of the "pen" object there.

Well, I have read that but dont understand how to make it work, though I seem I was successfull at defining a pen :)
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Putnam on January 23, 2015, 12:00:30 am
You need your own viewscreen, which you can make by just using a table.

It's all kind of confusingly put together, yeah. It probably ought to mention how to make a viewscreen before going into manipulating them.

EDIT: Also, your GetItemTypeID(item) can be replaced with item:getType() and df.item_type[item:getType()].
Title: Re: Extended item viewscreen, custom item descriptions! v 3.2
Post by: Raidau on January 23, 2015, 12:40:52 am
EDIT: Also, your GetItemTypeID(item) can be replaced with item:getType() and df.item_type[item:getType()].

I always knew there is an easier way :) thanks
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.0 beta
Post by: Raidau on January 25, 2015, 05:42:32 am
New release! Now with custom ASCII art and item value in adventure mode. Currently there are some inconvenience with images, you need to double-tab to close the image. Also image is only shown if you view description page after general information page. (like monster status in adventure mode, owned buildings list in fortress mode, or item viewscreen)

I will appreciate any code help related to how to recognize what the description belongs to if text viewer screen doesnt have parent view, and how to avoid need for double-tap restriction (so the image is not shown again once you close it)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.0 beta
Post by: fricy on January 25, 2015, 09:42:49 am
PTW, great work, also letting you know that 3.2 is in latest Macnewbie.

However: I copied the item_description folder to df/raw and to save/raw, but can't make descriptions appear in game.
Spoiler (click to show/hide)
According to debug mode this is the path the script tries to access:
Code: [Select]
/Applications/Macnewbie_9.16/Macnewbie/Dwarf Fortress/data/save/region3-lowfps\raw\item_descriptions\WEAPON\ITEM_WEAPON_AXE_BATTLE.txtNote the difference in slashes after data/save/ I suspect this issue is present on linux too.

A different issue is with material properties illustrated here:
Spoiler (click to show/hide)
Those long lines need to be formatted differently to be usable.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.0 beta
Post by: Raidau on January 25, 2015, 11:24:11 am
PTW, great work, also letting you know that 3.2 is in latest Macnewbie.

However: I copied the item_description folder to df/raw and to save/raw, but can't make descriptions appear in game.
Spoiler (click to show/hide)
According to debug mode this is the path the script tries to access:
Code: [Select]
/Applications/Macnewbie_9.16/Macnewbie/Dwarf Fortress/data/save/region3-lowfps\raw\item_descriptions\WEAPON\ITEM_WEAPON_AXE_BATTLE.txtNote the difference in slashes after data/save/ I suspect this issue is present on linux too.

A different issue is with material properties illustrated here:
Spoiler (click to show/hide)
Those long lines need to be formatted differently to be usable.

1. Replaced the slashes in new version (which has been released just now)

2. I tested this with twbt and its standatd text tileset. I was to lazy to switch to 2D and check how it looks :) Ok its now just "fr." and" el.", hope this will be enough for strings to fit the screen.

I think we could really need some repository with descriptions. Its quite a tedious and long work, yet all it needs is to make summaries of wiki articles :) Just need to decide which forum section that thread will suit :)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.0 beta
Post by: lethosor on January 25, 2015, 11:36:52 am
Have you considered hosting this on Github (or another git host)? It would make tracking and merging changes a lot easier, if it were to be included in DFHack, compared to downloading a single compressed file and trying to merge changes by hand. Scripts included in DFHack that are solely hosted on DFFD tend to become outdated quickly (see dfstatus for an example).
Also, this really should be in the utilities subforum.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.1 beta
Post by: Sergarr on January 25, 2015, 01:55:25 pm
:O

this is so awesome
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.1 beta
Post by: fricy on January 25, 2015, 02:07:53 pm
Quote
1. Replaced the slashes in new version (which has been released just now)
2. I tested this with twbt and its standatd text tileset. I was to lazy to switch to 2D and check how it looks :) Ok its now just "fr." and" el.", hope this will be enough for strings to fit the screen.

Descriptions work now, and I think with fr. and el. the screen is usable.
There's a small problem with the line endings, the windows EOL symbols are interpreted as music notes on mac, converting to unix line endings solved this on my end.

ASCII pictures are still not displayed. Is there some configuration I'm missing to make them work?

Quote
Have you considered hosting this on Github (or another git host)? It would make tracking and merging changes a lot easier...
Also, this really should be in the utilities subforum.
Strongly agreed.
@lethosor: Since the wiki already stores all the raws and the descriptions, do you think there's an easy way to generate a bunch of text files from that db with the descriptions and the proper file names to kickstart this project?
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.1 beta
Post by: lethosor on January 25, 2015, 04:54:59 pm
@lethosor: Since the wiki already stores all the raws and the descriptions, do you think there's an easy way to generate a bunch of text files from that db with the descriptions and the proper file names to kickstart this project?
There's no difference between what's stored on the wiki and the raw files (in fact, the raws on the wiki may be outdated).
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.1 beta
Post by: Dirst on January 25, 2015, 05:11:32 pm
@lethosor: Since the wiki already stores all the raws and the descriptions, do you think there's an easy way to generate a bunch of text files from that db with the descriptions and the proper file names to kickstart this project?
There's no difference between what's stored on the wiki and the raw files (in fact, the raws on the wiki may be outdated).
For items that have descriptions in the raws, the wiki shows them in italics at the beginning of the article.  fricy is asking for the equivalent text being extracted from the wikitext so that it can be made into a brief description for a vanilla item that doesn't have a DESCRIPTION tag.

Gems seem to do this fairly consistently; I'm not sure what else on the wiki is that predictable.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.1 beta
Post by: lethosor on January 25, 2015, 05:17:28 pm
@lethosor: Since the wiki already stores all the raws and the descriptions, do you think there's an easy way to generate a bunch of text files from that db with the descriptions and the proper file names to kickstart this project?
There's no difference between what's stored on the wiki and the raw files (in fact, the raws on the wiki may be outdated).
For items that have descriptions in the raws, the wiki shows them in italics at the beginning of the article.  fricy is asking for the equivalent text being extracted from the wikitext so that it can be made into a brief description for a vanilla item that doesn't have a DESCRIPTION tag.

Gems seem to do this fairly consistently; I'm not sure what else on the wiki is that predictable.
It would be easier to extract that text from the raws - it's only the value of the [DESCRIPTION] token for creatures. (What items are you referring to?)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.1 beta
Post by: Dirst on January 25, 2015, 05:51:05 pm
@lethosor: Since the wiki already stores all the raws and the descriptions, do you think there's an easy way to generate a bunch of text files from that db with the descriptions and the proper file names to kickstart this project?
There's no difference between what's stored on the wiki and the raw files (in fact, the raws on the wiki may be outdated).
For items that have descriptions in the raws, the wiki shows them in italics at the beginning of the article.  fricy is asking for the equivalent text being extracted from the wikitext so that it can be made into a brief description for a vanilla item that doesn't have a DESCRIPTION tag.

Gems seem to do this fairly consistently; I'm not sure what else on the wiki is that predictable.
It would be easier to extract that text from the raws - it's only the value of the [DESCRIPTION] token for creatures. (What items are you referring to?)
Pretty much every item in the game that can be "viewed" but doesn't have a description in the raws (weapons, armor, tools, toys, etc.) plus all of the materials.  As I said, the gems might work, but I'm not too hopeful of finding a useable pattern in items' wikipages.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.1 beta
Post by: Raidau on January 25, 2015, 10:51:26 pm

ASCII pictures are still not displayed. Is there some configuration I'm missing to make them work?


"ascii_item" and "ascii_unit" arguments enable corresponding ascii art

UPDATE: Added the script and the repository to GitHub
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.1 beta
Post by: Putnam on January 26, 2015, 02:43:30 am
Fracture/Yield are in Kilopascals, btw.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.1 beta
Post by: Raidau on January 26, 2015, 04:02:40 am
Fracture/Yield are in Kilopascals, btw.

thx, but I think i better omit the units to make lines shorter :)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.1 beta
Post by: Putnam on January 26, 2015, 04:07:10 am
Wait, or maybe just pascals. Either way, it's 2-3 character (kPa, Pa)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Meph on January 26, 2015, 04:57:39 am
I agree, this should be in utilities.

Once a complete set with descriptions and ascii art is done, it can be released as a mod.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Sergarr on January 26, 2015, 10:16:43 am
Yields for steel should be in the ballpark of 200 MPa so tread accordingly
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Warmist on January 26, 2015, 10:33:01 am
Oh man i was hoping that somebody does this! First time my laziness pays off :)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: pisskop on January 26, 2015, 10:34:36 am
oh my
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Warmist on January 27, 2015, 03:48:08 am
Hmm now that i look at this, you are using default viewscreen and just adding new strings to it. Maybe it would be better to have a new screen alltogether (and then e.g. canceling would quit from both screens). Though you would need to re-implement old behavior (reaction products?) but you could have more features (e.g. hyperlinks for item material/syndromes/castes/whatever, inline ascii art).

If you would like that i could try to make tutorial-ish viewscreen example.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 27, 2015, 04:00:50 am
Hmm now that i look at this, you are using default viewscreen and just adding new strings to it. Maybe it would be better to have a new screen alltogether (and then e.g. canceling would quit from both screens). Though you would need to re-implement old behavior (reaction products?) but you could have more features (e.g. hyperlinks for item material/syndromes/castes/whatever, inline ascii art).

If you would like that i could try to make tutorial-ish viewscreen example.

Well, dfhack screens are a big mystery for me. Are you talking about a full reimplementation of item view screen built inside a single DFHack screen? Hyperlinks and all that kind of stuff would be incredible, but that will take a lot of time (I am trying to finish my Natural Balance alpha and upload it ASAP).

There is an upside of using existing DF screen - it supports truetype.

All the modders (I suppose) would appreciate such tutorial :)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: PeridexisErrant on January 27, 2015, 04:35:46 am
My vote is to go for it - this would be amazing, and Truetype is no loss anyway, since it's buggy and utterly inferior to TwbT. Whoever want to do it, go crazy!
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Meph on January 27, 2015, 05:03:59 am
Both the Starter pack and Masterwork use Twbt by default, which excludes truetype. I assume that most people play without ttf by now. Most people that use fancy utilities and mods, that is. :D
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: scamtank on January 27, 2015, 05:36:09 am
Yo I caught a dumbass little bug in how soap materials are reported.

(http://i.imgur.com/fR0y8wt.png)

How silly it looks! Turns out, this:
Code: [Select]
table.insert(list,"Used to make soap"..dfhack.matinfo.decode(mat_type, mat_index).material.state_name.Liquid)
...should rather read like this:
Code: [Select]
table.insert(list,"Used to make "..dfhack.matinfo.decode(mat_type, mat_index).material.state_name.Solid)
(http://i.imgur.com/kQZ2mXB.png)

All better now! I'm guessing there's still some snags left, I'll report any I find.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 27, 2015, 07:34:05 am
Yo I caught a dumbass little bug in how soap materials are reported.


Looks like i was hasty adding those usage lines when decided to make it show actual result instead of just plain "used to make soap". Fixed that
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Meph on January 27, 2015, 11:52:07 am
So... oil has a sharpness? Ok.

Edit: (to say something constructive at least): Do you think it makes sense to post so many numbers? People that know what the molar mass, shear yield, impact yield, etc, mean are usually the same that can read raws.

But this should be a help for players, easy to understand. Maybe it could be more user-friendly, using descriptions/adjectives instead of numbers?
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Putnam on January 27, 2015, 02:06:11 pm
So... oil has a sharpness? Ok.

Edit: (to say something constructive at least): Do you think it makes sense to post so many numbers? People that know what the molar mass, shear yield, impact yield, etc, mean are usually the same that can read raws.

But this should be a help for players, easy to understand. Maybe it could be more user-friendly, using descriptions/adjectives instead of numbers?

All items have sharpness.

Molar mass isn't really important, but yields/fractures are all very important to understand how the material works relative to other materials, and in very specific circumstances. For example, BENDING afaik is only used with joint locks and TORSION with non-edged latches (of which there are 0 in vanilla DF)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: scamtank on January 27, 2015, 02:57:37 pm
Ooh hey I have a suggestion now.

Replace this:
Code: [Select]
table.insert(list,"Temperature: "..item.temperature.whole.."U")
...with this:
Code: [Select]
table.insert(list,"Temperature: "..item.temperature.whole.."U ("..math.floor((item.temperature.whole-10032)/1.8).." C)")
...for a temperature reading that humans can understand instantly.

(http://i.imgur.com/TLYnKKX.png)

(I can't make the °-sign appear right :()
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Warmist on January 27, 2015, 03:23:47 pm
I made a tutorial (at least a start of it) here:  thread  (http://www.bay12forums.com/smf/index.php?topic=147972.0) about gui making.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 27, 2015, 10:23:41 pm
Ooh hey I have a suggestion now.

Replace this:
Code: [Select]
table.insert(list,"Temperature: "..item.temperature.whole.."U")
...with this:
Code: [Select]
table.insert(list,"Temperature: "..item.temperature.whole.."U ("..math.floor((item.temperature.whole-10032)/1.8).." C)")
(I can't make the °-sign appear right :()

Well, right, I was thinking on that but somehow decided to just pass it by. The temperature grade in DF is strange in many places... Its just not like real-world temperature, U suits better XD. Gonna add this by your request.

The material data is currently shown for every item, but sometimes it does not make sence, I agree. Thats just one of the things I ignored for the start :) The ignored item type list can be done with ease
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 28, 2015, 12:21:10 am
So... oil has a sharpness? Ok.

Edit: (to say something constructive at least): Do you think it makes sense to post so many numbers? People that know what the molar mass, shear yield, impact yield, etc, mean are usually the same that can read raws.

But this should be a help for players, easy to understand. Maybe it could be more user-friendly, using descriptions/adjectives instead of numbers?

If someone provides me enough adjectives to express all the complexity of DF material properties, I will include this :) But I think the numbers and comarison percentages are good for the time being

UPDATE: updated the script  :)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Max™ on January 28, 2015, 08:45:57 am
Seeing this it feels like it should be like, a default part of the game as is, having the info down there for the material properties is too cool, art and such is a neat bonus, but yeah, despite knowing all the various stats mostly by memory (too many years of gming pen and paper games, I memorize useless stats reflexively) it's still very cool having it presented like that. awesome stuff!
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 28, 2015, 09:45:06 pm
I think thanks to Warmist now its possible. Behold! :D

Just recenly recognized that lua can convert character index into the character itself, and custom workshop editor creates the character based images! So I can use it as a simple DF ASCII image editor XD. It allows you to draw picture for any tileset and see how it will look.

Colors are on their way! (I hope, gonna check what I know about pens)

(http://i.imgur.com/mu07OmT.png?1)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Meph on January 29, 2015, 06:38:28 am
Can this be done for buildings too? I mean getting a description/more info?
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 29, 2015, 07:18:33 am
Can this be done for buildings too? I mean getting a description/more info?

Within this script it can be done if you view an item that is part of the building's structure, and the script then checks the appropriate file. But simple pop-up script would be better.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Warmist on January 29, 2015, 07:25:41 am
Can this be done for buildings too? I mean getting a description/more info?

Within this script it can be done if you view an item that is part of the building's structure, and the script then checks the appropriate file. But simple pop-up script would be better.
Actually there is a really cool way to do that. And i'm still working on that (tweaking some stuff to get it right).
What i mean is that with most tools there is no indication that there is a key that does something. Such a popup on building would be trivial to add (just keybinding with correct context/focusstring) and a bit of magic that checks which one you have selected but the main thing is that player must know about it somehow.
So i'm musing on doing something big (it would take more work but would change how everybody does many scripts) or just faking it like  here  (http://imgur.com/a/i1K7Q). The problem with second part is that sometimes you can accidentally exit back to vanilla screen though it's not such a big problem if you are only displaying some additional keybindings...
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Meph on January 29, 2015, 07:39:03 am
I know that workflow shows the hotkeys at the bottom in any workshop menu, so a "press alt z for description" would be pretty useful.

Showing a little popup window with a picture of the buildings, name, skills used, and a short text description of what it does.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 29, 2015, 08:53:08 am
Showing a little popup window with a picture of the buildings, name, skills used, and a short text description of what it does.

(http://i.imgur.com/YlPYfAx.png)

^
I have similar script that I wrote for adventure mode, still quite usable, yet a bit abandoned and old :) It recognizes creatures under cursor in adventure mode (talk and look mode) and the creature selected in UI. Im still looking forward to expand my old script someday. Now when I know how to use widgets I think I can even build classic RPG equipment and summary screen, like this

(http://i.imgur.com/So1k2Sj.png?1)


I have a big question for Warmist... How to add new hotkey hint strings to the bottom of the existing screen without forcing a new window on top? The examples are plugins such as sort and stocks
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Meph on January 29, 2015, 08:58:41 am
I think that's only possible with plugins, not scripts. You'd need to compile something in C for that, not just a .lua script.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Warmist on January 29, 2015, 09:26:18 am
I think that's only possible with plugins, not scripts. You'd need to compile something in C for that, not just a .lua script.
There is two ways. One is as Meph says - plugin written in c++ and compiled. That is the big idea i was talking about. Build one big plugin that does that centrally.
Other idea works only for workshops: you intercept the call to fill the sidebar and replace it with your own. That is how it works in the example i had before.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 29, 2015, 09:44:58 am
I think that's only possible with plugins, not scripts. You'd need to compile something in C for that, not just a .lua script.
There is two ways. One is as Meph says - plugin written in c++ and compiled. That is the big idea i was talking about. Build one big plugin that does that centrally.
Other idea works only for workshops: you intercept the call to fill the sidebar and replace it with your own. That is how it works in the example i had before.

Did you replace the whole sidebar? Not just the choice list?
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Warmist on January 29, 2015, 11:33:08 am
Did you replace the whole sidebar? Not just the choice list?
Yup whole sidebar.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 29, 2015, 11:43:18 am

Quote
Yup whole sidebar.

So you have your jobs library finished and fully functional ? :) Can you properly issue any job using lua?
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Warmist on January 29, 2015, 01:19:59 pm

Quote
Yup whole sidebar.

So you have your jobs library finished and fully functional ? :) Can you properly issue any job using lua?
Nope. Just some special jobs. But the idea is that you don't need to cover it fully and you could pass through interesting keypresses.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: PeridexisErrant on January 29, 2015, 07:05:45 pm
Script continues to be awesome; I look forward to future development.  So here's a couple of notes, on issues I've found:

Running 5.0 beta and flicking through a few items (pick, barrel, axe, etc.), I get this console output:
Spoiler (click to show/hide)
Given that I'm not using the debug option, maybe it should be quieter?

The ascii image for "copper pick" was huge, and overflowed the screen - I couldn't actually tell what it was.  I think a standard image size would be required, and suggest that 15x45 tiles (assuming a standard 8x12 px tile, the most common thanks to vanilla DF and TwbT, that's a 2:1 ratio) would be best most maximum compatibility across window sizes. 

If this seems to be too small, there are two obvious options:  upscale (eg by simple integer multiples), or have multiple images available.  If the latter, I think it would be worth making the syntax more complex to move everything to a single (json?) file, rather than seeing an explosion in the number of required files.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Meph on January 29, 2015, 07:10:21 pm
+1 for small, standardized image sizes. People don't need to see an image to know what it is, the image should accompany the much more important text as a little extra on the side. :)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 29, 2015, 08:45:34 pm
OOPS the image of the pick is actually was not supposed to be there XD just was testing the converer.

You can make smaller images using Custom Workshop Workshop, it allows you to directly see the tiles you draw. The new format is supported by the script. (Note the format tag on top, it makes script read numbers instead of showing all the text as is:
Code: [Select]
<FORMAT:NB_ASCII>
[32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32]
[32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32]
[32:32:32:32:32:214:196:194:196:196:194:196:196:196:196:196:196:196:196:196:196:196:196:196:219:219:179:32:32:32:32:32]
[32:32:32:32:32:211:196:196:196:196:196:196:196:196:196:196:196:196:196:196:196:196:196:196:219:219:179:32:32:32:32:32]
[32:32:32:32:32:32:32:0:0:0:0:32:32:32:32:32:32:32:32:32:32:32:32:32:178:178:179:32:32:32:32:32]
[32:32:32:32:32:32:32:0:32:0:0:32:32:32:32:32:32:32:32:32:32:32:32:47:176:176:179:32:32:32:32:32]
[32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:211:196:196:196:217:32:32:32:32:32]
[32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32]
[32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32:32]

Turns into:
(http://i.imgur.com/BSi6uRu.png?1)

This is an example of my crude picture drawing. I tried to draw a hand holding the hatchet but gave it up :) just a quick example.

Id like to know how to align a lua screen to the side, currenly it is always shown in the center of the screen...
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Antikythera on January 30, 2015, 03:57:41 pm
obviously you've put a lot of work into this and its seems well received by the experienced players in the community;

 however it is included in the LNP and is on by default. I couldn't work out how to turn it off.

I looked at a dwarfs thoughts and preferences and couldn't get out of the screen. all I saw was ascii art (over the text I wanted to read) and some text at top and bottom "dfhack" and "ascii view". no "esc = exit" which I saw in this thread and may be a more recent addition. when I googled "dfhack ascii view turn off" I wasn't able to find anything.

finally found this thread after half an hour.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: lethosor on January 30, 2015, 04:07:16 pm
There's more than one LNP, and things like that should generally be posted in the thread for the pack you use. This script is intended to replace the item info screen, and there doesn't seem to be a way to disable it besides removing it from dfhack.init and restarting DF.
Edit: Of course, this script shouldn't be blocking the thoughts and preferences screen (and a bug report is perfectly fine in this thread).
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: Raidau on January 30, 2015, 11:56:42 pm
obviously you've put a lot of work into this and its seems well received by the experienced players in the community;

 however it is included in the LNP and is on by default. I couldn't work out how to turn it off.

I looked at a dwarfs thoughts and preferences and couldn't get out of the screen. all I saw was ascii art (over the text I wanted to read) and some text at top and bottom "dfhack" and "ascii view". no "esc = exit" which I saw in this thread and may be a more recent addition. when I googled "dfhack ascii view turn off" I wasn't able to find anything.

finally found this thread after half an hour.

You must edit dfhack.init and find "nb_item_info" string, then check what arguments are there. If you dont want to see dwarf's ascii just remove "ascii_unit" argument from there.

ASCII images are now closed by double-tap of the key you use to leave the screen.

PeridexisErrant, could you move the script setting into dfhack setting panel in the launcher? Also unit's ascii graphics should be turned off for now by default, its not finished and cause inconvenience.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 4.2 beta
Post by: palu on January 31, 2015, 12:18:34 am
This is amazing! PTW.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Raidau on January 31, 2015, 03:51:08 am
I have updated the DFFD release. All vanilla description blanks included, as well as df tile ascii format.

Celsius temperature is now displayed along with Urist scale. Degree sign added :)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Deon on January 31, 2015, 04:51:28 am
I've just realised that I can use it to make in-game tutorials for custom workshops. You can simply make a "chemistry manual" item and add all reagents/reactions/descriptions to its description.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Raidau on January 31, 2015, 05:08:26 am
I've just realised that I can use it to make in-game tutorials for custom workshops. You can simply make a "chemistry manual" item and add all reagents/reactions/descriptions to its description.

Great idea, BTW. It can be just tool. Or you can make special inorganic and create a BOOK item made of that material. It will contain specific description as well. (I think this can be used with books created by scripts or some reactions). But I think WTF Editor is better for general manuals.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Deon on February 01, 2015, 06:08:14 am
Well the material is going to be paper, that's for sure. I will just make different tool types, that's it. Can you please introduce some kind of a "parameter" system so we could omit material properties/temperature/sharpness selectively for specific items/materials. I.e. I want this information for weapons but don't want for musical instruments.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Raidau on February 01, 2015, 07:55:13 am
Well the material is going to be paper, that's for sure. I will just make different tool types, that's it. Can you please introduce some kind of a "parameter" system so we could omit material properties/temperature/sharpness selectively for specific items/materials. I.e. I want this information for weapons but don't want for musical instruments.

There is such parameter. Currenly script shows material info only for certain item types (namely weapons, bars, armor, leather, stone, tools, and all subtypes of those types), so all tools will have that large material tooltip... I can fix this if you wish, i think this will require an additional config file with all the exceptions
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: PeridexisErrant on March 02, 2015, 05:06:25 am
Any further news on development?  It went silent a month ago, and I'm starting to wonder if something happened! 

There are a couple of changes I'd love to see, and could try working on myself:

If I don't hear back soonish I'll get to work, but it's better to contribute than fork if you can  :)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Max™ on March 09, 2015, 10:03:43 pm
Hmmm, was just gonna ask if anyone knew what to do if you happened to encounter something made of slade or dfhacked say, a war hammer into slade to see what difference it made over platinum and it spits this every time you view the item:
Code: [Select]
/home/thefunk/.df24/hack/scripts/nb_item_info.lua:486: Cannot read field vector<descriptor_color*>.-1: index out of bounds.
stack traceback:
        [C]: in function '__index'
        /home/thefunk/.df24/hack/scripts/nb_item_info.lua:486: in function 'GetMatPropertiesStringList'
        /home/thefunk/.df24/hack/scripts/nb_item_info.lua:953: in function </home/thefunk/.df24/hack/scripts/nb_item_info.lua:841>

I tried to figure out where to add a connection but I can't figure out the layout well enough, and I think it might be related to slade having the 0,0,1 color making the nb item info script throw the error.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: lethosor on March 09, 2015, 10:05:38 pm
Quote
vector<descriptor_color*>.-1
I haven't tried to track this down, but errors like these are typically caused by attempting to use df.some_enum.NONE (usually -1) as an array index.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Putnam on March 09, 2015, 10:39:18 pm
descriptor_color certainly isn't an enum, being a raw object.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Max™ on March 10, 2015, 12:12:35 am
Well, it's an edge case that it pops up in anyways, so I can see why it wasn't bugging anyone else enough to bring it up if it was even noticed. How many slade war hammers you got laying around most of the time, right?

Didn't see if it pops up when you check an underworld vault and see the slade there or not actually.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: PeridexisErrant on March 10, 2015, 01:16:38 am
So, I've been working on a vanilla-DF port (https://github.com/DFHack/dfhack/pull/570).  If anyone wants to test it, that would be awesome!

view-item-info.lua is a lot less complicated, due to a huge refactor that also dropped support for the NB mod, images and custom descriptions.  I plan to add custom descriptions back in later, with a function designed for a sparse data set.  I'll also re-implement mod support (as soon as someone asks me to) using /raw/scripts/ to allow incremental development, since I think the challenge put people off before.

I've replaced all the magic numbers, too - all that's left is   viewscreen.unk_34:insert('#', nil)  (https://github.com/PeridexisErrant/dfhack/blob/view-item-info/scripts/view-item-info.lua#L338)... and since I don't even understand what it's doing, so someone else might have to translate into usable structures research.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Max™ on March 11, 2015, 04:14:40 pm
Good news: after dfhacking a steel axe artifact into slade and checking it with vb-item-info enabled it doesn't spit errors.

Bad news: it doesn't show a description either, oh and it kinda adds new copies of the value entry each time you enter and exit the detail screen.
(http://i.imgur.com/n8XJ7Rk.png)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Meph on May 12, 2016, 10:37:57 pm
Super-Necro.

Did anything ever happen with this? Item descriptions are kinda in dfhack now, but no fancy popups with ascii art. ^^
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Putnam on May 12, 2016, 10:40:20 pm
I don't see the point of ASCII art when you can just include an image tbh.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Meph on May 12, 2016, 11:38:40 pm
I don't see the point of ASCII art when you can just include an image tbh.
In that case I would include an image.

How?
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Putnam on May 13, 2016, 01:47:47 am
Haha shit. Okay. Challenge accepted.

Here's about two hours' work:

Code: [Select]
--Written by Putnam

local widgets=require('gui.widgets')

local gui=require('gui')

local dlg=require('gui.dialogs')

local GraphicalButton=defclass(GraphicalButton,widgets.Widget)

GraphicalButton.ATTRS={
    on_click = DEFAULT_NIL,
    on_rclick = DEFAULT_NIL,
    graphic = DEFAULT_NIL, --refers to the name of a tilepage
    label = DEFAULT_NIL
}

function GraphicalButton:preUpdateLayout()
    self.frame=self.frame or {}
    if not self.page then self.frame.w=0 self.frame.h=0 return end
    self.frame.w=self.page.page_dim_x
    self.frame.h=self.page.page_dim_y
end

function GraphicalButton:onRenderBody(dc)
    if not self.page then return end
    for k,v in ipairs(self.page.texpos) do
        dc:seek(k%self.frame.w,math.floor(k/self.frame.w)):tile(32,v)
    end
end

function GraphicalButton:onInput(keys)
    if keys._MOUSE_L_DOWN and self:getMousePos() and self.on_click then
        self.on_click()
    end
    if keys._MOUSE_R_DOWN and self:getMousePos() and self.on_rclick then
        self.on_rclick()
    end
end

function GraphicalButton:init(args)
    if not self.graphic then return end
    for k,v in ipairs(df.global.texture.page) do
        if v.token==self.graphic then self.page=v return end
    end
    error('No tilepage found: '..self.graphic)
end

local GraphicsBox=defclass(GraphicsBox,dlg.MessageBox)

GraphicsBox.ATTRS{
    frame_style = gui.GREY_LINE_FRAME,
    frame_inset = 1,
    -- new attrs
    on_accept = DEFAULT_NIL,
    on_cancel = DEFAULT_NIL,
    on_close = DEFAULT_NIL,
}

function GraphicsBox:onRender()
    self.super.onRender(self)
    self:renderSubviews()
end

function GraphicsBox:getWantedFrameSize()
    local button=self.subviews.image
    if not button.frame then return end
    return button.frame.w,button.frame.h
end

function GraphicsBox:init(info)
    self:addviews{
        GraphicalButton{
            view_id = 'image',
            graphic = info.graphic,
            frame = {l=0,t=0}
        }
    }
end

function showImage(title,image,on_close)
    GraphicsBox{
        frame_title=title,
        graphic=image,
        on_close=on_close
    }:show()
end

local lastFrame=df.global.enabler.frame_last

dfhack.onStateChange.itemPictures=function(code)
    if code==SC_VIEWSCREEN_CHANGED and dfhack.isWorldLoaded() then
        if dfhack.gui.getCurViewscreen()._type==df.viewscreen_textviewerst and df.global.enabler.frame_last-lastFrame>df.global.enabler.gfps*20 then
            lastFrame=df.global.enabler.frame_last
            local parent=dfhack.gui.getCurViewscreen().parent
            if parent._type==df.viewscreen_unitst or parent._type==df.viewscreen_dungeon_monsterstatusst then
                local unit=parent.unit
                local imageExists=false
                local creature=df.creature_raw.find(unit)
                for k,v in ipairs(df.global.texture.page) do
                    if v.token==creature.creature_id..'_TEXT_IMAGE' then
                        imageExists=true
                        break
                    end
                end
                if imageExists then
                    showImage("Image",creature.creature_id..'_TEXT_IMAGE')
                end
            elseif parent._type==df.viewscreen_itemst then
                local item=parent.item
                local imageExists=false
                local itemName=''
                local subtype=dfhack.items.getSubtypeDef(item:getType(),item:getSubtype())
                if subtype then
                    itemName=df.item_type[item:getType()]..'/'..subtype.id --gotta be a slash methinks
                else
                    itemName=df.item_type[item:getType()]
                end
                for k,v in ipairs(df.global.texture.page) do
                    if v.token==itemName..'_TEXT_IMAGE' then
                        imageExists=true
                        break
                    end
                end
                if imageExists then
                    showImage("Image",itemName..'_TEXT_IMAGE')
                end
            end
        end
    end
end

That will allow you to add any image to any item or unit's description. It will appear apropos of nothing because I didn't take that much time on it (and also because that was the original script's behavior, though I think that's weird) the instant you go into the text viewer and look like this:

(https://i.imgur.com/foikrzh.png)

In order to load it in, you need to do something like this (using Fortbent's as an example):

Code: [Select]
graphics_putnam_godtier

[OBJECT:GRAPHICS]

[TILE_PAGE:PUTNAM_GODTIER]
[FILE:putnam/godtier.png]
[TILE_DIM:64:64]
[PAGE_DIM:12:1]

[TILE_PAGE:CHAIR_TEXT_IMAGE]
[FILE:putnam/spender.PNG]
[TILE_DIM:16:16]
[PAGE_DIM:7:12]


[CREATURE_GRAPHICS:GRAPHICS_CREATURE_FORTBENT]
 [DEFAULT:PUTNAM_GODTIER:0:0:ADD_COLOR:DEFAULT]
 [MINER:CHAIR_TEXT_IMAGE:0:0:ADD_COLOR:DEFAULT]

GRAPHICS_CREATURE_FORTBENT is just this:

Code: [Select]
[CREATURE:GRAPHICS_CREATURE_FORTBENT]
[ARENA_RESTRICTED]
[NAME:none:none:none]
[DESCRIPTION:none:none:none]
[CASTE_NAME:none:none:none]
[DOES_NOT_EXIST]

As long as a creature--ANY creature--loads a tileset, it can be used in graphics this way.

Note the name: CHAIR_TEXT_IMAGE. For any subtypeless items (such as chairs, natch), the format is name_TEXT_IMAGE. Similarly, for creatures, the format is creature_id_TEXT_IMAGE. For subtyped items (weapons etc.), it's type/subtype_TEXT_IMAGE, eg. WEAPON/ITEM_WEAPON_WHIP_TEXT_IMAGE.

Oh, I need to go more in-depth about this:

Code: [Select]
[TILE_PAGE:CHAIR_TEXT_IMAGE]
[FILE:putnam/spender.PNG]
[TILE_DIM:16:16]
[PAGE_DIM:7:12]

Note the TILE_DIM and PAGE_DIM. PAGE_DIM determines how many tiles wide and tall the image will be in-game. TILE_DIM just determines how big the tiles will be. You always want that to be in the same ratio as your tileset. Ideally you want it to have the exact same dimensions. Less ideally you want it to have at least a fraction where the denominator or numerator is one, E.G. 32:32 instead of 16:16 or 8:8 (though you almost surely don't want that lol). Note that the minimum size of the game window is 80:25, which means you don't really want an image of larger than 78:23 (since the frame has an inset of 1). You might have to stretch the image a little to get into the dims--the above image was stretched 9 pixels wide and 14 pixels tall to get it to be integer multiples of 16.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Meph on May 13, 2016, 01:55:58 am
Ok, Putnam, I'm impressed.

So... chair, right?
Spoiler (click to show/hide)
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Putnam on May 13, 2016, 02:18:19 am
I mean. I chose that image specifically to show off:

1. No restrictions on color or dimensions.
2. How small the image ought to be in order to work.

An image shouldn't be more than 368 pixels tall unless you're willing to have the game render it smaller. Which it can do. But also, very large graphics files will crash the game (I used a similar method to this for the SCP mod, and 512x512 crashed the game--Toady said "I imagine our texture atlas is already at least 256x256 (since the ascii one is 128 across), but maybe that's it", so I wouldn't go above 256x256).
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Meph on May 13, 2016, 02:21:05 am
I'd make small-ish icon-like graphics, if at all. But it can certainly give a mod a lot of character if done right.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Putnam on May 13, 2016, 02:23:45 am
Oh, crap, forgot the most important part. GRAPHICS must be set to YES, even if the user is using ASCII. This could cause a real problem, now that I think of it.
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Meph on May 13, 2016, 02:28:51 am
Oh, crap, forgot the most important part. GRAPHICS must be set to YES, even if the user is using ASCII. This could cause a real problem, now that I think of it.
I figured that after your sentece
Quote
As long as a creature--ANY creature--loads a tileset, it can be used in graphics this way.
What happens if someone turns GRAPHICS to NO? Super-crash-party, or simply nothing?
Title: Re: Extended item viewscreen, custom item descriptions and ASCII art 5.1 beta
Post by: Putnam on May 13, 2016, 02:33:06 am
It'll either show nothing or show the frame, but not the graphics in it. The latter happens if the graphics aren't loaded in properly.

At the very least, there should be no situation where it crashes.

EDIT:

Code: [Select]
--Written by Putnam

local widgets=require('gui.widgets')

local gui=require('gui')

local dlg=require('gui.dialogs')

local GraphicalButton=defclass(GraphicalButton,widgets.Widget)

GraphicalButton.ATTRS={
    on_click = DEFAULT_NIL,
    on_rclick = DEFAULT_NIL,
    graphic = DEFAULT_NIL, --refers to the name of a tilepage
    label = DEFAULT_NIL
}

function GraphicalButton:preUpdateLayout()
    self.frame=self.frame or {}
    if not self.page then self.frame.w=0 self.frame.h=0 return end
    self.frame.w=self.page.page_dim_x
    self.frame.h=self.page.page_dim_y
end

function GraphicalButton:onRenderBody(dc)
    if not self.page then return end
    for k,v in ipairs(self.page.texpos) do
        dc:seek(k%self.frame.w,math.floor(k/self.frame.w)):tile(32,v)
    end
end

function GraphicalButton:onInput(keys)
    if keys._MOUSE_L_DOWN and self:getMousePos() and self.on_click then
        self.on_click()
    end
    if keys._MOUSE_R_DOWN and self:getMousePos() and self.on_rclick then
        self.on_rclick()
    end
end

function GraphicalButton:init(args)
    if not self.graphic then return end
    for k,v in ipairs(df.global.texture.page) do
        if v.token==self.graphic then self.page=v return end
    end
    error('No tilepage found: '..self.graphic)
end

local GraphicsBox=defclass(GraphicsBox,dlg.MessageBox)

GraphicsBox.ATTRS{
    frame_style = gui.GREY_LINE_FRAME,
    frame_inset = 1,
    -- new attrs
    on_accept = DEFAULT_NIL,
    on_cancel = DEFAULT_NIL,
    on_close = DEFAULT_NIL,
}

function GraphicsBox:onRender()
    self.super.onRender(self)
    self:renderSubviews()
end

function GraphicsBox:getWantedFrameSize()
    local button=self.subviews.image
    if not button.frame then return end
    return button.frame.w,button.frame.h
end

function GraphicsBox:init(info)
    self:addviews{
        GraphicalButton{
            view_id = 'image',
            graphic = info.graphic,
            frame = {l=0,t=0}
        }
    }
end

function showImage(title,image,on_close)
    GraphicsBox{
        frame_title=title,
        graphic=image,
        on_close=on_close
    }:show()
end

local lastFrame=df.global.enabler.frame_last

dfhack.onStateChange.itemPictures=function(code)
    if code==SC_VIEWSCREEN_CHANGED and dfhack.isWorldLoaded() then
        if dfhack.gui.getCurViewscreen()._type==df.viewscreen_textviewerst and df.global.enabler.frame_last-lastFrame>df.global.enabler.gfps*20 then
            lastFrame=df.global.enabler.frame_last
            local parent=dfhack.gui.getCurViewscreen().parent
            if parent._type==df.viewscreen_unitst or parent._type==df.viewscreen_dungeon_monsterstatusst then
                local unit=parent.unit
                local imageExists=false
                local creature=df.creature_raw.find(unit)
                for k,v in ipairs(df.global.texture.page) do
                    if v.token==creature.creature_id..'_TEXT_IMAGE' and v.loaded then
                        imageExists=true
                        break
                    end
                end
                if imageExists then
                    showImage("Image",creature.creature_id..'_TEXT_IMAGE')
                end
            elseif parent._type==df.viewscreen_itemst then
                local item=parent.item
                local imageExists=false
                local itemName=''
                local subtype=dfhack.items.getSubtypeDef(item:getType(),item:getSubtype())
                if subtype then
                    itemName=df.item_type[item:getType()]..'/'..subtype.id --gotta be a slash methinks
                else
                    itemName=df.item_type[item:getType()]
                end
                for k,v in ipairs(df.global.texture.page) do
                    if v.token==itemName..'_TEXT_IMAGE' and v.loaded then
                        imageExists=true
                        break
                    end
                end
                if imageExists then
                    showImage("Image",itemName..'_TEXT_IMAGE')
                end
            end
        end
    end
end

This version will just ignore any non-loaded graphics.