Latest Posts

Topic: Please help a code illiterate understand conf files properly

Astuur
Avatar
Topic Opener
Joined: 2009-02-28, 10:08
Posts: 733
Ranking
One Elder of Players
Location: Frankfurt / Germany
Posted at: 2014-05-09, 20:31

I am trying to propose a better way to calculate a production site's performance (Productivity) in this suggestion.

Now I need to make sure I understand the logic in the conf files correctly (can't read the code, sorry):
The status displayed with mouse-over does not seem to update if you leave the mouse there, so I never really know what happens.
In the example below, I seem to get "skipped axe, because not econony ..." most of the time.

Could anyone please help me understand and confirm or correct my understanding - even though it may seem obvious?

I am using the Barbarian metalworks conf as an example.

With a program like [produce_pick], the following things happen:

[produce_pick]
return=skipped unless economy needs pick

There is no time penalty, if no picks are needed. The rest of [produce_pick] is ignored and the next program from [work] is called immediately.

consume=iron log

If consumption fails, (no iron), [produce_pick] is continued, though nothing is produced. Sleep-time and animation-time is a penalty.
Afterwards the next program from the [work] section (scythe) is called.

sleep=32000
playFX=../../../sound/smiths/toolsmith 192
animate=working 35000
produce=pick

at this moment the program [produce_pick] returns control to [work] and [produce_scythe] is invoked

[work]
call=produce_bread_paddle
call=produce_fire_tongs
call=produce_fishing_rod
call=produce_hammer
call=produce_kitchen_tools
call=produce_pick
call=produce_scythe
call=produce_shovel
call=produce_hunting_spear
call=produce_felling_ax
return=skipped

here the [work] program starts again by calling [produce_bread_paddle]

Is this correct so far, or have I got it wrong?

Thanks for your reply!


Being no programmer, I apologize for all my suggestions that imply undue workload and for other misjudgements due to lack of expertise or relevant skills.
I am on Win32, have no means to compile, and rely on prefabricated distributions (Thanks to Tino).

Top Quote
slopsbucket
Avatar
Joined: 2014-05-07, 00:20
Posts: 10
Ranking
Pry about Widelands
Location: Top End, Australia
Posted at: 2014-05-10, 13:27

Sorry Astuur,

but it's a little difficult to understand what you are trying to achieve here.

You can set the limits on what is to be produced "in game" by doing a left-click on any flag on the map and then a left-click on the third icon at the bottom of the pop-up menu. The one just left of the Geologist icon.

If you like, most of the game's settings and programming are just simple text files. Go to C : \ Program Files \ Widelands and take a look. You can edit any of those text files as you please but please TAKE SERIOUS NOTE of these two warnings.

Text files MUST be edited with a simple text editor such as Notepad. If you use Microsoft Word or any other word processor program to edit any of those files you will bugger them completely and the game will crash.

Always make a backup copy of any file before you attempt to edit it.

Cheers,

Andrew.

Edited: 2014-05-10, 13:28

Top Quote
fk
Avatar
Joined: 2013-07-30, 22:58
Posts: 151
Ranking
At home in WL-forums
Posted at: 2014-05-11, 15:25

One should know the precise code behind the script to explain the exact behaviour.

But what the script tells is that it takes 32000 time units per program, which means that it would take time in increments of 32 seconds for every executed program. (I really hope it is only one, but ...)

What it also tells is that the program performs an animation, and this should be visible while observing the building.

The word 'return' in the script does not necessarily have to be an instruction, it can also be a parameter. I would not assume the script to leave at that point, although it is very possible.


Top Quote
fk
Avatar
Joined: 2013-07-30, 22:58
Posts: 151
Ranking
At home in WL-forums
Posted at: 2014-05-11, 17:11

Btw, I measured 42.22 seconds before the animation started, and 34.92 seconds during which the animation was active.


Top Quote
slopsbucket
Avatar
Joined: 2014-05-07, 00:20
Posts: 10
Ranking
Pry about Widelands
Location: Top End, Australia
Posted at: 2014-05-12, 07:04

Hi Astuur,

Please accept my most humble apologies for my misguided response to your post.

I was a bit drunk and answered your question without fully understanding what you were asking. Please forgive me.

Fortunately I'm usually a happy drunk but that doesn't make me any less obnoxious. face-sad.png

Cheers,

Andrew.


Top Quote
Astuur
Avatar
Topic Opener
Joined: 2009-02-28, 10:08
Posts: 733
Ranking
One Elder of Players
Location: Frankfurt / Germany
Posted at: 2014-05-14, 13:15

Hi - fk and slopsbucket!
Sorry for being a bit late in answering!
Hmm .. actually you both didn't quite answer my question.... though fk was closer face-smile.png
Thanks anyway (to both), for taking the time.
I don't really care at the moment about timings for animation and sleep ... I know they are not exact.
I also have an idea about what each command does (except "skipped" and "return")
What I was asking for, is that someone who can find and interpret the source code, please confirm or correct my assumption about what happens if the
"skipped because not economy needs ware" is true or the "consume ..." command fails due to lack of raw material!
Basically I want some knowledgeable person to comment on my statements behind the speech bubbles (quotations).
So again, please ..... right or wrong?

@ slopsbucket:
If I were the newbie you obviously took me for, I'd probably be quite pleased with your answer, and thankful for the reply! face-smile.png
Yes, you misunderstood, but still wanted to help -- that's fine.


Being no programmer, I apologize for all my suggestions that imply undue workload and for other misjudgements due to lack of expertise or relevant skills.
I am on Win32, have no means to compile, and rely on prefabricated distributions (Thanks to Tino).

Top Quote
fk
Avatar
Joined: 2013-07-30, 22:58
Posts: 151
Ranking
At home in WL-forums
Posted at: 2014-05-14, 16:42

Astuur,

Sure, that 'better' help is what you are waiting for, that was clear from the beginning, but it doesn't get into reality for some reason. And, being a former programmer, I have to apologize for being too lazy to examine the source code behind the script. Your reaction is therefore valid and justified.


Top Quote
Astuur
Avatar
Topic Opener
Joined: 2009-02-28, 10:08
Posts: 733
Ranking
One Elder of Players
Location: Frankfurt / Germany
Posted at: 2014-05-14, 18:02

There may be some here, that have written that code and they will not need another look at it but remember by heart .... So maybe they ...... face-smile.png


Being no programmer, I apologize for all my suggestions that imply undue workload and for other misjudgements due to lack of expertise or relevant skills.
I am on Win32, have no means to compile, and rely on prefabricated distributions (Thanks to Tino).

Top Quote
SirVer

Joined: 2009-02-19, 15:18
Posts: 1445
Ranking
One Elder of Players
Location: Germany - Munich
Posted at: 2014-05-15, 15:14

I am sorry for not answering here - I am swamped with work. Astuur, your work is really appreciated (as always), I just cannot help out for the moment. I suggest asking Nasenbaer for help.

Unfortunately it is not correct that the authors of the code will not need to look it up :(. It is too long ago that this code has been written.


Top Quote
Astuur
Avatar
Topic Opener
Joined: 2009-02-28, 10:08
Posts: 733
Ranking
One Elder of Players
Location: Frankfurt / Germany
Posted at: 2014-05-15, 16:57

I understand, of course. Anyhow I wonder where you take the time from to reply to so many things, personally.

Yep, asking Nasenbear seems like the right thing to do --- will PM him.
Trouble is, he tends to be busy, too. Will try anyway ...


I did meanwhile, but Nasenbaer can't help with this either - at least not at the moment.
Stuck -- can someone tell me perhaps within witch file I might find the relevant code?
I probably can't make much out of it (unless it's commented for dummies) but I can at least try.
C'mon guys - there must be more than 2 persons who can read code hanging around here!

Edited: 2014-05-17, 09:08

Being no programmer, I apologize for all my suggestions that imply undue workload and for other misjudgements due to lack of expertise or relevant skills.
I am on Win32, have no means to compile, and rely on prefabricated distributions (Thanks to Tino).

Top Quote