glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] Hints support in USL + questions


From: Bradley Arsenault
Subject: Re: [glob2-devel] Hints support in USL + questions
Date: Tue, 21 Oct 2008 11:37:35 -0400

in Game Objectives,
    void setObjectiveComplete(int n);
    void setObjectiveIncomplete(int n);
    void setObjectiveFailed(int n);
    void setObjectiveHidden(int n);
    void setObjectiveVisible(int n);
Are the five most important functions. You can also expose, for scripting purposes, the data-retrieving functions

    const std::string& getGameObjectiveText(int n);
    bool isObjectiveVisible(int n);
    bool isObjectiveComplete(int n);
    bool isObjectiveFailed(int n);
    GameObjectiveType getObjectiveType(int n);

However! The problem here is that n isn't the exact number as seen by the script, like 1,2,3 ... 16.  N is just an index of the object. The script sees the "script numbers", which are the ones shown in the GUI, and are set and retrieved by

    void setScriptNumber(int n, int scriptNumber);
    int getScriptNumber(int n);

This is why in SGSL, the setObjectiveComplete functions and such look through all of the objectives to find one with a matching 'script number'

void Story::objectiveFailed(GameGUI* gui)
{
    int n = line[++lineSelector].value;
    for(int i=0; i<gui->game.objectives.getNumberOfObjectives(); ++i)
    {
        if(gui->game.objectives.getScriptNumber(i) == n)
        {
            gui->game.objectives.setObjectiveFailed(i);
            break;
        }
    }
}

--
Extra cheese comes at a cost. Bradley Arsenault.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]