Although there are other major features in ichorescent (James added spiffy battle features like player-controlled enemies (and why doesn't he capitalize release codenames??)), there's more than enough to justify a thread on this theme. And more to come.
Extra data arrays
HamsterSpeak effectively has arrays now that you can resize slice, NPC, zone and menu item extra data arrays, even if it is a bit clunky. Extra data always defaults to length 3, while the max is
A new set of generic array commands act on NPC references or slice/zone/menu item handles:
- get extra
- set extra
- resize extra
- extra length
- append extra
I'll add some soon more for operations that are inefficient to implement as scripts, but I won't add every common array method because I want to add actual arrays in the not-too-distant future, and I already feel like I'm working on the wrong thing.
Python-style array indexing
Access extra data arrays from the end. Index -1 is the last item, -2 the second last...
Code: Select all
sl := create container
append extra(sl, 100)
#...
get extra(sl, -1) # The last thing that was appended
show value is a staple of script debugging... but it was frustrating that it only displayed one number. So now you can show multiple values. Also, show values is an alias to (variant spelling of) "show value".
Code: Select all
show values(hero X, hero Y, read zone(5, hero X, hero Y))
Code: Select all
# Shows something like "coins=0, hero X(me)=3, hero Y(me)=14" at the bottom of the screen
show value of(coins, hero X(me), hero Y(me))
lookup next slice, next slice in tree
Certain persons complained about lack of way to organise slices into a group, aside from making them the children of a parent. Now you can give them all the same lookup code to loop over them:
Code: Select all
variable(sl)
while (true) do (
sl := lookup next slice(sli:particle, sl, sprite layer) # Search all descendents of sprite layer
if (sl == 0) then (break)
particle updater(sl)
)
I considered adding "slice groups" too. But I've never yet found use for Node groups in Godot rather than just use an array.
exit
exit is a new HS keyword which is equivalent to "return" in other programming langauges. exit(x) is equivalent to "exit returning(x)" and exit is equivalent to "exit script".
slice is valid
I removed the huge warnings not to use this command, because it's now (almost entirely) reliable. Slice handles have changed (they don't count up starting from 1) so that they won't be reused, unless you do "free slice(create container)" 1,024,256 times. Unless you keep around handles to deleted slices for hours you can now take the easy way out to avoid "invalid slice handle" errors by checking first with "if (slice is valid(sl)) then (something pretty(sl))".
As a bonus the engine now can recognise different types of script handles. In future the script debugger will show you that a variable/global contains a handle to a certain sprite slice or NPC or menu, etc, rather than just showing "14". A few error messages already now do this when you pass in the wrong kind of handle. Hmm, maybe I should add string handles...
Show slice in debugger
When a slice error occurs there's a shortcut to jump to it in the slice editor/debugger.
Commandline games?
(Unix only, because Windows GUI applications can't print to the terminal -- they have to create a new terminal window.)
If you use trace/trace value of but don't want to have to open g_debug.txt all the time you can now use --print or --printonly commandline args and it'll be conveniently printed to the terminal (stdout).
Noone else will care, but I wanted to run scripting tests and benchmarks straight from the commandline so I made it possible for a game to run without a window and print to the terminal. Pass --nogfx --printonly while using --gfx fb or (not included in default builds) --gfx console. Key input even works, though only gfx_fb supports non-printing keys like Left, F1, ESC. gfx_fb sure crashes a lot in this mode though. This is very crude, because only scripts will print to the terminal, so if a script error occurs the game appears to freeze.