Commit Graph

106 Commits

Author SHA1 Message Date
haven1433
5ab843d3b2 implement game-specific macros 2022-12-21 22:47:41 -06:00
haven1433
2c52358396 Compile / Decompile improvements
* when docompiling, don't include a box that contains a partial script that's already in the main box
* when compiling, require arg counting for getting macro length
2022-12-21 08:33:53 -06:00
haven1433
3e16f8ee20 add stream content recursively for scripts
This should make <auto> able to work even when there are scripts that point to scripts, as the content will appear after the last attached script.
2022-12-20 22:34:26 -06:00
haven1433
3b6a18072f improving auto support
for mart, movement, and if statements
2022-12-20 14:29:20 -06:00
haven1433
5371397475 first part of <auto> support 2022-12-18 10:26:02 -06:00
haven1433
6874768ffc additional macros
support for out-of-order macro commands
also allows for arguments to be applied multiple times
2022-12-15 08:06:26 -06:00
haven1433
66f3bd9006 syntax highlighting for multiline comments 2022-12-06 21:40:45 -06:00
haven1433
7d8ae74a00 script bugfixes
add enum types for fanfare / bufferitem
allow script constants to contain underscores
allow autocomplete for constants that are the last argument
allow 'find usages -> scripts' to find usages from macros (and fix crash)
2022-12-04 22:38:04 -06:00
haven1433
4a5f351d6f final fixes for 0.5
givePokemon, use item constants
fix crashes/errors in hover-tip logic for trainerbattle commands
* tested that macros and array args still work right
2022-12-03 22:50:33 -06:00
haven1433
88e90f980c fix completion tips for array-arg and 0-arg commands 2022-12-03 21:24:05 -06:00
haven1433
380738609b draft of auto-complete for script tool 2022-12-03 19:09:31 -06:00
haven1433
bf1d30fe7d more macros
also clear constant cache when refreshing ViewPort
2022-12-02 23:28:56 -06:00
haven1433
d6d6a6c54f initial macro support 2022-12-02 22:41:39 -06:00
haven1433
830740ad34 script editor is now colored 2022-12-02 20:44:59 -06:00
haven1433
c0f3ade883 allow script lines to have multiple stream sections 2022-12-02 10:22:00 -06:00
haven1433
a44841290f first pass at updating script pointer logic
instead of the script line itself knowing that it points to something,
pull it down to the argument level, so that each argument knows
if it points to something.

This will allow a single script line to point to multiple things (like trainers pointing to multiple text or scripts)
2022-12-02 08:38:21 -06:00
haven1433
4c2089196b usability feedback
label stuff
center new connections
berry shortcuts
fix goto shortcuts
2022-11-24 11:24:56 -06:00
haven1433
e285eaaf7b add 'scripts' option to 'show uses' button
Unlike the other ones, this one doesn't pre-calculate, and may end up being empty when you click on it.
2022-11-23 08:26:46 -06:00
haven1433
d350c6bfa9 fix ai scripts for emerald 2022-11-22 08:52:52 -06:00
haven1433
6a703c1fae call UpdateFromParent when updating TableStream via textbox 2022-11-18 09:10:31 -06:00
haven1433
d09b3c32c7 finish more templates 2022-11-07 21:56:39 -06:00
haven1433
b4f4e86277 don't clear the newgame pokemon tables
These were being cleared because they existed within scripts. Make the script ClearFormat logic smarter so it skips tables that align to single arguments.
2022-10-04 23:05:32 -05:00
haven1433
4317864b64 fix disappearing script section bug 2022-10-04 16:58:45 -05:00
haven1433
7a6ba78d94 fix {} creation after <??????>
Only add the {} if there isn't one already
2022-09-28 22:19:06 -05:00
haven1433
7a6ce76b23 serialize null list items as numbers
also fix width on script tooltip
2022-09-22 07:36:26 -05:00
Haven1433
29092415a6 multi-select
and some flag-based utilities
and hide layoutID
2022-09-16 21:27:55 -05:00
Haven1433
ee28bc8a02 initial ai script support 2022-09-12 20:23:40 -05:00
Haven1433
610171b59a fix broken behavior
New rule: when clearing format and the run starts _before_ what we're clearing, leave the pointers and a NoInfoRun. Before this rule, we would clear out the anchor as well, which could cause some confusion if that anchor/format was re-added later, since it wouldn't know about tables that point to it.

Fix bug in script parser: next text runs should know about pointers to them
2022-09-11 20:59:35 -05:00
Haven1433
52880278ea update battleScriptReference
thanks to AGSMG for helping to fill out some of these missing details
2022-09-01 12:45:33 -05:00
Haven1433
810f8c7a65 ScriptParser needs to know which game it is.
The 'showmoney' and 'updatemoney' commands are different from game to game. It has 2 parameters in R/S, but 3 parameters in FR/LG/E.

Update the scriptReference to specify that these commands have different versions for the different games.

Update ScriptParser to be able to read this new addition to the script reference format.

Add tests to show that the new commands are read correctly between games.
2022-08-25 06:51:51 -05:00
Haven1433
65765e695f Allow Text Macros
* Replace the static PCSString.Convert method with an instance method on a TextConverter that's owned by the Model. The TextConverter can know about different macros depending on which rom is being edited.
* Add macros to pcsReference.txt
2022-06-02 20:53:39 -05:00
Haven1433
01f0c3905e battle script update 2022-05-16 21:11:48 -05:00
Haven1433
485b307115 Don't require filler arguments to be explicit 2022-05-03 10:50:57 -05:00
Haven1433
5bccc8258f improve script parsing
allow enum tables to parse numeric values
2022-05-03 06:51:04 -05:00
Haven1433
87bd11fd7a Don't have scripts clear the pointer-to format if we don't need to 2022-04-17 22:11:11 -05:00
Haven1433
8c873c881d support multiple loadgfx commands in a row 2022-04-17 20:51:11 -05:00
Haven1433
13ca381bb5 Fix error message for trainerbattle script command 2022-04-13 21:16:12 -05:00
Haven1433
e251b08ac8 Improve battle script parsing 2022-03-19 22:56:31 -05:00
Haven1433
cc0406a06d Read 0x prefix as hex when compiling multi-args
Also read 0X and $ as hex.
2022-02-19 20:53:57 -06:00
Haven1433
b1d599098b call points to the next script 2022-02-18 21:51:18 -06:00
Haven1433
f5f16166bd Use 0x prefix for hex values in group arguments 2022-02-18 21:51:03 -06:00
Haven1433
ecfb990fb0 Verify that scripts can parse negative word values 2022-01-08 19:53:32 -06:00
Haven1433
c9aaa8b4ba Improve script decompile hex logic
* Allow a value to be shown in hex if it's an out-of-range enum value
* Have values default to hex if they're >= 0x4000
2021-12-14 07:40:42 -06:00
Benjamin Popp
cf8da71e5b Use base 10 for scripts
base-16 values can be entered by prefixing with 0x or $.
base-16 values will be output by the script parser if the argument is suffixed with |h
All other values will now naturally decompile to base-10.
2021-11-29 07:30:32 -06:00
Benjamin Popp
1972361c2b Notify OW width/height changing when changed from stream
Notification previously worked when changing via the main view or when changing via an element in the table tool. But notification didn't work right for stream deserialization, since the stream wasn't aware of what was changing.

Now, all write-data-to-model methods return a flag expressing whether or not they actually wrote any data. This makes it possible for streams to know which elements of the stream were changed, which means notification now works correctly.

Note that we are not notifying for compressed data changes or whenever a new stream is created from scratch.
2021-10-18 22:50:42 -05:00
Benjamin Popp
0bb9eaa224 when changing text causes it to repoint, update the script 2021-08-01 00:03:33 -05:00
Benjamin Popp
ade819e561 fix pokemart format element name 2021-07-31 23:28:33 -05:00
Benjamin Popp
6df5c90dcc fix data format consistency
Not only do we need to clear any excess after the new run is inserted (if the old run was longer), we also need to clear any conflict before the new run is inserted (if the new run is longer). This prevents format conflicts.
2021-07-30 08:20:37 -05:00
Benjamin Popp
ae80071ce5 fix scripting bugs
* script repointing should during ?????? pointer resolution: make sure that the pointer resolves to a different address than the script repoints to. This happened because we were looking for freespace for the new pointer and the moved script at the same time.
* when auto-repointing a script, clear the old pointer format and update their anchors with the new destination. This is not happening automatically because scripts don't hold all their length like other runs do, so repointing them left their pointers behind.
2021-07-29 23:35:13 -05:00
Benjamin Popp
0a9a61f2ef Keep anchors when editing script text 2021-07-29 16:12:22 -05:00