how to modify an object in a table in inform 7

in #programming4 months ago

I want to share a trick I learned handling inform7 stories when you want to make debug commands

unresolvecheat is an action applying to one topic.

understand "unresolve [text]" as unresolvecheat.
carry out unresolvecheat:
    repeat with X running from 1 to number of filled rows in Table of GameEventIDs:
        choose row X from the Table of GameEventIDs;
        if Name entry exactly matches the text topic understood, case insensitively:
            now Object entry is unresolved;
            break;

the above code functions to modify the property of an event in the table of GameEventIDs
so that the player can attempt it again.

at first I was having trouble because i couldnt figure out how to modify a property of a selected row but then i figured out the answer was Object entry. This is important because X which is what i attempted to use at the start is not the object but the index of the object in the table.

ergo I attempted to make this line work

now X is unresolved;

but it was syntaticly invalid

Sort:  

It's nice sharing your ideas and I really do appreciate you for that.

Thanks for sharing 👍

Your post has been submitted to be manually curated by @gitplait community account because this is the kind of publications we like to see in our community.

Join our Community on Hive and Chat with us on Discord.

[Gitplait-Team]

you are welcome inform7 is a tough language not just to code but to also describe because of its english-like (well too be fair it also supports other languages) syntax. you can quickly end up trying to describe the language using parts of the language.