Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: Dwarf Scripting  (Read 3071 times)

Rysith

  • Bay Watcher
    • View Profile
Dwarf Scripting
« on: February 08, 2009, 12:40:29 am »

So, with the Circle templates and the recent Mac Dwarfers thread that Martin started, I thought I'd throw this out there as someone who likes to program in my free time:

What kinds of autohotkey/applescript scripts would people be interested in? I'll try to fulfill whatever requests come in.
Logged
Lanternwebs: a community fort
Try my orc mod!
The OP deserves the violent Dwarven equivalent of the Nobel Peace Prize.

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: Dwarf Scripting
« Reply #1 on: February 08, 2009, 12:47:17 am »

How about a self-contained circular or hexagonal "silo" form for compartmental housing?
Logged
DF Vanilla-Spice Revised: Better balance, more !!fun!!
http://www.bay12forums.com/smf/index.php?topic=173907.msg7968772#msg7968772

LeadfootSlim on Steam, LeadfootSlim#1851 on Discord. Hit me up!

Rysith

  • Bay Watcher
    • View Profile
Re: Dwarf Scripting
« Reply #2 on: February 08, 2009, 12:52:46 am »

Can you give a rough idea of what you mean?

I'm not sure if you mean "tileable hexagons that could be used for a single room" or "a hexagonal unit with a few (probably 6) rooms" or "a hexagonal unit with rooms, food/booze stockpiles, workshops, and everything else that a fortress would need"
Logged
Lanternwebs: a community fort
Try my orc mod!
The OP deserves the violent Dwarven equivalent of the Nobel Peace Prize.

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: Dwarf Scripting
« Reply #3 on: February 08, 2009, 01:04:34 am »

Can you give a rough idea of what you mean?

I'm not sure if you mean "tileable hexagons that could be used for a single room" or "a hexagonal unit with a few (probably 6) rooms" or "a hexagonal unit with rooms, food/booze stockpiles, workshops, and everything else that a fortress would need"

Stacked hexagons; a rooming unit, a storage unit, a workshop unit, etc. Hence "silo".
Logged
DF Vanilla-Spice Revised: Better balance, more !!fun!!
http://www.bay12forums.com/smf/index.php?topic=173907.msg7968772#msg7968772

LeadfootSlim on Steam, LeadfootSlim#1851 on Discord. Hit me up!

Duke 2.0

  • Bay Watcher
  • [CONQUISTADOR:BIRD]
    • View Profile
Re: Dwarf Scripting
« Reply #4 on: February 08, 2009, 01:07:34 am »


 All of which would have up/down stairs on the same basic areas. That or a super awesome silo with a persistent feature, like a pit in the center or wagon-accessible ramps system for going up and down.

 Because we don't need another boring 'ol silo, and some of us are striving to create an active volcano inside a fortress inside an active volcano.
Logged
Buck up friendo, we're all on the level here.
I would bet money Andrew has edited things retroactively, except I can't prove anything because it was edited retroactively.
MIERDO MILLAS DE VIBORAS FURIOSAS PARA ESTRANGULARTE MUERTO

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: Dwarf Scripting
« Reply #5 on: February 08, 2009, 03:42:06 am »

You know, now that I have a handle on the scripting... I'm having a hard time deciding just what to script out.

Circles are the hardest thing, but beyond that, I can't come up with advanced multi-level digging architecture off the top of my head.
Logged
DF Vanilla-Spice Revised: Better balance, more !!fun!!
http://www.bay12forums.com/smf/index.php?topic=173907.msg7968772#msg7968772

LeadfootSlim on Steam, LeadfootSlim#1851 on Discord. Hit me up!

Martin

  • Bay Watcher
    • View Profile
Re: Dwarf Scripting
« Reply #6 on: February 08, 2009, 04:34:19 am »

You know, now that I have a handle on the scripting... I'm having a hard time deciding just what to script out.

Circles are the hardest thing, but beyond that, I can't come up with advanced multi-level digging architecture off the top of my head.

Since you like circles, how about a single-click missile silo fortress? http://weburbanist.com/2007/11/02/suburban-abandonments-missile-silos-for-exploration-visitation-and-even-for-sale/

winner

  • Bay Watcher
    • View Profile
Re: Dwarf Scripting
« Reply #7 on: February 08, 2009, 12:01:16 pm »

Logic gates like numberabbey has.

Or slightly divergent, a program that takes images and urns them into digging instructions
Logged
The great game of Warlocks!

Rysith

  • Bay Watcher
    • View Profile
Re: Dwarf Scripting
« Reply #8 on: February 08, 2009, 11:02:44 pm »

Quote from: Warlord255 link=topic=30722.msg418537#msg418537

Stacked hexagons; a rooming unit, a storage unit, a workshop unit, etc. Hence "silo".

Here's one that draws hexagons. Put the designation cursor where you want the left-most point of the hexagon, and press windows-h. The number on the end controls the side length
Spoiler (click to show/hide)

Not quite as elegant as I would have liked, but I couldn't find a nice test for hexagons the way that I could for circles. The interiors have no features, but it seemed like forcing a particular layout wouldn't be something applicable for everyone.

Unfortunately, they aren't regular hexagons because of resolution issues.

Winner: Logic gates are a bit more complicated than just scripting can do (since they would involve placing pressure plates and floodgates, the menus for which can change), and reading in an image to designate would (again) be outside the realm of these scripts.
« Last Edit: February 09, 2009, 05:20:31 pm by Rysith »
Logged
Lanternwebs: a community fort
Try my orc mod!
The OP deserves the violent Dwarven equivalent of the Nobel Peace Prize.

Andy Korth

  • Bay Watcher
    • View Profile
Re: Dwarf Scripting
« Reply #9 on: February 09, 2009, 11:25:06 am »

Has anyone figured out how to move up and down a level in DF using applescript? I've done a bit of scripting before for large buildings, but I never figured that one out.

Things I tried:

Code: [Select]
keystroke ">"
key code 14 using shift down
Logged

Martin

  • Bay Watcher
    • View Profile
Re: Dwarf Scripting
« Reply #10 on: February 09, 2009, 11:47:38 am »

This works fine for me:
Code: [Select]
tell application "Dwarf Fortress"
activate
tell application "System Events"
keystroke ">"
keystroke "<"
end tell
end tell

Andy Korth

  • Bay Watcher
    • View Profile
Re: Dwarf Scripting
« Reply #11 on: February 09, 2009, 02:50:49 pm »

This works fine for me:
...   keystroke ">" ...

Hmm. I wonder- are you using the experimental SDL version (40d9)? Maybe some there have been some changes that would affect key input.  I noticed that works great in the older version- just tried it.
« Last Edit: February 09, 2009, 02:52:26 pm by Andy Korth »
Logged

Baughn

  • Noble Phantasm
  • The Haruhiist
  • Hiss
    • View Profile
Re: Dwarf Scripting
« Reply #12 on: February 09, 2009, 03:03:07 pm »

I don't quite remember if it made it into 40d9 or not, but in general new-df will be very confused by keystroke events that are *instantly* followed by keyup events. It may or may not work.
Logged
C++ makes baby Cthulhu weep. Why settle for the lesser horror?

Martin

  • Bay Watcher
    • View Profile
Re: Dwarf Scripting
« Reply #13 on: February 09, 2009, 03:13:32 pm »

Even in 40d, I need to put a short delay between keystrokes:
Code: [Select]
delay 0.1Or else it'll eat keystrokes. I think it works okay in 40d9, though. Warlord got my scripts to work in 40d9, though the shift-arrows were a problem for him.

monolar

  • Bay Watcher
    • View Profile
Re: Dwarf Scripting
« Reply #14 on: February 09, 2009, 03:23:54 pm »

Logic gates like numberabbey has.

Or slightly divergent, a program that takes images and urns them into digging instructions

I actually tried this yesterday evening. Sadly AppleScript is a horrible language and i could not find anything readily available on a vanilla os x to read a pixel's color from an image file in "Image Event"s

I am currently thinking about simply creating a native os x app, where one could create templates on a grid or in a scripted fashion (probably python).

I think the most attractive templates are parametrized ones. The circle is a good example. I have created a small script for my default staircase design with alternating up and down stairs like this:

Code: [Select]
#####
#< >#
#< >#
#< >#
#####

<> - stairs
 - floor
# - wall

and am currently working on variations of that (like orientation) and the ability to input the number of levels you want the staircases to go (up and/or down).

Since i usually use relatively strict layout i will probably create simple layouts as well. What i am not so sure about is digging channels. In my experience i am quite careful with digging channels and do this in at least 2 stages.

For a bunker i could imagine a multi-phase template. First the digging, second some channeling and furniture placement, third some more channeling. I am not sure how to smartly tell df via actionscript which furniture or material (e.g. walls) to use. I would love an easy way to say "a wall of granite from here 10 tiles to the north".
Logged
Pages: [1] 2