home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #7 / amigamamagazinepolishissue1998.iso / rozrywka / rpg / amigamud / src / basics / chat.m < prev    next >
Text File  |  1997-06-10  |  21KB  |  908 lines

  1. /*
  2.  * Amiga MUD
  3.  *
  4.  * Copyright (c) 1997 by Chris Gray
  5.  */
  6.  
  7. /*
  8.  * chat.m - add a simple chat mode.
  9.  */
  10.  
  11. private tp_chat CreateTable()$
  12. use tp_chat
  13.  
  14. define tp_chat ChatThing CreateThing(nil)$
  15. define tp_chat p_chNoiseAdverbs CreateStringProp()$
  16. define tp_chat p_chActionAdverbs CreateStringProp()$
  17. ChatThing@p_chNoiseAdverbs := ""$
  18. ChatThing@p_chActionAdverbs := ""$
  19.  
  20. define tp_chat p_pSaveAction CreateActionProp()$
  21. define tp_chat p_pSavePrompt CreateStringProp()$
  22. define tp_chat p_pChatting CreateBoolProp()$
  23. define tp_chat p_pChatAliases CreateThingListProp()$
  24.  
  25. define tp_chat p_chKey CreateStringProp()$
  26. define tp_chat p_chContents CreateStringProp()$
  27.  
  28. define tp_chat proc chatReset()void:
  29.     thing me;
  30.  
  31.     me := Me();
  32.     ignore SetPrompt(me@p_pSavePrompt);
  33.     me -- p_pSavePrompt;
  34.     ignore SetCharacterInputAction(me@p_pSaveAction);
  35.     me -- p_pSaveAction;
  36.     me -- p_pChatting;
  37.     DelElement(me@p_pEnterActions, chatReset);
  38.     DelElement(me@p_pExitActions, chatReset);
  39. corp;
  40.  
  41. define tp_chat proc chatHandler(string line)void:
  42.     thing me, alias;
  43.     list thing aliases;
  44.     int count;
  45.     string word, contents;
  46.     bool found;
  47.  
  48.     me := Me();
  49.     if line = "." or line = "$" then
  50.     chatReset();
  51.     elif SubString(line, 0, 1) = "!" then
  52.     call(me@p_pSaveAction, void)(SubString(line, 1, Length(line) - 1));
  53.     else
  54.     aliases := me@p_pChatAliases;
  55.     SetTail(line);
  56.     word := GetWord();
  57.     if word == "alias" then
  58.         word := GetWord();
  59.         if word = "" then
  60.         if aliases = nil then
  61.             Print("You have no chat aliases.\n");
  62.         else
  63.             count := Count(aliases);
  64.             Print("Chat aliases:\n");
  65.             while count ~= 0 do
  66.             count := count - 1;
  67.             alias := aliases[count];
  68.             Print("  ");
  69.             Print(alias@p_chKey);
  70.             Print(" => ");
  71.             Print(alias@p_chContents);
  72.             Print("\n");
  73.             od;
  74.         fi;
  75.         else
  76.         Print("Chat alias '");
  77.         Print(word);
  78.         Print("' ");
  79.         found := false;
  80.         if aliases ~= nil then
  81.             count := Count(aliases);
  82.             while count ~= 0 and not found do
  83.             count := count - 1;
  84.             alias := aliases[count];
  85.             if alias@p_chKey == word then
  86.                 found := true;
  87.             fi;
  88.             od;
  89.         fi;
  90.         contents := GetTail();
  91.         if contents = "" then
  92.             if found then
  93.             DelElement(aliases, alias);
  94.             Print("removed.\n");
  95.             else
  96.             Print("does not exist.\n");
  97.             fi;
  98.         else
  99.             if SubString(contents, 0, 1) = "\"" then
  100.             contents := SubString(contents, 1, Length(contents)-2);
  101.             fi;
  102.             if found then
  103.             alias@p_chContents := contents;
  104.             Print("updated.\n");
  105.             else
  106.             if aliases = nil then
  107.                 aliases := CreateThingList();
  108.                 me@p_pChatAliases := aliases;
  109.             fi;
  110.             alias := CreateThing(nil);
  111.             alias@p_chKey := word;
  112.             alias@p_chContents := contents;
  113.             AddTail(aliases, alias);
  114.             Print("added.\n");
  115.             fi;
  116.         fi;
  117.         fi;
  118.     else
  119.         alias := nil;
  120.         if aliases ~= nil then
  121.         count := Count(aliases);
  122.         while count ~= 0 and not found do
  123.             count := count - 1;
  124.             alias := aliases[count];
  125.             if alias@p_chKey == word then
  126.             found := true;
  127.             fi;
  128.         od;
  129.         fi;
  130.         if found then
  131.         DoSay(alias@p_chContents + " " + GetTail());
  132.         else
  133.         DoSay(line);
  134.         fi;
  135.     fi;
  136.     fi;
  137. corp;
  138.  
  139. define tp_chat proc v_chat()bool:
  140.     thing me;
  141.     action oldAction;
  142.     string tail;
  143.  
  144.     me := Me();
  145.     if me@p_pChatting then
  146.     Print("You are already in chat mode!\n");
  147.     false
  148.     else
  149.     tail := GetTail();
  150.     if tail = "" then
  151.         oldAction := SetCharacterInputAction(chatHandler);
  152.         if oldAction = nil then
  153.         OPrint(Capitalize(CharacterNameS(me)) + " is confused.\n");
  154.         false
  155.         else
  156.         me@p_pChatting := true;
  157.         me@p_pSaveAction := oldAction;
  158.         me@p_pSavePrompt := SetPrompt("chat> ");
  159.         AddHead(me@p_pEnterActions, chatReset);
  160.         AddHead(me@p_pExitActions, chatReset);
  161.         true
  162.         fi
  163.     else
  164.         chatHandler(tail);
  165.         true
  166.     fi
  167.     fi
  168. corp;
  169.  
  170. VerbTail(G, "c", v_chat)$
  171. Synonym(G, "c", "chat")$
  172.  
  173. define tp_chat proc v_whisper()bool:
  174.     string what, ch, agentName;
  175.     character who;
  176.     thing agent;
  177.  
  178.     what := GetWord();
  179.     if what == "to" then
  180.     what := GetWord();
  181.     fi;
  182.     if what = "" then
  183.     Print("Specify who you want to whisper to.\n");
  184.     false
  185.     else
  186.     ch := SubString(what, Length(what) - 1, 1);
  187.     if ch = "," or ch = ":" then
  188.         what := SubString(what, 0, Length(what) - 1);
  189.     fi;
  190.     who := Character(what);
  191.     if who = nil then
  192.         who := Character(Capitalize(what));
  193.     fi;
  194.     if who = nil then
  195.         agent := FindAgent(what);
  196.     else
  197.         agent := CharacterThing(who);
  198.     fi;
  199.     if agent = nil then
  200.         Print("You can't whisper to " + what + ".\n");
  201.         false
  202.     elif agent = Me() then
  203.         Print("You can't whisper to yourself!\n");
  204.         false
  205.     else
  206.         what := GetTail();
  207.         agentName := CharacterNameS(agent);
  208.         if what = "" then
  209.         Print("Specify what you want to whisper to " +
  210.             agentName + ".\n");
  211.         false
  212.         else
  213.         if Me()@p_pEchoPose then
  214.             Print("You whisper to " + agentName + ": " +
  215.             what + "\n");
  216.         fi;
  217.         note - Magic value of 10 is probability of being overheard;
  218.         if Whisper("", what, agent, 10) then
  219.             true
  220.         else
  221.             Print(agentName + " is not here!\n");
  222.             false
  223.         fi
  224.         fi
  225.     fi
  226.     fi
  227. corp;
  228.  
  229. VerbTail(G, "wh", v_whisper)$
  230. Synonym(G, "wh", "whisper")$
  231.  
  232. define tp_chat proc v_pose()bool:
  233.     thing me;
  234.     string activity;
  235.  
  236.     me := Me();
  237.     activity := GetTail();
  238.     if activity = "" then
  239.     Print("You must give the pose/emote you want to do.\n");
  240.     false
  241.     elif not CanSee(Here(), me) then
  242.     Print("It is dark - no-one could see you " + activity + "!\n");
  243.     false
  244.     elif me@p_pHidden then
  245.     Print("You are hidden - no-one could see you " + activity + "!\n");
  246.     false
  247.     else
  248.     if GlobalThing@p_FreePoses then
  249.         Pose("", activity);
  250.         if me@p_pEchoPose then
  251.         Print("You " + activity + ".\n");
  252.         fi;
  253.     else
  254.         Pose("", "=> " + activity);
  255.         if me@p_pEchoPose then
  256.         Print("You => " + activity + ".\n");
  257.         fi;
  258.     fi;
  259.     true
  260.     fi
  261. corp;
  262.  
  263. VerbTail(G, "pose", v_pose)$
  264. Synonym(G, "pose", "emote")$
  265. Synonym(G, "pose", ":")$
  266.  
  267. define tp_chat proc v_emit()bool:
  268.     thing me, here;
  269.     string message;
  270.  
  271.     me := Me();
  272.     message := GetTail();
  273.     if message = "" then
  274.     Print("You must give the emit you want to do.\n");
  275.     Print("  E.g.   .It is very quiet here.\n");
  276.     false
  277.     else
  278.     here := Here();
  279.     if GlobalThing@p_FreePoses then
  280.         ABPrint(here, nil, nil, message + "\n");
  281.     else
  282.         ABPrint(here, nil, nil,
  283.         "[" + CharacterNameG(me) + "] " + message + "\n");
  284.     fi;
  285.     true
  286.     fi
  287. corp;
  288.  
  289. VerbTail(G, "emit", v_emit)$
  290. Synonym(G, "emit", ".")$
  291.  
  292. define tp_chat proc actionAdverb(string s)void:
  293.     ChatThing@p_chActionAdverbs := ChatThing@p_chActionAdverbs + s;
  294. corp;
  295.  
  296. actionAdverb("aimlessly,aimless,aim.")$
  297. actionAdverb("awkwardly,awkward,awk.")$
  298. actionAdverb("briefly,brief.")$
  299. actionAdverb("briskly,brisk.")$
  300. actionAdverb("clumsily,clumsy,clu.")$
  301. actionAdverb("crazily,crazy,cra.")$
  302. actionAdverb("deeply,deep.")$
  303. actionAdverb("enthusiastically,enthusiastic,enthuse,ent.")$
  304. actionAdverb("exitedly,excited,exc,e.")$
  305. actionAdverb("fervently,fervent,fer.")$
  306. actionAdverb("firmly,firm.")$
  307. actionAdverb("frentically,frentic,fren,fre.")$
  308. actionAdverb("furiously,furious,fur.")$
  309. actionAdverb("gayly,gay.")$
  310. actionAdverb("gracefully,gracefull,gra.")$
  311. actionAdverb("happily,happy,h.")$
  312. actionAdverb("hesitantly,hesitant,hes.")$
  313. actionAdverb("hurriedly,hurry,hur.")$
  314. actionAdverb("impatiently,impatient,imp.")$
  315. actionAdverb("majestically,majestic,maj.")$
  316. actionAdverb("merrily,merry,mer.")$
  317. actionAdverb("mischievously,mischievous,mis.")$
  318. actionAdverb("mockingly,mocking,mock.")$
  319. actionAdverb("mysteriously,mysterious,mys.")$
  320. actionAdverb("nastily,nasty,nas.")$
  321. actionAdverb("naughtily,naughty,nau.")$
  322. actionAdverb("passionately,passionate,pas.")$
  323. actionAdverb("patiently,patient,pat.")$
  324. actionAdverb("playfully,playfull,pla.")$
  325. actionAdverb("pointedly,pointed,poi.")$
  326. actionAdverb("politely,polite,pol.")$
  327. actionAdverb("quickly,quick,qui,q,f.")$
  328. actionAdverb("rapidly,rapid,rap.")$
  329. actionAdverb("sadly,sad.")$
  330. actionAdverb("sharply,sharp,sha.")$
  331. actionAdverb("slowly,slow,slo,s.")$
  332. actionAdverb("smoothly,smooth,smo.")$
  333. actionAdverb("solemnly,solemn,sol.")$
  334. actionAdverb("suddenly,sudden,sud.")$
  335. actionAdverb("suggestively,suggest,sug.")$
  336. actionAdverb("swiftly,swift,swi.")$
  337. actionAdverb("tiredly,tired,tir.")$
  338. actionAdverb("unhappily,unhappy,unh.")$
  339. actionAdverb("vaguely,vague,vag.")$
  340. actionAdverb("vigorously,vigorous,vig.")$
  341. actionAdverb("violently,violent,vio.")$
  342. actionAdverb("wearily,weary,wea.")$
  343. actionAdverb("wildly,wild,wil.")$
  344. actionAdverb("wobbly,wobble,wob.")$
  345.  
  346. define tp_chat proc makeAction(string pose)bool:
  347.     thing me;
  348.     string adverb;
  349.     int which;
  350.  
  351.     me := Me();
  352.     adverb := GetWord();
  353.     if adverb ~= "" then
  354.     which := MatchName(ChatThing@p_chActionAdverbs, adverb);
  355.     if which ~= -1 then
  356.         adverb := SelectName(ChatThing@p_chActionAdverbs, which);
  357.         if not CanSee(Here(), me) then
  358.         Print("It is dark - no-one could see you " + pose + "!\n");
  359.         false
  360.         elif me@p_pHidden then
  361.         Print("You are hidden - no-one could see you " + pose + "!\n");
  362.         false
  363.         else
  364.         Pose("", Pluralize(pose) + " " + SelectWord(adverb, 0) + ".");
  365.         if me@p_pEchoPose then
  366.             Print("You " + pose + " " + SelectWord(adverb, 0) + ".\n");
  367.         fi;
  368.         true
  369.         fi
  370.     else
  371.         Print("Unknown action adverb '" + adverb + "'. Known ones:\n");
  372.         which := 0;
  373.         while
  374.         adverb := SelectName(ChatThing@p_chActionAdverbs, which);
  375.         adverb ~= ""
  376.         do
  377.         Print("  " + adverb + "\n");
  378.         which := which + 1;
  379.         od;
  380.         false
  381.     fi
  382.     else
  383.     if not CanSee(Here(), me) then
  384.         Print("It is dark - no-one could see you " + pose + "!\n");
  385.         false
  386.     elif me@p_pHidden then
  387.         Print("You are hidden - no-one could see you " + pose + "!\n");
  388.         false
  389.     else
  390.         Pose("", Pluralize(pose) + ".");
  391.         if me@p_pEchoPose then
  392.         Print("You " + pose + ".\n");
  393.         fi;
  394.         true
  395.     fi
  396.     fi
  397. corp;
  398.  
  399.  
  400. /* To add a soundless emote/pose to this scenario, you only have to add
  401.    a routine to this set, and a 'VerbTail' call to the set of calls
  402.    following. "soundless" emotes will not be sent to other players if
  403.    they are done somewhere that is dark. */
  404.  
  405. define tp_chat proc v_blink()bool:
  406.     makeAction("blink")
  407. corp;
  408.  
  409. define tp_chat proc v_blush()bool:
  410.     makeAction("blush")
  411. corp;
  412.  
  413. define tp_chat proc v_bow()bool:
  414.     makeAction("bow")
  415. corp;
  416.  
  417. define tp_chat proc v_cower()bool:
  418.     makeAction("cower")
  419. corp;
  420.  
  421. define tp_chat proc v_cringe()bool:
  422.     makeAction("cringe")
  423. corp;
  424.  
  425. define tp_chat proc v_curtsey()bool:
  426.     makeAction("curtsey")
  427. corp;
  428.  
  429. define tp_chat proc v_dance()bool:
  430.     makeAction("dance")
  431. corp;
  432.  
  433. define tp_chat proc v_drool()bool:
  434.     makeAction("drool")
  435. corp;
  436.  
  437. define tp_chat proc v_gesticulate()bool:
  438.     makeAction("gesticulate")
  439. corp;
  440.  
  441. define tp_chat proc v_glare()bool:
  442.     makeAction("glare")
  443. corp;
  444.  
  445. define tp_chat proc v_grovel()bool:
  446.     makeAction("grovel")
  447. corp;
  448.  
  449. define tp_chat proc v_grimace()bool:
  450.     makeAction("grimace")
  451. corp;
  452.  
  453. define tp_chat proc v_grin()bool:
  454.     makeAction("grin")
  455. corp;
  456.  
  457. define tp_chat proc v_frown()bool:
  458.     makeAction("frown")
  459. corp;
  460.  
  461. define tp_chat proc v_hop()bool:
  462.     makeAction("hop")
  463. corp;
  464.  
  465. define tp_chat proc v_nod()bool:
  466.     makeAction("nod")
  467. corp;
  468.  
  469. define tp_chat proc v_pout()bool:
  470.     makeAction("pout")
  471. corp;
  472.  
  473. define tp_chat proc v_shudder()bool:
  474.     makeAction("shudder")
  475. corp;
  476.  
  477. define tp_chat proc v_shiver()bool:
  478.     makeAction("shiver")
  479. corp;
  480.  
  481. define tp_chat proc v_shrug()bool:
  482.     makeAction("shrug")
  483. corp;
  484.  
  485. define tp_chat proc v_smile()bool:
  486.     makeAction("smile")
  487. corp;
  488.  
  489. define tp_chat proc v_smirk()bool:
  490.     makeAction("smirk")
  491. corp;
  492.  
  493. define tp_chat proc v_sneer()bool:
  494.     makeAction("sneer")
  495. corp;
  496.  
  497. define tp_chat proc v_spit()bool:
  498.     makeAction("spit")
  499. corp;
  500.  
  501. define tp_chat proc v_tremble()bool:
  502.     makeAction("tremble")
  503. corp;
  504.  
  505. define tp_chat proc v_twitch()bool:
  506.     makeAction("twitch")
  507. corp;
  508.  
  509. define tp_chat proc v_wave()bool:
  510.     makeAction("wave")
  511. corp;
  512.  
  513. define tp_chat proc v_wince()bool:
  514.     makeAction("wince")
  515. corp;
  516.  
  517. define tp_chat proc v_wink()bool:
  518.     makeAction("wink")
  519. corp;
  520.  
  521. define tp_chat proc v_yawn()bool:
  522.     makeAction("yawn")
  523. corp;
  524.  
  525. VerbTail(G, "blink", v_blink)$
  526. VerbTail(G, "blush", v_blush)$
  527. VerbTail(G, "bow", v_bow)$
  528. VerbTail(G, "cower", v_cower)$
  529. VerbTail(G, "cringe", v_cringe)$
  530. VerbTail(G, "curtsey", v_curtsey)$
  531. VerbTail(G, "dance", v_dance)$
  532. VerbTail(G, "drool", v_drool)$
  533. VerbTail(G, "gesticulate", v_gesticulate)$
  534. Synonym(G, "gesticulate", "gest")$
  535. VerbTail(G, "glare", v_glare)$
  536. VerbTail(G, "grovel", v_grovel)$
  537. VerbTail(G, "grimace", v_grimace)$
  538. VerbTail(G, "grin", v_grin)$
  539. VerbTail(G, "frown", v_frown)$
  540. VerbTail(G, "hop", v_hop)$
  541. VerbTail(G, "nod", v_nod)$
  542. VerbTail(G, "pout", v_pout)$
  543. VerbTail(G, "shudder", v_shudder)$
  544. VerbTail(G, "shiver", v_shiver)$
  545. VerbTail(G, "shrug", v_shrug)$
  546. VerbTail(G, "smile", v_smile)$
  547. VerbTail(G, "smirk", v_smirk)$
  548. VerbTail(G, "sneer", v_sneer)$
  549. VerbTail(G, "spit", v_spit)$
  550. VerbTail(G, "tremble", v_tremble)$
  551. VerbTail(G, "twitch", v_twitch)$
  552. VerbTail(G, "wave", v_wave)$
  553. VerbTail(G, "wince", v_wince)$
  554. VerbTail(G, "wink", v_wink)$
  555. VerbTail(G, "yawn", v_yawn)$
  556.  
  557.  
  558. define tp_chat proc noiseAdverb(string s)void:
  559.     ChatThing@p_chNoiseAdverbs := ChatThing@p_chNoiseAdverbs + s;
  560. corp;
  561.  
  562. noiseAdverb("deeply,deep,dee,d.")$
  563. noiseAdverb("embarrassedly,embarrassed,embar,emb.")$
  564. noiseAdverb("excitedly,excited,exc,x.")$
  565. noiseAdverb("evilly,evil,evi,e.")$
  566. noiseAdverb("fitfully,fitfull,fit.")$
  567. noiseAdverb("gayly,gay.")$
  568. noiseAdverb("happily,happy,hap,h.")$
  569. noiseAdverb("hesitantly,hesitant,hes.")$
  570. noiseAdverb("hollowly,hollow,hol.")$
  571. noiseAdverb("loudly,loud,lou,l.")$
  572. noiseAdverb("merrily,merry,mer,m.")$
  573. noiseAdverb("nastily,nasty,nas.")$
  574. noiseAdverb("nervously,nervous,ner.")$
  575. noiseAdverb("politely,polite,pol.")$
  576. noiseAdverb("quietly,quiet,qui,q.")$
  577. noiseAdverb("sadly,sad,s.")$
  578. noiseAdverb("sharply,sharp,sha.")$
  579. noiseAdverb("sickly,sick,sic.")$
  580. noiseAdverb("suddenly,sudden,sud.")$
  581. noiseAdverb("tiredly,tired,tir.")$
  582. noiseAdverb("vigorously,vigorous,vig.")$
  583.  
  584. define tp_chat proc makeNoise(string noise)bool:
  585.     thing me;
  586.     string adverb;
  587.     int which;
  588.  
  589.     me := Me();
  590.     adverb := GetWord();
  591.     if adverb ~= "" then
  592.     which := MatchName(ChatThing@p_chNoiseAdverbs, adverb);
  593.     if which ~= -1 then
  594.         adverb := SelectName(ChatThing@p_chNoiseAdverbs, which);
  595.         if me@p_pHidden or not CanSee(Here(), me) then
  596.         OPrint("You hear a " + SelectWord(adverb, 1) +
  597.             " " + noise + ".\n");
  598.         else
  599.         Pose("", Pluralize(noise) + " " + SelectWord(adverb, 0) + ".");
  600.         fi;
  601.         if me@p_pEchoPose then
  602.         Print("You " + noise + " " + SelectWord(adverb, 0) + ".\n");
  603.         fi;
  604.         true
  605.     else
  606.         Print("Unknown noise adverb '" + adverb + "'. Known ones:\n");
  607.         which := 0;
  608.         while
  609.         adverb := SelectName(ChatThing@p_chNoiseAdverbs, which);
  610.         adverb ~= ""
  611.         do
  612.         Print("  " + adverb + "\n");
  613.         which := which + 1;
  614.         od;
  615.         false
  616.     fi
  617.     else
  618.     if me@p_pHidden or not CanSee(Here(), me) then
  619.         OPrint("You hear a " + noise + ".\n");
  620.     else
  621.         Pose("", Pluralize(noise) + ".");
  622.     fi;
  623.     if me@p_pEchoPose then
  624.         Print("You " + noise + ".\n");
  625.     fi;
  626.     true
  627.     fi
  628. corp;
  629.  
  630.  
  631. /* To add a noisy pose/emote to this scenario, you only need to add a
  632.    little routine to the following set, and add a 'VerbTail' call to
  633.    the group following. "noisy" emotes show up in dark places, except
  634.    that the emoter is not identified. */
  635.  
  636. define tp_chat proc v_applaud()bool:
  637.     makeNoise("applaud")
  638. corp;
  639.  
  640. define tp_chat proc v_burp()bool:
  641.     makeNoise("burp")
  642. corp;
  643.  
  644. define tp_chat proc v_cackle()bool:
  645.     makeNoise("cackle")
  646. corp;
  647.  
  648. define tp_chat proc v_cheer()bool:
  649.     makeNoise("cheer")
  650. corp;
  651.  
  652. define tp_chat proc v_chuckle()bool:
  653.     makeNoise("chuckle")
  654. corp;
  655.  
  656. define tp_chat proc v_clap()bool:
  657.     makeNoise("clap")
  658. corp;
  659.  
  660. define tp_chat proc v_cough()bool:
  661.     makeNoise("cough")
  662. corp;
  663.  
  664. define tp_chat proc v_croak()bool:
  665.     makeNoise("croak")
  666. corp;
  667.  
  668. define tp_chat proc v_cry()bool:
  669.     makeNoise("cry")
  670. corp;
  671.  
  672. define tp_chat proc v_fart()bool:
  673.     makeNoise("fart")
  674. corp;
  675.  
  676. define tp_chat proc v_gasp()bool:
  677.     makeNoise("gasp")
  678. corp;
  679.  
  680. define tp_chat proc v_giggle()bool:
  681.     makeNoise("giggle")
  682. corp;
  683.  
  684. define tp_chat proc v_groan()bool:
  685.     makeNoise("groan")
  686. corp;
  687.  
  688. define tp_chat proc v_growl()bool:
  689.     makeNoise("growl")
  690. corp;
  691.  
  692. define tp_chat proc v_grumble()bool:
  693.     makeNoise("grumble")
  694. corp;
  695.  
  696. define tp_chat proc v_grunt()bool:
  697.     makeNoise("grunt")
  698. corp;
  699.  
  700. define tp_chat proc v_hiccup()bool:
  701.     makeNoise("hiccup")
  702. corp;
  703.  
  704. define tp_chat proc v_hiccough()bool:
  705.     makeNoise("hiccough")
  706. corp;
  707.  
  708. define tp_chat proc v_hum()bool:
  709.     makeNoise("hum")
  710. corp;
  711.  
  712. define tp_chat proc v_laugh()bool:
  713.     makeNoise("laugh")
  714. corp;
  715.  
  716. define tp_chat proc v_moan()bool:
  717.     makeNoise("moan")
  718. corp;
  719.  
  720. define tp_chat proc v_mutter()bool:
  721.     makeNoise("mutter")
  722. corp;
  723.  
  724. define tp_chat proc v_purr()bool:
  725.     makeNoise("purr")
  726. corp;
  727.  
  728. define tp_chat proc v_scream()bool:
  729.     makeNoise("scream")
  730. corp;
  731.  
  732. define tp_chat proc v_sigh()bool:
  733.     makeNoise("sigh")
  734. corp;
  735.  
  736. define tp_chat proc v_snarl()bool:
  737.     makeNoise("snarl")
  738. corp;
  739.  
  740. define tp_chat proc v_sneeze()bool:
  741.     makeNoise("sneeze")
  742. corp;
  743.  
  744. define tp_chat proc v_snicker()bool:
  745.     makeNoise("snicker")
  746. corp;
  747.  
  748. define tp_chat proc v_snore()bool:
  749.     makeNoise("snore")
  750. corp;
  751.  
  752. define tp_chat proc v_sob()bool:
  753.     makeNoise("sob")
  754. corp;
  755.  
  756. define tp_chat proc v_whine()bool:
  757.     makeNoise("whine")
  758. corp;
  759.  
  760. define tp_chat proc v_whistle()bool:
  761.     makeNoise("whistle")
  762. corp;
  763.  
  764. VerbTail(G, "applaud", v_applaud)$
  765. VerbTail(G, "burp", v_burp)$
  766. VerbTail(G, "cackle", v_cackle)$
  767. VerbTail(G, "cheer", v_cheer)$
  768. VerbTail(G, "chuckle", v_chuckle)$
  769. VerbTail(G, "clap", v_clap)$
  770. VerbTail(G, "cough", v_cough)$
  771. VerbTail(G, "croak", v_croak)$
  772. VerbTail(G, "cry", v_cry)$
  773. VerbTail(G, "fart", v_fart)$
  774. VerbTail(G, "gasp", v_gasp)$
  775. VerbTail(G, "giggle", v_giggle)$
  776. VerbTail(G, "groan", v_groan)$
  777. VerbTail(G, "growl", v_growl)$
  778. VerbTail(G, "grumble", v_grumble)$
  779. VerbTail(G, "grunt", v_grunt)$
  780. VerbTail(G, "hiccup", v_hiccup)$
  781. VerbTail(G, "hiccough", v_hiccough)$
  782. VerbTail(G, "hum", v_hum)$
  783. VerbTail(G, "laugh", v_laugh)$
  784. VerbTail(G, "moan", v_moan)$
  785. VerbTail(G, "mutter", v_mutter)$
  786. VerbTail(G, "purr", v_purr)$
  787. VerbTail(G, "scream", v_scream)$
  788. VerbTail(G, "sigh", v_sigh)$
  789. VerbTail(G, "snarl", v_snarl)$
  790. VerbTail(G, "sneeze", v_sneeze)$
  791. VerbTail(G, "snicker", v_snicker)$
  792. VerbTail(G, "snore", v_snore)$
  793. VerbTail(G, "sob", v_sob)$
  794. VerbTail(G, "whine", v_whine)$
  795. VerbTail(G, "whistle", v_whistle)$
  796.  
  797. define tp_chat proc v_speak()bool:
  798.     string what, agentName, ch;
  799.     bool hadError;
  800.     character who;
  801.     thing agent;
  802.  
  803.     hadError := true;
  804.     what := GetWord();
  805.     if what == "to" then
  806.     what := GetWord();
  807.     fi;
  808.     if what ~= "" then
  809.     ch := SubString(what, Length(what) - 1, 1);
  810.     if ch = "," or ch = ":" then
  811.         what := SubString(what, 0, Length(what) - 1);
  812.     fi;
  813.     who := Character(what);
  814.     if who = nil then
  815.         who := Character(Capitalize(what));
  816.     fi;
  817.     if who = nil then
  818.         agent := FindAgent(what);
  819.     else
  820.         agent := CharacterThing(who);
  821.     fi;
  822.     if agent = nil then
  823.         Print("You can't speak to " + what + ".\n");
  824.     elif agent = Me() then
  825.         Print("You can't speak to yourself!\n");
  826.     else
  827.         what := GetTail();
  828.         agentName := CharacterNameS(agent);
  829.         if what = "" then
  830.         Print("Specify what you want to speak to " +
  831.             agentName + ".\n");
  832.         elif who = nil then
  833.         Print("You can only speak to other players.\n");
  834.         elif AgentLocation(agent) ~= Here() and IsNormal() then
  835.         Print(agentName + " is not here to hear you.\n");
  836.         elif AgentLocation(agent) = nil then
  837.         Print(agentName + " is not currently connected.\n");
  838.         elif not VOn(agent) then
  839.         Print(agentName + " does not have voice output enabled.\n");
  840.         else
  841.         VSpeak(agent, what, 0);
  842.         hadError := false;
  843.         fi;
  844.     fi;
  845.     fi;
  846.     if hadError then
  847.     Print("Use is: speak [to] <who> <words>\n");
  848.     false
  849.     else
  850.     true
  851.     fi
  852. corp;
  853.  
  854. VerbTail(G, "sp", v_speak)$
  855. Synonym(G, "sp", "speak")$
  856.  
  857. define tp_chat proc v_page()bool:
  858.     string what, whoName, ch;
  859.     character who;
  860.     bool hadError;
  861.  
  862.     hadError := true;
  863.     whoName := GetWord();
  864.     if whoName == "to" then
  865.     whoName := GetWord();
  866.     fi;
  867.     if IsNormal() then
  868.     Print("Only apprentices and wizards can use 'page'.\n");
  869.     elif whoName ~= "" then
  870.     ch := SubString(whoName, Length(whoName) - 1, 1);
  871.     if ch = "," or ch = ":" then
  872.         whoName := SubString(whoName, 0, Length(whoName) - 1);
  873.     fi;
  874.     who := Character(whoName);
  875.     if who = nil then
  876.         who := Character(Capitalize(whoName));
  877.     fi;
  878.     if who = nil then
  879.         Print("'" + whoName + "' is not a player in the game.\n");
  880.     elif who = MeCharacter() then
  881.         Print("There is no point in paging yourself!\n");
  882.     elif AgentLocation(CharacterThing(who)) = nil then
  883.         Print(whoName + " is not currently connected.\n");
  884.     else
  885.         what := GetTail();
  886.         if what = "" then
  887.         Print("Specify what you want to page to " + whoName + ".\n");
  888.         else
  889.         SPrint(CharacterThing(who), Me()@p_pName + " pages: " +
  890.             what + "\n");
  891.         hadError := false;
  892.         fi;
  893.     fi;
  894.     fi;
  895.     if hadError then
  896.     Print("Use is: page [to] <who> <words>\n");
  897.     false
  898.     else
  899.     true
  900.     fi
  901. corp;
  902.  
  903. VerbTail(G, "pa", v_page)$
  904. Synonym(G, "pa", "page")$
  905.  
  906.  
  907. unuse tp_chat
  908.