huderlem / poryscript

High-level scripting language for gen 3 pokemon decompilation projects
https://www.huderlem.com/poryscript-playground/
MIT License
197 stars 22 forks source link

Allow multiple vars/var values of the same mapscript to use a single script #52

Open Jaizu opened 1 year ago

Jaizu commented 1 year ago

Would allow converting something like this:

    MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE [
        VAR_BIRCH_LAB_STATE, 2 {
            turnobject (OBJ_EVENT_ID_PLAYER, DIR_NORTH)
        }
        VAR_DEX_UPGRADE_JOHTO_STARTER_STATE, 1: LittlerootTown_ProfessorBirchsLab_EventScript_SetObjectPosForDexUpgrade
        VAR_DEX_UPGRADE_JOHTO_STARTER_STATE, 2: LittlerootTown_ProfessorBirchsLab_EventScript_SetObjectPosForDexUpgrade
        }

Into this:

    MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE [
        VAR_BIRCH_LAB_STATE, 2 {
            turnobject (OBJ_EVENT_ID_PLAYER, DIR_NORTH)
        }
        VAR_DEX_UPGRADE_JOHTO_STARTER_STATE, 1,
        VAR_DEX_UPGRADE_JOHTO_STARTER_STATE, 2
        {
            // Content of LittlerootTown_ProfessorBirchsLab_EventScript_SetObjectPosForDexUpgrade
        }
huderlem commented 1 year ago

I looked into this in the past, but I couldn't come up with a good syntax at the time. There was difficulty with using switch-case-like syntax due to ambiguity in the parsing logic. I'd still like to do this, though.