home *** CD-ROM | disk | FTP | other *** search
/ Amiga Special: Spiele Hits / Hits-CD.iso / aminet / spiele / ammud1_1.lha / AmigaMUD / Src / Basics / handler.m < prev    next >
Text File  |  1997-06-29  |  3KB  |  92 lines

  1. /*
  2.  * Amiga MUD
  3.  *
  4.  * Copyright (c) 1997 by Chris Gray
  5.  */
  6.  
  7. /*
  8.  * handler.m - define and install the new-player handler. This is done
  9.  *    last in sourcing the scenario, so that it can use anything from
  10.  *    any of the pieces of the scenario, including optional parts.
  11.  */
  12.  
  13. /*
  14.  * newPlayer - this is the routine which we set up to be called when a
  15.  *    new player is created.
  16.  */
  17.  
  18. define tp_misc proc newPlayer()void:
  19.     string name;
  20.     thing me;
  21.     action a;
  22.  
  23.     me := Me();
  24.     name := me@p_pName;
  25.     me@p_pCarrying := CreateThingList();
  26.     me@p_pHiddenList := CreateThingList();
  27.     if me@p_pDesc = "" then
  28.     /* not SysAdmin */
  29.     me@p_pDesc := Capitalize(name) + " is a nondescript adventurer.";
  30.     me@p_pMoney := 75;
  31.     fi;
  32.     /* Do this carefully. We have set SysAdmin up with these lists already,
  33.        and some code, e.g. the build2 code, has added routines to these
  34.        lists, which we want to execute after all normal setup is done. */
  35.     if me@p_pEnterActions = nil then
  36.     me@p_pEnterActions := CreateActionList();
  37.     fi;
  38.     if me@p_pExitActions = nil then
  39.     me@p_pExitActions := CreateActionList();
  40.     fi;
  41.     me@p_pVerbose := true;
  42.     me@p_pSuperBrief := false;
  43.     me@p_pEchoPose := false;
  44.     me@p_pStandard := true;
  45.     me@p_pPosition := POS_NONE;
  46.     me@p_pWhere := me;
  47.     me@p_pCursor := MakeCursor();
  48.     me@p_pCursorColour := C_BLUE;
  49.     me@p_pIconColour := C_RED;
  50.     me@p_pTextColours := CreateIntList();
  51.     AddTail(me@p_pTextColours, 0x000);
  52.     AddTail(me@p_pTextColours, 0xb80);
  53.     AddTail(me@p_pTextColours, 0xa60);
  54.     AddTail(me@p_pTextColours, 0xda0);
  55.     me@p_MapGroup := NO_MAP_GROUP;
  56.     SetLocation(r_arrivals);
  57.     ignore SetCharacterInputAction(parseInput);
  58.     ignore SetCharacterRawKeyAction(handleRawKey);
  59.     ignore SetCharacterButtonAction(StandardButtonHandler);
  60.     ignore SetCharacterMouseDownAction(StandardMouseDownHandler);
  61.     ignore SetCharacterIdleAction(idleAction);
  62.     ignore SetCharacterActiveAction(activeAction);
  63.     if GOn(nil) then
  64.     InitStandardGraphics();
  65.     else
  66.     me@p_pStandardGraphicsDone := false;
  67.     fi;
  68.     if GlobalThing@p_FreeBuilding then
  69.     /* Build facility might not be present! */
  70.     a := LookupAction(tp_misc, "doMakeBuilder");
  71.     if a ~= nil then
  72.         ignore call(a, status)();
  73.     fi;
  74.     fi;
  75.     /* This will cause SysAdmin to become a builder. */
  76.     DoList(me@p_pEnterActions);
  77.     note - we assume the arrivals room is not dark;
  78.     ForEachAgent(r_arrivals, ShowIconOnce);
  79.     OPrint("New player " + name + " has appeared.\n");
  80.     Print("Welcome to the sample V" + IntToString(ServerVersion() / 10) + "." +
  81.      IntToString(ServerVersion() % 10) + " MUD world, " + name +
  82.     "! Your character has been created, but it is quite minimal - "
  83.     "you are not carrying anything, and your appearance is dull. "
  84.     "You will soon be able to remedy these conditions. Some of the "
  85.     "commands available: quit, north, n, up, enter, northeast, verbose, "
  86.     "terse, inventory, get, drop, look, examine, etc. Have fun!\n");
  87.     ignore ShowClients(false);
  88.     ignore ShowRoomToMe(true);
  89. corp;
  90.  
  91. ignore SetNewCharacterAction(newPlayer)$
  92.