home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58b_TRIBES.iso / Tribes / base / scripts.vol / menu.cs < prev    next >
Encoding:
Text File  |  1998-12-16  |  1.9 KB  |  79 lines

  1. function Client::cancelMenu(%clientId)
  2. {
  3.    if(!%clientId.menuLock)
  4.    {
  5.       %clientId.selClient = "";
  6.       %clientId.menuMode = "";
  7.       %clientId.menuLock = "";
  8.       remoteEval(%clientId, "CancelMenu");
  9.       Client::setMenuScoreVis(%clientId, false);
  10.    }
  11. }
  12.  
  13. function Client::buildMenu(%clientId, %menuTitle, %menuCode, %cancellable)
  14. {
  15.    Client::setMenuScoreVis(%clientId, true);
  16.    %clientId.menuLock = !%cancellable;
  17.    %clientId.menuMode = %menuCode;
  18.    remoteEval(%clientId, "NewMenu", %menuTitle);
  19. }
  20.  
  21. function Client::addMenuItem(%clientId, %option, %code)
  22. {
  23.    remoteEval(%clientId, "AddMenuItem", %option, %code);
  24. }
  25.  
  26. function remoteCancelMenu(%server)
  27. {
  28.    if(%server != 2048)
  29.       return;
  30.    if(isObject(CurServerMenu))
  31.       deleteObject(CurServerMenu);
  32. }
  33.  
  34. function remoteNewMenu(%server, %title)
  35. {
  36.    if(%server != 2048)
  37.       return;
  38.  
  39.    if(isObject(CurServerMenu))
  40.       deleteObject(CurServerMenu);
  41.  
  42.    newObject(CurServerMenu, ChatMenu, %title);
  43.    setCMMode(PlayChatMenu, 0);
  44.    setCMMode(CurServerMenu, 1);
  45. }
  46.  
  47. function remoteAddMenuItem(%server, %title, %code)
  48. {
  49.    if(%server != 2048)
  50.       return;
  51.    addCMCommand(CurServerMenu, %title, clientMenuSelect, %code);
  52. }
  53.  
  54. function clientMenuSelect(%code)
  55. {
  56.    deleteObject(CurServerMenu);
  57.    remoteEval(2048, menuSelect, %code);
  58. }
  59.  
  60. function remoteMenuSelect(%clientId, %code)
  61. {
  62.    %mm = %clientId.menuMode;
  63.    %evalString = "processMenu" @ %mm @ "(" @ %clientId @ ", \"" @ %code @ "\");";
  64.    %clientId.menuMode = "";
  65.    %clientId.menuLock = "";
  66.    dbecho(2, "MENU: " @ %clientId @ "- " @ %evalString);
  67.    eval(%evalString);
  68.    if(%clientId.menuMode == "")
  69.    {
  70.       Client::setMenuScoreVis(%clientId, false);
  71.       %clientId.selClient = "";
  72.    }
  73. }
  74.  
  75. // processMenu called on blank menu
  76. function processMenu(%client, %code)
  77. {
  78.    echo("Client " @ %client @ ": invalid menu code " @ %code @ " - no menu");
  79. }