thiloplanz / glulx-typescript

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

Append Channel Content #26

Closed ChicagoDave closed 8 years ago

ChicagoDave commented 8 years ago

When you select a channel, write to it, then select a different channel, then select the first channel again and write to it, the original content is overwritten. It should always append. I've added a new ulx file to show...the CMGT channel should have 11 lines in it and it only has 1.

Stop the IFPress!.zip

ChicagoDave commented 8 years ago

I have a fix:

In Output.ts, replace the setChannel function as shown here;

    /**  If the output channel is changed to any channel other than
    * "MAIN", the undefined channel will be initialized.
    */
    setChannel(c: string){
        if (c === this.channel) return;
        this.channel = c;
        if (c !== 'MAIN'){
            if (this.channelData[c] == undefined) {
                this.channelData[c] = '';
            }
        }
    }
ChicagoDave commented 8 years ago

And my version of fyrevm-web is updated with the changes to implement document.fyrevm.

There's an UpdateContent function that takes the contents of CMGT (only received on game start) and appends channels to document.fyrevm.

So:

document.fyrevm.mainContent = ChannelData.MAIN document.fyrevm.locationName = ChannelData.LOCN

and so on...

It clears out document.fyrevm each time, so only content-filled channels get set.

This is a work in progress. I can see going in different directions, including giving a template-bound object to FyreVM.Manager that gets updated.

It also recognizes the difference between, text, number, and json and does the right thing.

ChicagoDave commented 8 years ago

Oh I couldn't get the "Stop the IFPress!.fyrevm" directory to work so I renamed it and then it started working. Not sure if this is a windows thing or what.