Converting Visual Scripts to Text Scripts
If you create a script with the block based editor you can now convert it to a text script. We've been working over the last few weeks adding new features to the text scripting to support a variety of edge cases and lesser used features in the visual language but the conversion is still not perfect.
Because the visual language is more limited it has a bunch of contextual nuances that are... awkward in a more general expression evaluator. As an example, if you use an expression like
goto \.nearest.highpoint
On a crane, the return the result will always be within the range the crane can reach. We've preserved that behavior in the text script evaluator despite the fact that, in the text scripting language you can use .highpoint in many contexts other than a goto command. Similarly, if you use the same command on a drone it will immediately go to the highest point in the beacon but, if the high point changes while the drone is in flight, it will reevaluate the expression and change to a new high point.
In each of these cases the behavior is not what you'd expect from a more general purpose language where typically the same code would execute the same way on any entity and each expression would be evaluated only once. The text scripting is meant to feel more like programming in a general purpose language while still maintaining some of these core ease-of-use features from the drag and drop programming. At the same time, there are fundamental differences between how the visual and text evaluators work that mean that sometimes the behavior of the conversion won't perfectly match.
External Editor Integration
Icaria now has a REST API designed to support external editors. It is not enabled by default but you can turn it on by putting -port=8080 in the Launch Options on Steam. We decided that opening a port on the game by default might have unintended side-effects so we've put it under your control.
The API looks looks like this: http://localhost:8080/roles returns a JSON response that looks like this:
{
"Entities": \
{
"Name": "Surveyor",
"Key": "surveyor",
"Roles": \
{
"Name": "Trees",
"UriName": "Trees",
"Actions": \
{
"Name": "visit maples",
"UriName": "visit%20maples",
"TextMode": true
},
{
"Name": "recharge",
"UriName": "recharge",
"TextMode": true
}
],
"Version": 0
}
]
}
]
}
You can address any action with a URL formed like so http://localhost:8080/role/surveyor/Trees/visit%20maples The "Key" and "UriName" fields the JSON are used to form the request URL; this URL supports the GET, PUT, and DELETE methods so you can get the current text of the script, push updates with a PUT, and DELETE them. Using PUT for a new role not currently in the save will create that role. The "Version" key is an internal value that is incremented every time the role is changed; you can use that to decide if you need to pull an update from the game.
We now have #icaria-modding channel on our discord with a few folks developing mods. Let us know if you are interested. We'll be developing this API more in the future.
Patch Notes
Text Scripting
Conversion from block script to text script.
A bunch of new options added to text script commands to support block script conversions. This should get use most of the way to parity; they are in the doc pages for the commands.
New functions: floor(), ceiling(), round(), mod(), atan(), and atan2().
"Setting the terrain filter in script now also can set 'only diggable,' 'allow water,' and 'on empty.'"
API now returns the role version number in the roles JSON response.
Text editor formatting got very slow for longer scripts when the script is actually running. Cache text measurements so that updates go faster.
Properly convert line breaks when pasting code into the editor.
Now possible to query the memory of other entities with .#. or .@.
Timeout option on commands that resolve an entity set. Equivalent to the timeout option the block scripting, this controls how the script handles resolving entity sets to entities when the set is empty.
Support for range limits on entity sets. so \.inRange(50).random will only find quarries within 50 meters.
documentation for the request command in text scripts.
size property for entities returns a location for the bounding rectangle
Put the text script name for items in the item hover.
Some bulletproofing for the "defeat husk boss" event. I don't have a actual repro case for this one but I made some changes to defend against a couple classes of hypothetical failure. No idea if it actually fixes the problem but, in the short term, it's the best I've got.
