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 12731 times)

Guillo

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #45 on: April 02, 2009, 07:56:50 am »

I blame Vista.
Logged

kotekzot

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #46 on: April 02, 2009, 08:02:34 am »

for the record, i'm using win xp x64.
Logged
Dwarf Fortress: Where violent death is a renewable resource
Bro, your like... thinking like a square man... its like, the WHOLE lamprey is just like, one big NECK dude, you know? its like hahahaha! dude protect the trees though, seriously. *inhale*... anyways... you like, want this dead black bear, bro?

Guillo

  • Bay Watcher
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #47 on: April 08, 2009, 12:15:00 am »

Ha! I was kidding before, but the problem really IS Vista. Apparently Vista has some issues with the SendPlay command not working at all and the SendInput command causing some specific stuck keys. I thought it was the administrative rights gumming things up at first, but after circumventing it the problem was still there. Going back to XP and running the script with SendPlay made it work like a charm though.

The script could still be made to work with Send, but you would have to mess around with SetKeyDelay to get it to sync up perfectly with DF's little internalized sticky key/de-bouncing filter that seems to be antagonizing us. I played with it for a little while and could not get the circles to come out nice, but I quickly gave up since SendPlay is working great for me now that I'm back to XP.

*EDIT*
Or if one is stalwart about running Vista and making CircleFort, they can simply go back to using 40d.
« Last Edit: April 08, 2009, 12:17:39 am by Guillo »
Logged

Hishan

  • Bay Watcher
  • [ALCOHOL_DEPENDANT]
    • View Profile
Re: COMMUNITY RESOURCE: Circle Templates 3 to 45
« Reply #48 on: April 14, 2009, 12:59:35 pm »

Since Rysith's code didn't seem to make very nice circles for me I decided to take a crack at an AHK script. I started with Rysith's code and then modified like crazy.
This is the first time I used the program and I'm not much of a coder so if somebody wants to streamline this that would be great.

The code produces clones of the chart most of the time...  Some of the sizes are slightly different than the chart's circles though, but they are still pretty good.

Hit [Windows Key] + c to activate the macro

/edit
I guess I should mention that you can modify the outerrad and innerrad variables to change the circles. Changing the innerrad from 0 makes it so a circular column is left in the middle of the room with radius = innerrad.
/endedit

*EDIT AGAIN*
Made a small change and now all my circles turn out beautifully.
I also had part of the code missing previously from a botched copy/paste

Code: [Select]
;One full circle
#c::

;Radius is considered as the distance from the origin to circle edge
;with the center square being the origin and considered dimensionless

;From Circle Chart:
; Radius = (Chart#)/2 - 1

outerrad := 10
innerrad := 0

outerEighth("{NumPadDown}","{NumPadUp}","{NumPadRight}","{NumPadLeft}",outerrad)
outerEighth("{NumPadDown}","{NumPadUp}","{NumPadLeft}","{NumPadRight}",outerrad)
outerEighth("{NumPadLeft}","{NumPadRight}","{NumPadUp}","{NumPadDown}",outerrad)
outerEighth("{NumPadLeft}","{NumPadRight}","{NumPadDown}","{NumPadUp}",outerrad)
outerEighth("{NumPadRight}","{NumPadLeft}","{NumPadUp}","{NumPadDown}",outerrad)
outerEighth("{NumPadRight}","{NumPadLeft}","{NumPadDown}","{NumPadUp}",outerrad)
outerEighth("{NumPadUp}","{NumPadDown}","{NumPadLeft}","{NumPadRight}",outerrad)
outerEighth("{NumPadUp}","{NumPadDown}","{NumPadRight}","{NumPadLeft}",outerrad)

innerEighth("{NumPadDown}","{NumPadUp}","{NumPadRight}","{NumPadLeft}",innerrad)
innerEighth("{NumPadDown}","{NumPadUp}","{NumPadLeft}","{NumPadRight}",innerrad)
innerEighth("{NumPadLeft}","{NumPadRight}","{NumPadUp}","{NumPadDown}",innerrad)
innerEighth("{NumPadLeft}","{NumPadRight}","{NumPadDown}","{NumPadUp}",innerrad)
innerEighth("{NumPadRight}","{NumPadLeft}","{NumPadUp}","{NumPadDown}",innerrad)
innerEighth("{NumPadRight}","{NumPadLeft}","{NumPadDown}","{NumPadUp}",innerrad)
innerEighth("{NumPadUp}","{NumPadDown}","{NumPadLeft}","{NumPadRight}",innerrad)
innerEighth("{NumPadUp}","{NumPadDown}","{NumPadRight}","{NumPadLeft}",innerrad)



outerEighth(up,down,left,right,rad)
{
x := 0
y := rad

while y > rad/2
{
dig(up,y)
move(down,y)
dig(right,1)
x++
y := round((sqrt((rad*rad) - (x*x))))
}
move(left,x)
}

innerEighth(up,down,left,right,rad)
{
x := 0
y := rad

while y > rad/2
{
remove(up,y)
move(down,y)
remove(right,1)
x++
y := round((sqrt((rad*rad) - (x*x))))
}
move(left,x)
}

;Utility functions
remove(dir,number)
{
send x
send {Enter}
move(dir, number)
send {Enter}
}

dig(dir,number)
{
send d
send {Enter}
move(dir, number)
send {Enter}
}

move(dir,number)
{
loop {
if number <= 0
{
break
}
send %dir%
number--
}
}

Your code seems to have an error at line 38 for me "while y > rad/2", apparantly doesnt contain a valid operator.
Logged
Pages: 1 2 3 [4]