Bay 12 Games Forum

Please login or register.

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

Author Topic: [LinDesignator] template-based automation utility (0.06b final version?)  (Read 11144 times)

Erulisse

  • Bay Watcher
    • View Profile

Thanks for the update! Quick question, how does one change the mode the script is rendering in? For instance it seems to be limiting me to the designation menu, and i'd like to design for the building phase of making rooms (placing furniture and what not), then assigning bedrooms, then stockpiles and other various tweaks.
I gave the statfulQF a look and it seems all the menus are there, it's just a matter of activating them.
Logged

shadow_slicer

  • Bay Watcher
    • View Profile

Thanks for the update! Quick question, how does one change the mode the script is rendering in? For instance it seems to be limiting me to the designation menu, and i'd like to design for the building phase of making rooms (placing furniture and what not), then assigning bedrooms, then stockpiles and other various tweaks.
I gave the statfulQF a look and it seems all the menus are there, it's just a matter of activating them.
At the top of the .csv file there should be a line that tells what mode it should be in:
Code: [Select]
#dig
#build
#query
#place
I think the Quickfort thread has more details on the template format (controlling the starting offset, changing levels, etc).

A word or warning on other modes. While building most likely works fine, you may run into problems with the other two modes due to inadequate testing. If there's a bug, let me know and I'll look into it.
Logged

Erulisse

  • Bay Watcher
    • View Profile

here's the line i use in the terminal
Code: [Select]
python ~/.apps/LinDesignator/LinDesignator.py /home/rain/.apps/templates/mytemplates/dorms_build.csv > /home/rain/.apps/df_linux/data/init/macros/dorms_build.mak

the plain text contents of the origiinal file
Code: [Select]
#build,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,b,t,c,,,,,,,,,,,,,,,,,,,,,,,,,,,,
,h,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

and lastly the error I getL

Code: [Select]

python ~/.apps/LinDesignator/LinDesignator.py /home/rain/.apps/templates/mytemplates/dorms_build.csv > /home/rain/.apps/df_linux/data/init/macros/dorms_build.mak
Traceback (most recent call last):
  File "/home/rain/.apps/LinDesignator/LinDesignator.py", line 167, in <module>
    dmacro.StartMacro(sys.argv[1],delay)
  File "/home/rain/.apps/LinDesignator/LinDesignator.py", line 102, in StartMacro
    self.RunMacro()
  File "/home/rain/.apps/LinDesignator/LinDesignator.py", line 145, in RunMacro
    self.mtype.handleBlock(self.cursor,macro[j][i],block)
  File "/home/rain/.apps/LinDesignator/MacroType.py", line 99, in handleBlock
    sendQFSequence(keyseq)
NameError: global name 'sendQFSequence' is not defined
Logged

shadow_slicer

  • Bay Watcher
    • View Profile

Well, darn. It seems I forgot to update the build module when I added the GUI. I ended up refactoring a bunch of the send* functions into a class and must not have changed all the references to the function.

It looks like there are ~11 places in that file that need to be fixed for 'build', and 'place' to work. If you are feeling adventurous, you can add 'self.sc.' to the beginning of the calls to sendQFSequence(...), sendDFCommand(...) and finishQFSequence() that don't already have it (i.e. self.sc.sendQFSequence(...)). I'll post a fixed version after I get home tonight.
Logged

Erulisse

  • Bay Watcher
    • View Profile

I'll just wait for you to post the files as I too am at work :) However this would be the perfect chance for me to start learning python...
Logged

shadow_slicer

  • Bay Watcher
    • View Profile

Ok. The fix has been posted.

In addition to what I mentioned before, there was also an unnecessary time.sleep() call left over from when I was sending keypresses to the DF window. That's gone, so #build conversions should be as fast as the others.
Logged

Erulisse

  • Bay Watcher
    • View Profile
Re: [LinDesignator] template-based automation utility (0.06b final version?)
« Reply #21 on: August 03, 2010, 10:55:38 am »

I found another bug, The annotation for defining the starting point of the script is broken. In quickfort files the first line can look like this.
Code: [Select]
#dig start(10;15; insert comment here)

#query files also default to the last instance of the hotkey in the statefulQF file It might be better to implement quieries using the lines
Code: [Select]
'a' : ('HOTKEY_LOOM_WEAVE_METAL', 'Query'),
'a' : ('HOTKEY_KITCHEN_COOK_2', 'Query'),
as this
Code: [Select]
'a' : ('CUSTOM_A', 'Query'),

That is just one solution, The built-in macro command lumps all possible commands for that keypress into the same field ie.
Code: [Select]
                OPTION1
CUSTOM_A
WORLD_PARAM_ADD
WORLD_PARAM_REJECT_ABORT
WORLD_GEN_ABORT
A_COMBAT_ATTACK
A_ANNOUNCEMENTS
A_BARTER_CURRENCY_1
BUILDJOB_ADD
        ....
End of group

Each solution would work

I also have a quick question: Do aliases work? I did some testing and they seem to be broken, It may have been a result of the aforementioned problem though  :)
Logged

shadow_slicer

  • Bay Watcher
    • View Profile
Re: [LinDesignator] template-based automation utility (0.06b final version?)
« Reply #22 on: August 03, 2010, 07:04:19 pm »

I found another bug, The annotation for defining the starting point of the script is broken. In quickfort files the first line can look like this.
Code: [Select]
#dig start(10;15; insert comment here)
I looked through the code for this and I couldn't see a problem. What is it doing wrong?

#query files also default to the last instance of the hotkey in the statefulQF file It might be better to implement quieries using the lines
Code: [Select]
'a' : ('HOTKEY_LOOM_WEAVE_METAL', 'Query'),
'a' : ('HOTKEY_KITCHEN_COOK_2', 'Query'),
as this
Code: [Select]
'a' : ('CUSTOM_A', 'Query'),

That is just one solution, The built-in macro command lumps all possible commands for that keypress into the same field ie.
Code: [Select]
                OPTION1
CUSTOM_A
WORLD_PARAM_ADD
WORLD_PARAM_REJECT_ABORT
WORLD_GEN_ABORT
A_COMBAT_ATTACK
A_ANNOUNCEMENTS
A_BARTER_CURRENCY_1
BUILDJOB_ADD
        ....
End of group

Each solution would work
Yes that's probably true. I'd probably use the second one (just change commands to a list and then send them all in the list). That's too much of a change for a bugfix, so it will have to way until 0.07.

I also have a quick question: Do aliases work? I did some testing and they seem to be broken, It may have been a result of the aforementioned problem though  :)
Aliases should work just as if you copied that sequence into the cell. I tested them earlier a long time ago, but I haven't changed anything related to that portion of the code.
Logged

Erulisse

  • Bay Watcher
    • View Profile
Re: [LinDesignator] template-based automation utility (0.06b final version?)
« Reply #23 on: August 03, 2010, 09:36:32 pm »

Sounds good.

About the start(10;15) problem, if the first line has "start(10;15) in it the script should render that cell as the origin of the design, yet it still renders 0,0 as the origin.
Logged

Erulisse

  • Bay Watcher
    • View Profile
Re: [LinDesignator] template-based automation utility (0.06b final version?)
« Reply #24 on: August 04, 2010, 12:03:03 am »

Another bug:

When the template has a line containing "#<" or "#>" it adds an extraneous "End Of Macro" where there should be none. Leaving the "End of Macro" line causes the macro to stop prematurely, if you delete the "End Of Macro" line from the files they work as anticipated.

Thanks again for all the hard work! It really is a great script!
Logged

shadow_slicer

  • Bay Watcher
    • View Profile
Re: [LinDesignator] template-based automation utility (0.06b final version?)
« Reply #25 on: August 04, 2010, 09:09:18 am »

Sounds good.

About the start(10;15) problem, if the first line has "start(10;15) in it the script should render that cell as the origin of the design, yet it still renders 0,0 as the origin.

Yes. 'start(10;15)' will not work. Instead you should use 'start(10;15;)'. I don't know if QF accepts it or not, but I'm just splitting the string along the ';'s. That start position would parse as "10","15)", and "15)" isn't a number. Maybe I'll make it more robust in the next version.

That said, QF has released a python version that is supposed to work on Linux. Have you had a chance to try it?
Logged

Erulisse

  • Bay Watcher
    • View Profile
Re: [LinDesignator] template-based automation utility (0.06b final version?)
« Reply #26 on: August 04, 2010, 09:55:04 am »

Wow, a python version of QF takes away the need for LinDesignator completely :'( I'll check it out right now!
Logged
Pages: 1 [2]