oopsk

Addon oopsk 1.0-beta2

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

beta 2

Beta 2 introduces some very interesting features, namely concrete types and custom converters. These crack open the very heart of Skript's internals, so I'm rather tentative about declaring them stable. They should be treated with care. I want to double down on the advice that you should always reload all scripts after editing a struct template. This is even more important with the registration of types and converters, now. If you are encountering weird behavior, reload all and see if it still occurs.

concrete types:
Code:
struct alpha:
    b: bravo struct
    c: number

struct bravo:
    d: string = "bravo"
    
function test(input: alpha struct):
    broadcast {_input}->b->d # should always print "bravo"
Concrete types means you can now use _ struct as a type in fields, functions, and more! This should help with specifying typing in your custom functions and nested structs.

custom converters
Code:
struct ServerPlayer:
    player: player
    money: number
    max_health: number
    converts to:
        player via this->player
        location via this->player's location
Custom converters allow you to register types that Skript can convert your struct object to automatically. This lets you do things like teleport {struct} to me if you have a player/entity converter for the struct. Due to restrictions with Skript's converter system and the hacking I have to do to make this work, this will not register chaining converters for you, so if you provide a player converter, Skript will not be able to convert it to a location despite the existence of a player->location converter it could chain with. Use with care!


Changelog:
- Allows options in fields
- Allow single Object fields to accept any type in acceptChange (thanks @miberss)
- Adds concrete types for struct templates.
- Adds custom converters for struct types.

Full Changelog: https://github.com/sovdeeth/oopsk/compare/1.0-beta1...1.0-beta2
beta a

Beta 1 should be a rather stable release. I intend to a set of (experimental) reflective syntaxes before release, like getting the type of a field, the field names of a struct, and unsafe accesses to structs with strings instead of literal field names. Excluding those, this beta is feature complete.

Changelog:
- Adds add/remove changers for fields
- Adds dynamic fields, fields that always evaluate their expression when retrieved, rather than evaluating once on creation. These cannot be set manually after creation.
- Fixes a few bugs with changers
- Adds automated test support
- Adds a struct copy expression to get deep copies of a struct.

Full Changelog: https://github.com/sovdeeth/oopsk/compare/1.0-alpha2...1.0-beta1