So apparently I don't have a thread for my current project here. Dang.
Village is my long-term project. It's an Esolang where you are a village chief and you get to command people around and do things. It's a lot of fun.
Here's a basic "hello, world" program:
Pretty simple!
Villagers can have occupations.
Not all of the features are officially documented yet, with the main undocumented feature being Ask commands, aka conditionals. They are explained pretty well in my Cemetech topic:
[spoiler=large quote]
There's more stuff in the docs.
Link to interpreter
The console messages (when debug mode is on) will help explain the examples and should help you.
Enjoy!
Village is my long-term project. It's an Esolang where you are a village chief and you get to command people around and do things. It's a lot of fun.
Here's a basic "hello, world" program:
Code Select
Call for the villager named Ada.
Tell Ada to write the text "Hello, World!" on her scroll.
Tell Ada to post her scroll to the Community Message Board
Pretty simple!
Villagers can have occupations.
Code Select
Call for the villager named Alan.
Teach Alan how to gather wood.
Note: This next task takes 3 successful lines of code to complete.
Tell Alan to gather 20 wood.
Note: waste 3 commands.
Call for the villager named Ken.
Teach Ken how to draft blueprints.
Tell Ken to make a blueprint for a railroad to the North village.
Note: At this point, Alan's done getting wood.
Tell Alan to write the text "I have " on his scroll.
Tell Alan to write the amount of wood he has on his scroll.
Tell Alan to write the text " wood." on his scroll.
Tell Alan to post his scroll to the Community Message board.
Not all of the features are officially documented yet, with the main undocumented feature being Ask commands, aka conditionals. They are explained pretty well in my Cemetech topic:
[spoiler=large quote]
QuoteSyntax: Ask [villager name] if [he/she] has [quantity] [item type].[/spoiler]
That's a little weird, so here's an example: (Oh yeah, I added a female villager, Ada, named after Ada Lovelace)Code SelectCall for the villager named Ada.
Ask Ada if she has any stone.
- If she doesn't:
- Tell Ada to write the text "I do not have stone" on her scroll.
- If she does:
- Tell Ada to write the text "I have stone" on her scroll.
Tell Ada to post her scroll to the Community Message Board.
As you can tell, there are a few things going on here.
Call for the villager named Ada. makes Ada available for us to use. Because of my current crappy occupation-selecting script, she is an architect, but that doesn't really matter in this script.
Ask Ada if she has any stone.
This is the conditional statement. Of course, Ada does not have any stone. Only quarrymen can have stone.
The keyword any means more than one. You can also put a number in that conditional, and it will mean "greater than or equal to <number>".
Eventually, I will add the ability to use the word "exactly" before the number, but you can achieve this anyways with clever programming.
Because this is a conditional, we have to increase the indent level.
- If she doesn't:
- Tell Ada to write the text "I do not have stone" on her scroll.
- If she does:
- Tell Ada to write the text "I have stone" on her scroll.
This section of code is the conditional statement "body". The code in here is executed based on how the conditional happened.
[size=0pt]I see a rage coming from many programmers in here about what I am going to say in this section, but if you think about if statements in, say, JavaScript, the initial '{' can be viewed as a label to jump to, as can the '{' after the else.[/size]
- If she doesn't: and - If she does:
Indent levels in village work like this:Code Select<nothing>
-
+
*
-
+
*
(and so on)
You don't need to memorize the pattern. If you get it wrong, the interpreter will kindly tell you which one to use.
The " -" before our command indicates that this is the first indent level. The space after the dash is a stylistic thing, it can be omitted.
The If she does: and If she doesn't: are labels that are jumped to if the condition is true or false, respectively. They can occur in any order. If there is only one of them in the conditional statement "body" and it doesn't apply, the entire conditional will be skipped.
If you run the code above, you will notice that only the text "I do not have stone" shows up on the output ("Community Message Board"). The other code beneath the If she does: label was skipped because it did not apply.
The end of any body section is always signified by a decrease in indentation.
There's more stuff in the docs.
Link to interpreter
The console messages (when debug mode is on) will help explain the examples and should help you.
Enjoy!