Skip to content

Demo 03 Construction

nhmkdev edited this page Jan 13, 2014 · 10 revisions

Description

Demo 03 contains the ATM (All Things Machine), an interact/dialog driven entity as well as a complex puzzle involving a Thing entity that is controlled by 3 switches in other levels.

(todo add links)

All Things Machine (Interact)

Entity Settings / Data

Setting Value
interact atm
Interacts.atm =
{
    d:'ATM.main',
    ht: 'All Things Machine',
    ao:
    {
        i:'atm',
        w:32,
        h:48,
        a:
        [

            {
                n:'main',
                ft:'0.2',
                seq:[0, 1, 2, 3, 0, 4, 4, 0, 4, 4]
            }
        ]
    }
}

In the interact settings the dialog specified drives the interface of the ATM.

Dialogs.ATM.main =
{
    s:
    {
        f:'04b03.font',
        w:220,
        h:0,
        x:20,
        y:15,
        osx:5,
        osy:6,
        win:
            [
                Windows.atmbg
            ],
        c:'objects.atm' // The class driving the actions taken by the dialog and token translation
    },
    sa:
    [
        {
            n:'main',
            t:'All Things Machine\nPoints In Savings: [points]',
            o:
            [
                {
                    t:'Point Savings',
                    ns:'savings'
                },
                {
                    t:'Gamble',
                    ns:'gamble'
                },
                {
                    t:'Exit ATM'
                }
            ]
        },
        {
            n:'savings',
            t:'All Things Machine Savings Menu\nPoints In Savings: [points]',
            o:
            [
                {
                    t:'Add 50 to Savings',
                    ca:'save', 
                    cav:{ pt:-50}, // class method var
                    ns:'savings',
                    r:{i:[['i','pt','>=50']]}
                },
                {
                    t:'Widthdraw 50 from Savings',
                    ca:'save', // class method
                    cav:{ pt:50 }, // class method var
                    ns:'savings', 
                    r:{i:[['atm','pt','>=50']]}
                },
                {
                    t:'Widthdraw [points] from Savings',
                    ca:'save', // class method
                    cav:{ pt:-1 }, // class method var
                    ns:'savings',
                    r:{i:[['atm','pt','<50'],['atm','pt','>0']]}
                },
                {
                    t:'Widthdraw from Savings (Disabled due to lack of funds)',
                    ns:'savings',
                    r:{i:[['atm','pt','==0']]}
                },
                {
                    t:'Back',
                    ns:'main'
                },
                {
                    t:'Exit ATM'
                }
            ]
        },
        {
            n:'gamble',
            t:'All Things Machine Gambling Menu\nPoints In Savings: [points]',
            o:
            [
                {
                    t:'Use 10 Points for a chance to win 100 points.',
                    ca:'gamble', // class method
                    cav:{ pt:-10, ptw:100 }, // class method var
                    ns:'gamble',
                    r:{i:[['atm','pt','>=10']]}
                },
                {
                    t:'Use 20 Points for a chance to win 200 points.',
                    ca:'gamble', // class method
                    cav:{ pt:-20, ptw:200 }, // class method var
                    ns:'gamble',
                    r:{i:[['atm','pt','>=20']]}
                },
                {
                    t:'Back',
                    ns:'main'
                },
                {
                    t:'Exit ATM'
                }
            ]
        }
    ]
}

ATM Class

The actual work of the ATM is generally handled in the ATM object. This is a specialized code file allowing dialogs to make calls into the code for translating tokens in text and performing various actions. Class File

Door (Switch and Thing)

Entity Settings / Data

Clone this wiki locally