Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 233 234 [235] 236 237 ... 373

Author Topic: DFHack 0.34.11 r3  (Read 1454001 times)

Dragoon209

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3510 on: April 03, 2013, 04:29:40 pm »

Hello!

While working on my mouse-driven project, I was attempting to make a plugin to do the very simple task of outputting the current screen, like it does if you run 'keybinding' without any arguments.  instead of parsing all the text, and extracting the last line, I wanted to make it only export the current screen.

I am running into a problem, and in this case, I know what it is: I don't know C++.  :P

Here is the code:
Spoiler: MouseStatus.cpp (click to show/hide)

and here is the error:
Spoiler: Build Error (click to show/hide)


Now, from the little I remember from my computer science classes, It has to do with the function call command_result mousestatus () being wrong.  I know its probably a simple fix, but I don't know where to go from here.  I think its not declaring what it needs properly, but I'm not sure what it should be.

I edited the skeleton plugin, and then copied the line from Core.cpp that listed the GUI's current screen.  I changed it to an out.print command instead of con <<, because that is what was being used earlier in the skeleton plugin to display text.  I included another library at the top too, but I don't think I need it, and it most likely should be removed.

Long term, I'm looking to make a plugin-assisted AutoHotKey menu that allows the player to right click, and get a set commands based on what they are doing.  In the case of designations, I would like to allow box drawing like Falconne's construction additions to automaterial.  Perhaps some sort of 'macro' or run history of commands as well, which would allow the user to save a list of commonly used commands, and execute them at will, instead of just mapping them to keys.  In case you are wondering, I am only using AutoHotKey because I know it already, and its easy to use.  After I get something working, I would like to eventually port it to something a little more universal, but that is a long way out.

If somebody could point me in the right direction, or better yet, reply with fixed code, I would be very thankful.  Either way, thanks for looking!
Logged
Check out my mini-mods:
Upgradable Leather Tiers
Block Crafting Workshop

Have you played Webfort yet?  It's a way to play Dwarf Fortress in a web browser with your friends!  Come check it out at:
Community Web Fortress

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3511 on: April 03, 2013, 04:39:33 pm »

to get a const char* out of an std::string, you need to do string.c_str()

So
Code: [Select]
out.print(Gui::getFocusString(Core::getTopViewscreen())); becomes
Code: [Select]
out.print(Gui::getFocusString(Core::getTopViewscreen()).c_str()); or maybe
Code: [Select]
out.print("%s\n", Gui::getFocusString(Core::getTopViewscreen()).c_str());
« Last Edit: April 03, 2013, 04:41:52 pm by Japa »
Logged

Dragoon209

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3512 on: April 03, 2013, 05:01:25 pm »

to get a const char* out of an std::string, you need to do string.c_str()

So
Code: [Select]
out.print(Gui::getFocusString(Core::getTopViewscreen())); becomes
Code: [Select]
out.print(Gui::getFocusString(Core::getTopViewscreen()).c_str()); or maybe
Code: [Select]
out.print("%s\n", Gui::getFocusString(Core::getTopViewscreen()).c_str());

Thanks!  The latter one worked.
Logged
Check out my mini-mods:
Upgradable Leather Tiers
Block Crafting Workshop

Have you played Webfort yet?  It's a way to play Dwarf Fortress in a web browser with your friends!  Come check it out at:
Community Web Fortress

turabeasel

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3513 on: April 03, 2013, 08:04:28 pm »

@turabeasel I've used the digfort script on osx so it's not intrinsic to that. What was the command you activated it with? Alternatively could be the csv file itself, if I export to csv from numbers by default it doesn't use the correct separator that digfort is looking for, it uses "," instead of ";", but the script itself does work on osx so it's not that

Yea I was guessing that maybe I was improperly using the script, how should it be used or how should the plugin be called up?
Logged

Cato

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3514 on: April 04, 2013, 12:04:54 am »

First you need your plan which should be a csv file with ; seperators, so something like from the readme example

d;d;u;d;d;skip this tile;d
d;d;d;i

where the "skip this tile" part is actually arbitrary, anything other than what it is looking for which is in the readme (though downstairs are actually j, not d, the readme is off on that part) is treated as a skip. Save that file in the same folder that you launch dwarf fortress from. Then you point your cursor at the upper left corner of what you want designated and in the dfhack terminal type digfort fileName. Where fileName is whatever you called the plan, potentially including the extension which depending on how you created it might be hidden in the finder. So if I make a Plan_Kitchen.csv file, then I'd type "digfort Plan_Kitchen.csv" and the designations should appear, with the upper left corner matching wherever the cursor is.

Then it should go through and do whatever designations are contained in the csv file.
Logged

expwnent

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3515 on: April 04, 2013, 09:24:06 am »

I didn't look at your savegame yet but I imagine the problem *might* be caused by workflow trying to check if it should protect a repeat job which uses a modded custom reaction.

I did a quick check before coming to work this morning to make sure it wasn't a workflow problem and I don't think it is. The crash happens here in autoSyndrome because "bob->mat_index" is -1.

Just guessing here without knowing anything about the code, but might it also be a bug that the autoSyndrome is processing the job as if it completed successfully, even though it was actually cancelled?

That's probably *a* problem, even if it isn't THE problem. I'll fix that in the next version. Thanks.

It does distinguish between cancelled and completed jobs. It's possible to get them mixed up, but unlikely.
Logged

turabeasel

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3516 on: April 04, 2013, 11:04:57 am »

First you need your plan which should be a csv file with ; seperators, so something like from the readme example

d;d;u;d;d;skip this tile;d
d;d;d;i

where the "skip this tile" part is actually arbitrary, anything other than what it is looking for which is in the readme (though downstairs are actually j, not d, the readme is off on that part) is treated as a skip. Save that file in the same folder that you launch dwarf fortress from. Then you point your cursor at the upper left corner of what you want designated and in the dfhack terminal type digfort fileName. Where fileName is whatever you called the plan, potentially including the extension which depending on how you created it might be hidden in the finder. So if I make a Plan_Kitchen.csv file, then I'd type "digfort Plan_Kitchen.csv" and the designations should appear, with the upper left corner matching wherever the cursor is.

Then it should go through and do whatever designations are contained in the csv file.

OK, now I do not get an error anymore so long as the cursor is in a location on the screen. Now though it just says "done" after the command but nothing happens in game.
Logged

Cato

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3517 on: April 04, 2013, 12:04:35 pm »

What was the csv plan like? Done is all that should show up, if there are no designations that occur it could be a problem with csv file, anything it doesn't recognize it treats as a do nothing instruction. Inside the spoiler is an example of a plan I've used successfully, does yours look something like that format wise?

Spoiler (click to show/hide)
Logged

turabeasel

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3518 on: April 04, 2013, 12:24:41 pm »

I just tried a .csv file that is included with quickfort.

#dig Simple bedroom example.         
d   d   d   #
d   d   d   #
d   d   d   #
   d      #
#   #   #   #

It says done but nothing happens on screen.
Logged

turabeasel

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3519 on: April 04, 2013, 12:30:29 pm »

I just tried making my own in excel:

;d;d;d;
;d;d;d;

and nothing happend either except "done".
Logged

Cato

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3520 on: April 04, 2013, 07:29:22 pm »

The first one wouldn't work because it lacks the ";" separators, not sure about the second one though. If I take it and put it into a text file called test.txt then call it, I get

[DFHack]# digfort test.txt
done

and 6 squares designated for digging starting one square to the right of it where my cursor is. If it doesn't work for you then I'm not sure what is going wrong for you.
Logged

turabeasel

  • Bay Watcher
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3521 on: April 04, 2013, 07:36:56 pm »

Hmm...well that worked! Although it designates six blocks but there one space to the right and six spaces down?
Logged

WillowLuman

  • Bay Watcher
  • They/Them Life is weird
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3522 on: April 05, 2013, 01:29:52 am »

There any easy way to have a syndrome or creature interaction change the weather?
Logged
Dwarf Souls: Prepare to Mine
Keep Me Safe - A Girl and Her Computer (Illustrated Game)
Darkest Garden - Illustrated game. - What mysteries lie in the abandoned dark?

Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: DFHack 0.34.11 r3
« Reply #3523 on: April 05, 2013, 01:32:33 am »

EDIT: wrong topic :X

Yeah, there should be one.

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: DFHack 0.34.11 r3
« Reply #3524 on: April 05, 2013, 04:18:38 am »

If you mean rain, snow and clear skies, then yes. For special rains, fogs and such, no.

Code: [Select]
-[REACTION:WEATHER_CLEAR]-
[NAME:Clear the skies]
[BUILDING:WEATHER_CONTROL:CUSTOM_C]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:WEATHER_CLEAR]

-[REACTION:WEATHER_RAIN]-
[NAME:Call down the rain]
[BUILDING:WEATHER_CONTROL:CUSTOM_R]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:WEATHER_RAIN]

-[REACTION:WEATHER_SNOW]-
[NAME:Call down a snow storm]
[BUILDING:WEATHER_CONTROL:CUSTOM_S]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:WEATHER_SNOW]

Code: [Select]
[INORGANIC:WEATHER_CLEAR]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:blinding flash of light]
[STATE_NAME_ADJ:LIQUID:molten failure stone26]
[STATE_NAME_ADJ:GAS:Clear Skies]
    [SYNDROME]   
 [SYN_CLASS:\COMMAND] autosyndrome command begins here
   [SYN_CLASS:weather]
   [SYN_CLASS:clear]
         [SYN_NAME:doesnt matter]
         [SYN_CONTACT]
         [SYN_INHALED]
         [SYN_AFFECTED_CREATURE:DWARF:ALL][SYN_AFFECTED_CREATURE:KOBOLD_CAMP:ALL]
[CE_SPEED_CHANGE:SPEED_PERC:100:START:0:END:1]
[DISPLAY_COLOR:4:4:1][TILE:'*']
[MELTING_POINT:900]
[BOILING_POINT:905]
[SOLID_DENSITY:55520]
[MATERIAL_VALUE:1]

[INORGANIC:WEATHER_RAIN]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:blinding flash of light]
[STATE_NAME_ADJ:LIQUID:molten failure stone26]
[STATE_NAME_ADJ:GAS:Rain]
    [SYNDROME]   
 [SYN_CLASS:\COMMAND] autosyndrome command begins here
   [SYN_CLASS:weather]
   [SYN_CLASS:rain]
         [SYN_NAME:doesnt matter]
         [SYN_CONTACT]
         [SYN_INHALED]
         [SYN_AFFECTED_CREATURE:DWARF:ALL][SYN_AFFECTED_CREATURE:KOBOLD_CAMP:ALL]
[CE_SPEED_CHANGE:SPEED_PERC:100:START:0:END:1]
[DISPLAY_COLOR:4:4:1][TILE:'*']
[MELTING_POINT:900]
[BOILING_POINT:905]
[SOLID_DENSITY:55520]
[MATERIAL_VALUE:1]

[INORGANIC:WEATHER_SNOW]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:blinding flash of light]
[STATE_NAME_ADJ:LIQUID:molten failure stone26]
[STATE_NAME_ADJ:GAS:Snow]
    [SYNDROME]   
 [SYN_CLASS:\COMMAND] autosyndrome command begins here
   [SYN_CLASS:weather]
   [SYN_CLASS:snow]
         [SYN_NAME:doesnt matter]
         [SYN_CONTACT]
         [SYN_INHALED]
         [SYN_AFFECTED_CREATURE:DWARF:ALL][SYN_AFFECTED_CREATURE:KOBOLD_CAMP:ALL]
[CE_SPEED_CHANGE:SPEED_PERC:100:START:0:END:1]
[DISPLAY_COLOR:4:4:1][TILE:'*']
[MELTING_POINT:900]
[BOILING_POINT:905]
[SOLID_DENSITY:55520]
[MATERIAL_VALUE:1]
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::
Pages: 1 ... 233 234 [235] 236 237 ... 373