thiloplanz / glulx-typescript

Glulx VM in TypeScript with Channel IO
14 stars 10 forks source link

Hardcoded channel names #23

Closed ChicagoDave closed 8 years ago

ChicagoDave commented 8 years ago

In Output.ts, you have:

export interface ChannelData {
    [channel: string] : string; 
    MAIN?: string;
    PRPT?: string;  // prompt
    LOCN?: string;  // location
    SCOR?: string;  // score
    TIME?: string;  // time (hhmm)
    TURN?: string;  // turn count
    PLOG?: string;  // prologue,
    DEAD?: string;  // Death text (shown when player dies)
    ENDG?: string;  // End game text
    INFO?: string;  // Story info text (comes out as JSON)
    SNOT?: string;  //  Notify if score changes
}

We can't do it this way. The author can add new channels and I already have I7 extensions that will add other channels.

We should something like: https://bitbucket.org/dev_lando/typescriptdictionary

And loop through the channels and add them to the dictionary dynamically.

thiloplanz commented 8 years ago

That's just the Typescript interface, it has no effect at runtime. You can add and retrieve channel data for other names as well, it is not limited to the ones listed here. The ChannelData is in effect just a dictionary and EngineWrapper passes through all data that the game writes into the channels. Please try if it works with the I7 extensions you mentioned.

ChicagoDave commented 8 years ago

Got it. You know I think I poked about this last year and you gave me the same answer.