quest_room.scr

lima-1.0b5/lib/domains/std/2.4.5/quest_room.scr · 2.0 KB

From the archive lima-1.0b5+driver.tar.gz

Download the archive   « Back to the archive contents

# Do not remove the headers from this file! see /USAGE for more info.

is=room
exits=south:wiz_hall.scr
brief=Room of quests
long=
  This is the room of quests. Every wizard can make at most one quest.\n
  When he has made a quest, he should have it approved by an arch wizard.\n
  When it is approved, put a permanent object in this room, wich has as\n
  short description the name of the wizard. All objects in this room will be\n
  checked when a player wants to become a wizard. The player must have\n
  solved ALL quests. To mark that a quest is solved, call 'set_quest(\"name\")'\n
  in the player object. The objects must all accept the id 'quest' and the\n
  name of the wizard. The objects must also define a function hint(),\n
  that should return a message giving a hint of where to start the quest.\n
  Note that players never can come here. set_quest(str) will return 1 if\n
  this is the first time it was solved by this player, otherwise 0.
end
light=1

---
/* FIXME */
#define FREE_QUESTS 0
int count(int silently) {
    object ob;
    int i;

    ob = first_inventory(this_object());
    while(ob) {
	if (call_other(ob, "id", "quest")) {
	    string str;
	    str = call_other(ob, "short");
	    if (!call_other(this_player(), "query_quests", str))
		i += 1;
	}
	ob = next_inventory(ob);
    }
    if (!silently) {
	if (i == 0)
	    write("You have solved all quests!\n");
	else {
	    write("You have " + i + " quests unsolved.\n");
	    if (i - FREE_QUESTS <= 0)
		write("You don't have to solve any more quests.\n");
	    else
		write("You must solve " + (i - FREE_QUESTS) + " of these.\n");
	}
    }
    if (i - FREE_QUESTS < 0)
	return 0;
    return i - FREE_QUESTS;
}

void list(int i) {
    object ob;

    ob = first_inventory(this_object());
    while(ob) {
	if (call_other(ob, "id", "quest")) {
	    string str;
	    str = call_other(ob, "short");
	    if (!call_other(this_player(), "query_quests", str))
		i -= 1;
	    if (i == 0) {
		write(call_other(ob, "hint") + "\n");
		return;
	    }
	}
	ob = next_inventory(ob);
    }
}

Site Stats

Snippets: 1791
Codebases: 571