XaiJu
Seemann
Seemann

patreon


Somersault and the future of Sanny Builder


Straight to the point: I'm going to re-imagine current Sanny Builder language and cut old legacy stuff while adding some long-awaited features. Somersault is going to be a transpiler for the new syntax rules to make them compatible with the compiler.


Near Future Roadmap:

- support arbitrary expressions:

int x = 10 + 2 * 4

- drop opcode and keyword syntax in favor of functions, any command is a function:

wait(0)
shake_cam(10)


- support arbitrary expressions for indexing arrays:

int a = b[10+2*4]

- short-circuit evaluation of conditions

if is_player_playing(0) and is_player_climbing(0) // second condition is not evaluated if player is dead
then
...
end


- Ranges in Switch..end

switch x
case 1, 2..10, 100..
end


- Syntactic sugar for pointers:

int x = *(byte)0xA49960 + 5

*(type)(addr) translates to read_memory command with a preset size argument.


One of the goals for Somersault is to get rid of horrendous syntax elements, e.g. for local variables (0@, 1@) and arrays ($var(0@,1i)) in favor of readable identifiers (int x, float pos[3], etc).


Where are we now?


I'm working on first 3 items from the roadmap and made quite a progress, which I wanted to share with you. Here is a simple example of a script that uses new syntax:

{$CLEO .cs} 

wait(1000)
print_help_formatted("20th fibonacci number is: %d", fibonacci(20))
terminate_this_custom_script()

function fibonacci(n: int): int   
    if n <= 1
    then
        return n
    end
    return fibonacci(n - 1) + fibonacci(n - 2)
end


It calculates a 20th fibonacci number and prints it to the screen. This script can be compiled with Sanny Builder 4.1-alpha.0 build that I will share with patrons on Discord.

To make new features work you also need a special version of CLEO 5, also published on Discord. The public version don't have support yet, but I will be working on adding it soon. And because this is CLEO 5, new features are only available in GTA San Andreas, but eventually they will be expanded to III and VC.

If you have any feedback or questing, reach me on Discord. Thanks!

P.S. 4.0 release is dropping this weekend!

Comments

love it! :)

Demsa Levente


More Creators