Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSL Modules #1

Open
RyanHecht opened this issue Jul 31, 2024 · 2 comments
Open

DSL Modules #1

RyanHecht opened this issue Jul 31, 2024 · 2 comments

Comments

@RyanHecht
Copy link
Contributor

Currently, in order to write the "Magic Kingdom Mountaineer" achievement, you must write this:

achievement {
    name "Magic Kingdom Mountaineer"
    description "Ride the three mountains of Magic Kingdom without warping or teleporting"
    icon "IRON_SPADE:20"
    reward "MONEY:500"

    initialState {
        rodeSpaceMountain: false
        rodeBigThunderMountain: false
        rodeSplashMountain: false
        warpedOrTeleported: false
    }

    activators {
        state.rodeSpaceMountain && state.rodeBigThunderMountain && state.rodeSplashMountain
    }

    deactivators {
        state.warpedOrTeleported
    }

    events {
        on("CompleteRideEvent") {
            if (event.rideId == 1) {
                state.rodeSpaceMountain = true
            }
            if (event.rideId == 2) {
                state.rodeBigThunderMountain = true
            }
            if (event.rideId == 3) {
                state.rodeSplashMountain = true
            }
        }
        on("TeleportPlayerToPlayerEvent") {
            state.warpedOrTeleported = true
        }
        on("PlayerWarpEvent") {
            state.warpedOrTeleported = true
        }
    }
}

This is very verbose, and one can imagine LOTS of achievements that would want to use the notion of completing rides and disallowing warping/teleporting. I propose a modular system for the BIGAL DSL that would make the "Magic Kingdom Mountaineer" achievement look like this:

achievement {
    name "Magic Kingdom Mountaineer"
    description "Ride the three mountains of Magic Kingdom without warping or teleporting"
    icon "IRON_SPADE:20"
    reward "MONEY:500"

    activators {
        completeRide(id: 1) && completeRide(id: 2) && completeRide(id: 3)
    }

    deactivators {
        warpOrTeleport()
    }
}

and modules that look something like this:

module { id ->
  name "completeRide"
  
  initialState {
      rodeIt: false      
  }

  activators {
    state.rodeIt
  }

  events {
    on("CompleteRideEvent") {
            if (event.rideId == id) {
                state.rodeIt = true
            }
        }
  }
}

It's important that the state scopes don't conflict, I should be able to use the completeRide module in a module or achievement that has its own rodeIt variable.

@casptyche
Copy link

Is this still desired?

@RyanHecht
Copy link
Contributor Author

@casptyche Yes! This is definitely the next big feature I want to add to the language

...to be honest I just made this issue because I was playing with Copilot Workspace :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants