Bay 12 Games Forum

Please login or register.

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

Author Topic: COMMUNITY RESOURCE: Circle Templates 3 to 45  (Read 12735 times)

Rysith

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #15 on: February 04, 2009, 04:58:32 pm »

autohotkey, installation instructions at http://www.dwarffortresswiki.net/index.php/Macros_and_Keymaps
Logged
Lanternwebs: a community fort
Try my orc mod!
The OP deserves the violent Dwarven equivalent of the Nobel Peace Prize.

magic dwarf

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #16 on: February 04, 2009, 06:35:34 pm »

Thanks this is gonna revolutionize my future fortresses.  (imagining tons of tangent circular pods)

Martin

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #17 on: February 04, 2009, 07:59:27 pm »

Any Mac users interested in an Applescript that does a similar thing?

It works the same way as Autohotkey - it just simulates keypresses that get sent to the game.

castellan

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #18 on: February 04, 2009, 11:57:08 pm »

Any Mac users interested in an Applescript that does a similar thing?

It works the same way as Autohotkey - it just simulates keypresses that get sent to the game.

Oh, hell yes!
Logged

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #19 on: February 05, 2009, 11:38:37 pm »

Any Mac users interested in an Applescript that does a similar thing?

It works the same way as Autohotkey - it just simulates keypresses that get sent to the game.

YES PLEASE.

Aherm. I mean, yes, please.
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!

Kelwyn

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #20 on: February 06, 2009, 01:31:07 am »


I got all MS Paint on it's ass... hope that helps whoever wanted them larger with distinct squares.

Spoiler (click to show/hide)
Logged
He has admired a fine trap recently.

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #21 on: February 06, 2009, 04:23:01 am »


I got all MS Paint on it's ass... hope that helps whoever wanted them larger with distinct squares.

Spoiler (click to show/hide)

T'would appear I've been bested. If you like, I can paste out the circle sizes for 47-101 to be similarly beautified.

Also, progress/status on the Applescript autohotkeys? The very prospect fills me with glee.
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: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #22 on: February 06, 2009, 11:22:25 am »

Also, progress/status on the Applescript autohotkeys? The very prospect fills me with glee.

Almost done. Hopefully this evening I can finish it off. The only problem right now is that it makes slightly oval circles, so a 20 radius circle will be 21 in two directions and 20 in the other two. I need to account for which part of the tile is represented on the circle, and I think my code puts the corner on the circumference rather than the center.

It'd be pretty easy for anyone to modify it to draw out arbitrary shapes that you use a lot. I'll offer up a few other examples for people to play with.

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #23 on: February 06, 2009, 01:10:03 pm »

Also, progress/status on the Applescript autohotkeys? The very prospect fills me with glee.

Almost done. Hopefully this evening I can finish it off. The only problem right now is that it makes slightly oval circles, so a 20 radius circle will be 21 in two directions and 20 in the other two. I need to account for which part of the tile is represented on the circle, and I think my code puts the corner on the circumference rather than the center.

It'd be pretty easy for anyone to modify it to draw out arbitrary shapes that you use a lot. I'll offer up a few other examples for people to play with.

Is it an algorithm or what? I'd figure so long as the structure is "press this key then this key then this key..." we could alter it as necessary.

Either way, much gratitude. I've been itching for a way to do this ever since I saw one of the autohotkey videos.
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: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #24 on: February 06, 2009, 03:50:14 pm »

Is it an algorithm or what? I'd figure so long as the structure is "press this key then this key then this key..." we could alter it as necessary.

Either way, much gratitude. I've been itching for a way to do this ever since I saw one of the autohotkey videos.

The circle tool is an algorithm which sends the keypresses. There's a bit of framework there just to make the code easier to deal with and I need to prompt for the radius, just little stuff. The other script will show how to use that framework to do some semi-complex dig. I'm using my 28 room bedroom wing as an example since it uses dig, remove designation, and staircase to lay out a structure. Just wanted to give people a reasonably complex example to follow that they can extend to meet their needs. I have a 3rd script I'll clean up that flips hauling functions, just to show how to automate other things. You select a dwarf and run the script and it'll go in and invert whatever they are set to haul, so that if you have them just set to refuse (for dumping), it'll turn on all other hauling functions and turn off refuse. I use it a lot when I want to recruit my dedicated workers to clean up after a siege so I turn on hauling for them all, and then when things are cleaned up I turn it all off again and send them back to their other jobs. There's a version of Foreman for the Mac which should do this better, but I've yet to get it to work.

I should have time tonight to get them documented up and polished.

Rysith

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #25 on: February 06, 2009, 04:03:13 pm »

[quote author=Warlord255 link=topic=30589.msg416850#msg416850
Is it an algorithm or what? I'd figure so long as the structure is "press this key then this key then this key..." we could alter it as necessary.
[/quote]
The problem with doing that is that for larger constructions (my bedroom wing comes to mind...) the script would be huge (108 bedrooms, ~10 keypresses per bedroom if you made it really efficient...) Algorithms are much easier both to read and to modify.

The way that I did mine was I started with a "move x spaces in a direction", built a "dig x squares in a direction" on top of that, and then put the circle detection in on top of that (move in a square, digging all tiles that fall within the bounds). I've used the same principle for the bedrooms and some other scripts that I've made, and they all reuse some of the more basic bits (like moving and digging, for example).

Logged
Lanternwebs: a community fort
Try my orc mod!
The OP deserves the violent Dwarven equivalent of the Nobel Peace Prize.

Martin

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #26 on: February 06, 2009, 04:19:03 pm »

The problem with doing that is that for larger constructions (my bedroom wing comes to mind...) the script would be huge (108 bedrooms, ~10 keypresses per bedroom if you made it really efficient...) Algorithms are much easier both to read and to modify.

The way that I did mine was I started with a "move x spaces in a direction", built a "dig x squares in a direction" on top of that, and then put the circle detection in on top of that (move in a square, digging all tiles that fall within the bounds). I've used the same principle for the bedrooms and some other scripts that I've made, and they all reuse some of the more basic bits (like moving and digging, for example).

I saw your script - mine is pretty similar - I liked how you abstracted out the 4 quadrants, which I might add to mine.

As for the bedroom wing, it doesn't dig tile by tile, but does regions, so I can tell it to dig out this 10x50 region, and then go back and undesignate the walls, and then go back and redig the hallways, etc. so by adding and subtracting regions, and repeating elements, it turns out to not be too much code. I've used the same layout in a few fortresses, so its paid off.

Martin

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #27 on: February 06, 2009, 07:45:32 pm »

Ok. I've got a bug that I can take in two directions to solve:

The circles are tilted because what I'm having it do is walk the perimeter of a circle wall, digging tiles as it goes. It then leaves it to the user to fill in the field to dig out. Alternatively, this could mark out on the surface a shape using the traffic restrictions for a shape to be constructed (it'd leave a big green ring that you could then designate walls on). I could just have it build the walls, but you'd be left to Armoks discretion what materials get selected. Anyway, the fix makes the code a bit more complicated, which is no problem if this is what people are looking for.

Alternatively I could change it so that it mines out the entire area and you'd need to hollow out the bits you don't want. It's the difference between hollowing out a big circle or designating a single-width ring (which is what I do more of, personally). It's a bit different algorithm but it's also a little simpler to ask it to do some other kinds of shapes like ovals and the like. Either way, it's not terribly hard to use one to get the shape and do the other function. I'm heading off to dinner for a few hours, so if you have any opinion just offer it up and I'll get to work on it later.

Warlord255

  • Bay Watcher
  • Master Building Designer
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #28 on: February 06, 2009, 11:08:31 pm »

The second option (fill entire circle, leave user to hollow) sounds like the best approach. Truth be told, whatever works that gets a correct single-tile center circle works for me.
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: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #29 on: February 07, 2009, 02:08:09 am »

Circle Applescript:

http://www.bay12games.com/forum/index.php?topic=30689.0

It's not as compact as Rysith, but there are a bunch of elements there which I use for other things. I'll post up two more scripts tomorrow. Let me know how it works for you.
Pages: 1 [2] 3 4