diff --git a/CHANGELOG.md b/CHANGELOG.md index 1618123..21bbc14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +Nothing, yet. + +## [3.5.0] - 2024-11-10 ### Added +- Movement can now be inlined within commands using a special `moves()` operator, similar to text. For example: + ``` + applymovement(OBJ_EVENT_ID_PLAYER, moves( + walk_left * 4 + face_down + )) + ``` - Print a warning message when `numLines` is missing from a font's config. Defaults to `numLines=2` in that case, rather than `0`. - Added `msgbox` to the default `command_config.json`, since `msgbox(.., MSGBOX_YESNO)` would be a very common use case. @@ -169,7 +179,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.0.0] - 2019-08-27 Initial Release -[Unreleased]: https://github.com/huderlem/poryscript/compare/3.4.0...HEAD +[Unreleased]: https://github.com/huderlem/poryscript/compare/3.5.0...HEAD +[3.5.0]: https://github.com/huderlem/poryscript/compare/3.4.0...3.5.0 [3.4.0]: https://github.com/huderlem/poryscript/compare/3.3.0...3.4.0 [3.3.0]: https://github.com/huderlem/poryscript/compare/3.2.0...3.3.0 [3.2.0]: https://github.com/huderlem/poryscript/compare/3.1.0...3.2.0 diff --git a/README.md b/README.md index 3461595..cf93442 100644 --- a/README.md +++ b/README.md @@ -519,6 +519,30 @@ MyMovement: step_end ``` +However, movement can also be *inlined* inside commands similar to text, using the `moves()` operator. This is often much more convenient, and it can help simplify your scripts. Anything that can be used in a `movement` statement can also be used inside `moves()`. + +Looking at the previous example, the movement can be inlined like this: +``` +script MyScript { + lock + applymovement(2, moves( + walk_left + walk_up * 5 + face_down + )) + waitmovement(0) + release +} +``` +Note, whitespace doesn't matter. This can also be written all on a single line: +``` +applymovement(2, moves(walk_left walk_up * 5 face_down)) + +// You can even use commas to separate each movement command, since +// that may be easier to read. +applymovement(2, moves(walk_left, walk_up * 5, face_down)) +``` + ## `mart` Statement Use `mart` statements to define a list of items for use with the `pokemart` command. Data defined with the `mart` statement is created with local scope by default. It is not neccesary to add `ITEM_NONE` to the end of the list, but if Poryscript encounters it, any items after it will be ignored. @@ -661,7 +685,7 @@ const ASSISTANT_ID = PROF_BIRCH_ID + 1 const FLAG_GREETED_BIRCH = FLAG_TEMP_2 script ProfBirchScript { - applymovement(PROF_BIRCH_ID, BirchMovementData) + applymovement(PROF_BIRCH_ID, moves(walk_left * 4, face_down)) showobject(ASSISTANT_ID) setflag(FLAG_GREETED_BIRCH) } diff --git a/main.go b/main.go index 4ad80e5..21f3feb 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import ( "github.com/huderlem/poryscript/parser" ) -const version = "3.4.0" +const version = "3.5.0" type mapOption map[string]string