ds2.9a12/bin/
ds2.9a12/extra/
ds2.9a12/extra/crat/
ds2.9a12/extra/creremote/
ds2.9a12/extra/mingw/
ds2.9a12/extra/wolfpaw/
ds2.9a12/fluffos-2.14-ds13/
ds2.9a12/fluffos-2.14-ds13/Win32/
ds2.9a12/fluffos-2.14-ds13/compat/
ds2.9a12/fluffos-2.14-ds13/compat/simuls/
ds2.9a12/fluffos-2.14-ds13/include/
ds2.9a12/fluffos-2.14-ds13/testsuite/
ds2.9a12/fluffos-2.14-ds13/testsuite/clone/
ds2.9a12/fluffos-2.14-ds13/testsuite/command/
ds2.9a12/fluffos-2.14-ds13/testsuite/data/
ds2.9a12/fluffos-2.14-ds13/testsuite/etc/
ds2.9a12/fluffos-2.14-ds13/testsuite/include/
ds2.9a12/fluffos-2.14-ds13/testsuite/inherit/
ds2.9a12/fluffos-2.14-ds13/testsuite/inherit/master/
ds2.9a12/fluffos-2.14-ds13/testsuite/log/
ds2.9a12/fluffos-2.14-ds13/testsuite/single/
ds2.9a12/fluffos-2.14-ds13/testsuite/single/tests/compiler/
ds2.9a12/fluffos-2.14-ds13/testsuite/single/tests/efuns/
ds2.9a12/fluffos-2.14-ds13/testsuite/single/tests/operators/
ds2.9a12/fluffos-2.14-ds13/testsuite/u/
ds2.9a12/lib/cmds/admins/
ds2.9a12/lib/cmds/common/
ds2.9a12/lib/cmds/creators/include/
ds2.9a12/lib/daemon/services/
ds2.9a12/lib/daemon/tmp/
ds2.9a12/lib/doc/
ds2.9a12/lib/doc/bguide/
ds2.9a12/lib/doc/efun/all/
ds2.9a12/lib/doc/efun/arrays/
ds2.9a12/lib/doc/efun/buffers/
ds2.9a12/lib/doc/efun/compile/
ds2.9a12/lib/doc/efun/floats/
ds2.9a12/lib/doc/efun/functions/
ds2.9a12/lib/doc/efun/general/
ds2.9a12/lib/doc/efun/mixed/
ds2.9a12/lib/doc/efun/numbers/
ds2.9a12/lib/doc/efun/parsing/
ds2.9a12/lib/doc/hbook/
ds2.9a12/lib/doc/help/classes/
ds2.9a12/lib/doc/help/races/
ds2.9a12/lib/doc/lfun/
ds2.9a12/lib/doc/lfun/all/
ds2.9a12/lib/doc/lfun/lib/abilities/
ds2.9a12/lib/doc/lfun/lib/armor/
ds2.9a12/lib/doc/lfun/lib/bank/
ds2.9a12/lib/doc/lfun/lib/bot/
ds2.9a12/lib/doc/lfun/lib/clay/
ds2.9a12/lib/doc/lfun/lib/clean/
ds2.9a12/lib/doc/lfun/lib/clerk/
ds2.9a12/lib/doc/lfun/lib/client/
ds2.9a12/lib/doc/lfun/lib/combat/
ds2.9a12/lib/doc/lfun/lib/connect/
ds2.9a12/lib/doc/lfun/lib/container/
ds2.9a12/lib/doc/lfun/lib/corpse/
ds2.9a12/lib/doc/lfun/lib/creator/
ds2.9a12/lib/doc/lfun/lib/daemon/
ds2.9a12/lib/doc/lfun/lib/damage/
ds2.9a12/lib/doc/lfun/lib/deterioration/
ds2.9a12/lib/doc/lfun/lib/donate/
ds2.9a12/lib/doc/lfun/lib/door/
ds2.9a12/lib/doc/lfun/lib/equip/
ds2.9a12/lib/doc/lfun/lib/file/
ds2.9a12/lib/doc/lfun/lib/fish/
ds2.9a12/lib/doc/lfun/lib/fishing/
ds2.9a12/lib/doc/lfun/lib/flashlight/
ds2.9a12/lib/doc/lfun/lib/follow/
ds2.9a12/lib/doc/lfun/lib/ftp_client/
ds2.9a12/lib/doc/lfun/lib/ftp_data_connection/
ds2.9a12/lib/doc/lfun/lib/fuel/
ds2.9a12/lib/doc/lfun/lib/furnace/
ds2.9a12/lib/doc/lfun/lib/genetics/
ds2.9a12/lib/doc/lfun/lib/holder/
ds2.9a12/lib/doc/lfun/lib/id/
ds2.9a12/lib/doc/lfun/lib/interactive/
ds2.9a12/lib/doc/lfun/lib/lamp/
ds2.9a12/lib/doc/lfun/lib/leader/
ds2.9a12/lib/doc/lfun/lib/light/
ds2.9a12/lib/doc/lfun/lib/limb/
ds2.9a12/lib/doc/lfun/lib/living/
ds2.9a12/lib/doc/lfun/lib/load/
ds2.9a12/lib/doc/lfun/lib/look/
ds2.9a12/lib/doc/lfun/lib/manipulate/
ds2.9a12/lib/doc/lfun/lib/meal/
ds2.9a12/lib/doc/lfun/lib/messages/
ds2.9a12/lib/doc/lfun/lib/player/
ds2.9a12/lib/doc/lfun/lib/poison/
ds2.9a12/lib/doc/lfun/lib/position/
ds2.9a12/lib/doc/lfun/lib/post_office/
ds2.9a12/lib/doc/lfun/lib/potion/
ds2.9a12/lib/doc/lfun/lib/room/
ds2.9a12/lib/doc/lfun/lib/server/
ds2.9a12/lib/doc/lfun/lib/spell/
ds2.9a12/lib/doc/lfun/lib/torch/
ds2.9a12/lib/doc/lfun/lib/vendor/
ds2.9a12/lib/doc/lfun/lib/virt_sky/
ds2.9a12/lib/doc/lfun/lib/weapon/
ds2.9a12/lib/doc/lfun/lib/worn_storage/
ds2.9a12/lib/doc/lpc/basic/
ds2.9a12/lib/doc/lpc/concepts/
ds2.9a12/lib/doc/lpc/constructs/
ds2.9a12/lib/doc/lpc/etc/
ds2.9a12/lib/doc/lpc/intermediate/
ds2.9a12/lib/doc/lpc/types/
ds2.9a12/lib/doc/misc/
ds2.9a12/lib/doc/old/
ds2.9a12/lib/domains/
ds2.9a12/lib/domains/Praxis/adm/
ds2.9a12/lib/domains/Praxis/attic/
ds2.9a12/lib/domains/Praxis/cemetery/mon/
ds2.9a12/lib/domains/Praxis/data/
ds2.9a12/lib/domains/Praxis/death/
ds2.9a12/lib/domains/Praxis/mountains/
ds2.9a12/lib/domains/Praxis/obj/armour/
ds2.9a12/lib/domains/Praxis/obj/magic/
ds2.9a12/lib/domains/Praxis/obj/weapon/
ds2.9a12/lib/domains/Praxis/orc_valley/
ds2.9a12/lib/domains/Ylsrim/
ds2.9a12/lib/domains/Ylsrim/adm/
ds2.9a12/lib/domains/Ylsrim/armor/
ds2.9a12/lib/domains/Ylsrim/broken/
ds2.9a12/lib/domains/Ylsrim/fish/
ds2.9a12/lib/domains/Ylsrim/meal/
ds2.9a12/lib/domains/Ylsrim/npc/
ds2.9a12/lib/domains/Ylsrim/obj/
ds2.9a12/lib/domains/Ylsrim/virtual/
ds2.9a12/lib/domains/Ylsrim/weapon/
ds2.9a12/lib/domains/campus/adm/
ds2.9a12/lib/domains/campus/etc/
ds2.9a12/lib/domains/campus/meals/
ds2.9a12/lib/domains/campus/save/
ds2.9a12/lib/domains/campus/txt/ai/charles/
ds2.9a12/lib/domains/campus/txt/ai/charles/bak2/
ds2.9a12/lib/domains/campus/txt/ai/charles/bak2/bak1/
ds2.9a12/lib/domains/campus/txt/ai/charly/
ds2.9a12/lib/domains/campus/txt/ai/charly/bak/
ds2.9a12/lib/domains/campus/txt/jenny/
ds2.9a12/lib/domains/cave/doors/
ds2.9a12/lib/domains/cave/etc/
ds2.9a12/lib/domains/cave/meals/
ds2.9a12/lib/domains/cave/weap/
ds2.9a12/lib/domains/default/creator/
ds2.9a12/lib/domains/default/doors/
ds2.9a12/lib/domains/default/etc/
ds2.9a12/lib/domains/default/vehicles/
ds2.9a12/lib/domains/default/virtual/
ds2.9a12/lib/domains/default/weap/
ds2.9a12/lib/domains/town/txt/shame/
ds2.9a12/lib/domains/town/virtual/
ds2.9a12/lib/domains/town/virtual/bottom/
ds2.9a12/lib/domains/town/virtual/space/
ds2.9a12/lib/estates/
ds2.9a12/lib/ftp/
ds2.9a12/lib/lib/comp/
ds2.9a12/lib/lib/daemons/
ds2.9a12/lib/lib/daemons/include/
ds2.9a12/lib/lib/lvs/
ds2.9a12/lib/lib/user/
ds2.9a12/lib/lib/virtual/
ds2.9a12/lib/log/
ds2.9a12/lib/log/adm/
ds2.9a12/lib/log/archive/
ds2.9a12/lib/log/chan/
ds2.9a12/lib/log/errors/
ds2.9a12/lib/log/law/adm/
ds2.9a12/lib/log/law/email/
ds2.9a12/lib/log/law/names/
ds2.9a12/lib/log/law/sites-misc/
ds2.9a12/lib/log/law/sites-register/
ds2.9a12/lib/log/law/sites-tempban/
ds2.9a12/lib/log/law/sites-watch/
ds2.9a12/lib/log/open/
ds2.9a12/lib/log/reports/
ds2.9a12/lib/log/router/
ds2.9a12/lib/log/secure/
ds2.9a12/lib/log/watch/
ds2.9a12/lib/obj/book_source/
ds2.9a12/lib/obj/include/
ds2.9a12/lib/powers/prayers/
ds2.9a12/lib/powers/spells/
ds2.9a12/lib/realms/template/adm/
ds2.9a12/lib/realms/template/area/armor/
ds2.9a12/lib/realms/template/area/npc/
ds2.9a12/lib/realms/template/area/obj/
ds2.9a12/lib/realms/template/area/room/
ds2.9a12/lib/realms/template/area/weap/
ds2.9a12/lib/realms/template/bak/
ds2.9a12/lib/realms/template/cmds/
ds2.9a12/lib/save/kills/o/
ds2.9a12/lib/secure/cfg/classes/
ds2.9a12/lib/secure/cmds/builders/
ds2.9a12/lib/secure/cmds/creators/include/
ds2.9a12/lib/secure/cmds/players/
ds2.9a12/lib/secure/cmds/players/include/
ds2.9a12/lib/secure/daemon/imc2server/
ds2.9a12/lib/secure/daemon/include/
ds2.9a12/lib/secure/lib/
ds2.9a12/lib/secure/lib/include/
ds2.9a12/lib/secure/lib/net/include/
ds2.9a12/lib/secure/lib/std/
ds2.9a12/lib/secure/log/adm/
ds2.9a12/lib/secure/log/bak/
ds2.9a12/lib/secure/log/intermud/
ds2.9a12/lib/secure/log/network/
ds2.9a12/lib/secure/modules/
ds2.9a12/lib/secure/npc/
ds2.9a12/lib/secure/obj/include/
ds2.9a12/lib/secure/room/
ds2.9a12/lib/secure/save/
ds2.9a12/lib/secure/save/backup/
ds2.9a12/lib/secure/save/boards/
ds2.9a12/lib/secure/tmp/
ds2.9a12/lib/secure/upgrades/files/
ds2.9a12/lib/secure/verbs/creators/
ds2.9a12/lib/std/board/
ds2.9a12/lib/std/lib/
ds2.9a12/lib/tmp/
ds2.9a12/lib/verbs/admins/include/
ds2.9a12/lib/verbs/builders/
ds2.9a12/lib/verbs/common/
ds2.9a12/lib/verbs/common/include/
ds2.9a12/lib/verbs/creators/
ds2.9a12/lib/verbs/creators/include/
ds2.9a12/lib/verbs/rooms/
ds2.9a12/lib/verbs/rooms/include/
ds2.9a12/lib/www/client/
ds2.9a12/lib/www/errors/
ds2.9a12/lib/www/images/
ds2.9a12/lib/www/lpmuds/downloads_files/
ds2.9a12/lib/www/lpmuds/intermud_files/
ds2.9a12/lib/www/lpmuds/links_files/
ds2.9a12/win32/
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="content-type">
  <title>Mud Editor Tutorial</title>
  <link rel="icon" href="./favicon.ico" type="image/x-icon">
  <link rel="shortcut icon" href="./favicon.ico" type="image/x-icon">
</head>
<body>
<pre><big><big style="font-weight: bold;"><big>The ed Editor</big></big><br
 style="font-weight: bold;"><br><br>	This has always been the aspect of coding that new<br>creators have most trouble with. It's what discourages most<br>people from creating lots of stuff, in fact.<br><br>	With Dead Souls, you can get away with avoiding <big><span
 style="font-weight: bold;">ed</span></big><br>most of the time, by using the <a
 href="http://dead-souls.net/example.html">QCS</a>.<br><br>	But to add special functions to your code, like <br>magic items, smart NPC's (aka mobs), traps, hidden objects, <br>etc, you need to edit LPC code.<br><br></big><big>	There is a web-based editing system called<br>"<a
 href="http://lpmuds.net/forum/index.php?topic=614.msg2962#msg2962">creweb</a>" that lets you edit mud files from the internet<br>on your browser. For more info on it: <span
 style="font-weight: bold;">help creweb</span><br><br>	But if you can't use creweb, then ed is<br>the default method for editing files inside the mud.<br></big><big><br>	<big
 style="font-weight: bold;">ed</big> is a simple editing program. It is designed to<br>work on a line-by-line basis, so it is called a "line editor".<br>	<br>	Let's start by looking at, and editing, a small file.<br>We've coded a sword, and we want to change its description<br>from "short sword" to "plain sword":<br><br><br></big></pre>
<hr style="width: 100%; height: 2px;">
<pre><big><br>&gt; <big><span style="font-weight: bold;">cd /realms/cratylus/area/weap</span></big></big><big>1) <span
 style="color: rgb(255, 0, 0);">I changed my working directory to my area weapons dir</span></big><big
 style="color: rgb(255, 0, 0);"><big><span style="font-weight: bold;"></span></big></big><big><big><span
 style="font-weight: bold;"></span></big><br>/realms/cratylus/area/weap:<br>&gt; <big><span
 style="font-weight: bold;">ls </span></big></big><big
 style="color: rgb(255, 0, 0);">I listed the contents of that dir: </big><big
 style="color: rgb(255, 0, 0);"><big><span style="font-weight: bold;"> </span></big></big><big><big><span
 style="font-weight: bold;"></span></big><br>/realms/cratylus/area/weap/:<br> 1   dagger.c        1   nco_sword.c~    1   std_sword.c~   <br> 1   gsword.c        1   sharpsword.c    1   sword.c        <br> 001 gsword.c~       1   staff.c                            <br> 1   nco_sword.c     1   std_sword.c                        <br><br><br>&gt; <big><span
 style="font-weight: bold;">ed sword.c</span></big></big><big> <span
 style="color: rgb(255, 0, 0);">I ran the ed command on the file sword.c.</span></big><big><big><span
 style="font-weight: bold;"></span></big></big><big><big><span
 style="font-weight: bold;"></span></big><br>/realms/cratylus/area/weap/sword.c, 641 bytes<br>:<big><span
 style="font-weight: bold;">n </span></big></big><big
 style="color: rgb(255, 0, 0);">This makes the editor display line numbers next to the lines.</big><big><big><span
 style="font-weight: bold;"></span></big><br>number on, list off<br>:<big><span
 style="font-weight: bold;">1z </span><small
 style="color: rgb(255, 0, 0);">This lists about 20 lines of text</small></big><br>  1  /*    /domains/Examples/weapon/sword.c<br>  2   *    from the Nightmare IV LPC Library<br>  3   *    a simple sword example, nothing fancy<br>  4   *    created by Descartes of Borg 950402<br>  5   */<br>  6  <br>  7  #include &lt;lib.h&gt;<br>  8  #include &lt;damage_types.h&gt;<br>  9  #include &lt;vendor_types.h&gt;<br> 10  <br> 11  inherit LIB_ITEM;<br> 12  <br> 13  static void create() {<br> 14      item::create();<br> 15      SetKeyName("short sword");<br> 16      SetId( ({ "sword", "short sword" }) );<br> 17      SetAdjectives( ({ "short" }) );<br> 18      SetShort("a short sword");<br> 19      SetLong("A cheap and rather dull short sword.");<br> 20      SetMass(150);<br> 21      SetDollarCost(50);<br> 22      SetVendorType(VT_WEAPON);<br>:z<br> 22      SetVendorType(VT_WEAPON);<br> 23      SetClass(20);<br> 24      SetDamageType(BLADE);<br> 25      SetWeaponType("blade");<br> 26  }<br>:<big><span
 style="font-weight: bold;">15 </span><small
 style="color: rgb(255, 0, 0);">I displayed line 15</small></big><br> 15      SetKeyName("short sword");<br>:<big><span
 style="font-weight: bold;">15c </span><small
 style="color: rgb(255, 0, 0);">I used 'c' to replace line 15</small></big><br>    15. * <big
 style="font-weight: bold;">SetKeyName("plain sword"); </big><big
 style="color: rgb(255, 0, 0);"><small>I entered my replacement text</small></big><br>    16. * <big><span
 style="font-weight: bold;">. </span><small
 style="color: rgb(255, 0, 0);">I entered a single dot on a blank line </small></big><br>:<br> 16      SetId( ({ "sword", "short sword" }) );<br>:<big><span
 style="font-weight: bold;">1z </span><small
 style="color: rgb(255, 0, 0);">I listed about 20 lines, starting from line 1</small></big><br>  1  /*    /domains/Examples/weapon/sword.c<br>  2   *    from the Nightmare IV LPC Library<br>  3   *    a simple sword example, nothing fancy<br>  4   *    created by Descartes of Borg 950402<br>  5   */<br>  6  <br>  7  #include &lt;lib.h&gt;<br>  8  #include &lt;damage_types.h&gt;<br>  9  #include &lt;vendor_types.h&gt;<br> 10  <br> 11  inherit LIB_ITEM;<br> 12  <br> 13  static void create() {<br> 14      item::create();<br> 15  SetKeyName("plain sword");<br> 16      SetId( ({ "sword", "short sword" }) );<br> 17      SetAdjectives( ({ "short" }) );<br> 18      SetShort("a short sword");<br> 19      SetLong("A cheap and rather dull short sword.");<br> 20      SetMass(150);<br> 21      SetDollarCost(50);<br> 22      SetVendorType(VT_WEAPON);<br>:<big><span
 style="font-weight: bold;">18 </span><small
 style="color: rgb(255, 0, 0);">I displayed line 18</small></big><br> 18      SetShort("a short sword");<br>:<big><span
 style="font-weight: bold;">18c </span><small
 style="color: rgb(255, 0, 0);">I started the replacement of line 18</small></big><br>    18. * <big
 style="font-weight: bold;">SetShort("a plain sword"); </big><big
 style="color: rgb(255, 0, 0);"><small>I entered my replacement text</small></big><br>    19. *<big> <span
 style="font-weight: bold;">. </span><small
 style="color: rgb(255, 0, 0);">I entered a single dot on a blank line</small></big><br>:<big><span
 style="font-weight: bold;">1z </span><small
 style="color: rgb(255, 0, 0);">I displayed about 20 lines starting from line 1</small></big><br>  1  /*    /domains/Examples/weapon/sword.c<br>  2   *    from the Nightmare IV LPC Library<br>  3   *    a simple sword example, nothing fancy<br>  4   *    created by Descartes of Borg 950402<br>  5   */<br>  6  <br>  7  #include &lt;lib.h&gt;<br>  8  #include &lt;damage_types.h&gt;<br>  9  #include &lt;vendor_types.h&gt;<br> 10  <br> 11  inherit LIB_ITEM;<br> 12  <br> 13  static void create() {<br> 14      item::create();<br> 15  SetKeyName("plain sword");<br> 16      SetId( ({ "sword", "short sword" }) );<br> 17      SetAdjectives( ({ "short" }) );<br> 18  SetShort("a plain sword");<br> 19      SetLong("A cheap and rather dull short sword.");<br> 20      SetMass(150);<br> 21      SetDollarCost(50);<br> 22      SetVendorType(VT_WEAPON);<br>:<big><span
 style="font-weight: bold;">x </span><span
 style="color: rgb(255, 0, 0);">I saved and exited</span></big><br>"/realms/cratylus/area/weap/sword.c" 26 lines 633 bytes<br>Exit from ed.<br>&gt; <big><span
 style="font-weight: bold;">update sword </span><small
 style="color: rgb(255, 0, 0);">I loaded the file into memory</small></big><br>/realms/cratylus/area/weap/sword: Ok<br></big></pre>
<hr style="width: 100%; height: 2px;">
<pre><big><br><br>Let's take this step by step:<br><br>1) I changed my working directory to my area weapons dir: </big><big><big><span
 style="font-weight: bold;">cd /realms/cratylus/area/weap<br><br></span></big></big><big>2) I listed the contents of that dir: </big><big><big><span
 style="font-weight: bold;"> ls<br><br></span></big></big><big>3) I ran the ed command on the file sword.c: </big><big><big><span
 style="font-weight: bold;">ed sword.c</span></big><br><big><span
 style="font-weight: bold;"></span></big></big><big><br>4) Within the editor, I issued the '<big><span
 style="font-weight: bold;">n</span></big>' command. This makes the editor<br>   display line numbers next to the lines.<br><br>5) Within the editor, I issued the '<big><span
 style="font-weight: bold;">1z</span></big>' command. What '<big
 style="font-weight: bold;">z</big>' does is display<br>   about 20 lines of the file (the exact number depends on your screen<br>   settings. In my case it's 22). If you happen to be looking at line 1, it<br>   will display lines 1 through to about 20. If you happen to be looking <br>   at line 40, it will display from line 40 to about 60. <br>   	If you want to start looking at lines starting at line 15, you<br>   can issue the '<big
 style="font-weight: bold;">15z</big>' command, which basically means "display about 20<br>   lines starting at line 15".<br>   	In this case, I wanted to start from the beginning of the file, <br>   so I issued '<big
 style="font-weight: bold;">1z</big>'.<br><br>6) '<big
 style="font-weight: bold;">1z</big>' stopped listing the file at line 22, so I entered '<big><span
 style="font-weight: bold;">z</span></big>' again to<br>    list the rest.<br><br>7) Since I want to change "short sword" to "plain sword", I examined each<br>   line to find the word "short". I noticed that line 15 has "short" in it,<br>   so to get a look at that line alone, I entered '<span
 style="font-weight: bold;">15</span>'.<br><br>8) Now that I'm sure line 15 needs to change, I issue the '<big><span
 style="font-weight: bold;">15c</span></big>' command.<br>   '<big
 style="font-weight: bold;">c</big>' indicates that I want to change a line. '<big
 style="font-weight: bold;">15c</big>' means "delete whatever<br>   was in line 15, and replace it with what I am about to type".<br><br>9) You can see that my editor prompt changed from ":" to "*". What this<br>   means is that I am now in "input mode". Whatever I type now will be<br>   added to the file. Since my last command in "command mode" was '<big
 style="font-weight: bold;">15c</big>',<br>   I am now replacing that line with what I want the line to contain:<br>   <big
 style="font-weight: bold;">SetKeyName("plain sword");</big><br><br>10) Ok, I replaced the line, but I'm still in input mode. To go back to<br>    command mode, I type a single period and enter, like this:<br>    <big
 style="font-weight: bold;">.</big><br><br>11) I'm back in command mode now. When I list the file contents with<br>    '<big
 style="font-weight: bold;">1z</big>' I can see that line 15 now says what I wanted.<br><br>12) Now I see another line that needs changing, so I enter '<big
 style="font-weight: bold;">18</big>' to <br>    get a closer look.<br><br>13) Sure enough, 18 needs to change, so I issue '<big
 style="font-weight: bold;">18</big>c'.<br><br>14) Like I did for line 15, I enter what the line should be.<br><br>15) To return to command mode, I enter a single period on a blank line.<br><br>16) I list the file contents, and see that my change was successful.<br><br>17) I'm finished making my changes, so I issue the '<big
 style="font-weight: bold;">x</big>' command. '<big
 style="font-weight: bold;">x</big>' <br>    means "save the changes I have made, and exit the editor".<br><br>18) I am now at my regular command prompt. To load my changes to this<br>    file, I type '<big
 style="font-weight: bold;">update sword</big>'.<br><br><big
 style="text-decoration: underline; font-weight: bold;"><big><big><br>Editor basics, part 2</big></big></big><br><br><br>	In the last section you saw what a simple line<br>replacement looks like in ed. Next we'll talk about some common<br>ed actions.<br><br><span
 style="font-weight: bold;">ADDING STUFF</span>:<br><br>	Suppose I want to specify that this sword requires only<br>one hand to wield it:<br><br></big></pre>
<hr style="width: 100%; height: 2px;">
<pre><big><br>&gt; <big><span style="font-weight: bold;">ed sword.c </span><small
 style="color: rgb(255, 0, 0);">started the editor</small></big><br>/realms/cratylus/area/weap/sword.c, 633 bytes<br>:<big><span
 style="font-weight: bold;">n </span><small
 style="color: rgb(255, 0, 0);">enabled line number printing</small></big><br>number on, list off<br>:<big><span
 style="font-weight: bold;">15,22 </span><small
 style="color: rgb(255, 0, 0);">listed lines 15 to 22</small></big><br> 15  SetKeyName("plain sword");<br> 16      SetId( ({ "sword", "short sword" }) );<br> 17      SetAdjectives( ({ "short" }) );<br> 18  SetShort("a plain sword");<br> 19      SetLong("A cheap and rather dull short sword.");<br> 20      SetMass(150);<br> 21      SetDollarCost(50);<br> 22      SetVendorType(VT_WEAPON);<br>:<big
 style="font-weight: bold;">20a</big> <span
 style="color: rgb(255, 0, 0);">appended to the file after line 20</span><br>    21. * <span
 style="font-weight: bold;"><big>SetHands(1); </big></span><big
 style="color: rgb(255, 0, 0);"><small>entered my added text</small></big><br>    22. * <big
 style="font-weight: bold;">. </big><big style="color: rgb(255, 0, 0);"><small>single dot on a blank line to exit input mode</small></big><br>:1<big
 style="font-weight: bold;">8,22 </big><big
 style="color: rgb(255, 0, 0);"><small>displayed line 18 through 22</small></big><br> 18  SetShort("a plain sword");<br> 19      SetLong("A cheap and rather dull short sword.");<br> 20      SetMass(150);<br> 21  SetHands(1);<br> 22      SetDollarCost(50);<br>:<big
 style="font-weight: bold;">x </big><big style="color: rgb(255, 0, 0);"><small>exited editor and saved</small></big><br>"/realms/cratylus/area/weap/sword.c" 27 lines 646 bytes<br>Exit from ed.<br></big></pre>
<hr style="width: 100%; height: 2px;">
<pre><big><br><br>	Here you can see that instead of '<big
 style="font-weight: bold;">c</big>', which replaces, I<br>used '<big
 style="font-weight: bold;">a</big>', which adds. I decided my new line would go after line<br>20, so I issued the command '<big
 style="font-weight: bold;">20a</big>'. Once I was done, I typed<br>a single dot on a blank line to exit "input mode". You'll notice<br>I didn't use the '<big
 style="font-weight: bold;">z</big>' command. Instead, since I knew where my<br>changes would go, I decided to list lines 18 through 22 with<br>the command '<big
 style="font-weight: bold;">18,22</big>'. I then issued the '<big
 style="font-weight: bold;">x</big>' command to save my <br>changes and exit the editor.<br>	If had I wanted my addition to go in front of line 20, <br>I could have used the '<big
 style="font-weight: bold;">20i</big>' command.<br><br><span
 style="font-weight: bold;">DELETING LINES</span><br><br>	Suppose I'm tired of seeing header lines that no<br>longer apply to this file. We can delete a single line, or<br>a range of lines, with the '<big
 style="font-weight: bold;">d</big>' commmand:<br><br></big></pre>
<hr style="width: 100%; height: 2px;">&gt;<big
 style="font-weight: bold;"> ed sword.c</big><br>
<pre><big>/realms/cratylus/area/weap/sword.c, 646 bytes<br>:<big
 style="font-weight: bold;">n </big><big style="color: rgb(255, 0, 0);"><small>enabled line number printing</small></big><br>number on, list off<br>:<big
 style="font-weight: bold;">1,10 </big><big
 style="color: rgb(255, 0, 0);"><small>listed lines 1 to 10</small></big><br>  1  /*    /domains/Examples/weapon/sword.c<br>  2   *    from the Nightmare IV LPC Library<br>  3   *    a simple sword example, nothing fancy<br>  4   *    created by Descartes of Borg 950402<br>  5   */<br>  6  <br>  7  #include &lt;lib.h&gt;<br>  8  #include &lt;damage_types.h&gt;<br>  9  #include &lt;vendor_types.h&gt;<br> 10  <br>:<big
 style="font-weight: bold;">1,5d </big><big
 style="color: rgb(255, 0, 0);"><small>deleted lines 1 to 5</small></big><br>:<big
 style="font-weight: bold;">1,5 </big><big
 style="color: rgb(255, 0, 0);"><small>listed (the new) lines 1 to 5</small></big><br>  1  <br>  2  #include &lt;lib.h&gt;<br>  3  #include &lt;damage_types.h&gt;<br>  4  #include &lt;vendor_types.h&gt;<br>  5  <br>:<big
 style="font-weight: bold;">1d </big><big style="color: rgb(255, 0, 0);"><small>deleted blank line 1</small></big><br>:<big
 style="font-weight: bold;">1z </big><big style="color: rgb(255, 0, 0);"><small>displayed the file starting at line 1</small></big><br>  1  #include &lt;lib.h&gt;<br>  2  #include &lt;damage_types.h&gt;<br>  3  #include &lt;vendor_types.h&gt;<br>  4  <br>  5  inherit LIB_ITEM;<br>  6  <br>  7  static void create() {<br>  8      item::create();<br>  9  SetKeyName("plain sword");<br> 10      SetId( ({ "sword", "short sword" }) );<br> 11      SetAdjectives( ({ "short" }) );<br> 12  SetShort("a plain sword");<br> 13      SetLong("A cheap and rather dull short sword.");<br> 14      SetMass(150);<br> 15  SetHands(1);<br> 16      SetDollarCost(50);<br> 17      SetVendorType(VT_WEAPON);<br> 18      SetClass(20);<br> 19      SetDamageType(BLADE);<br> 20      SetWeaponType("blade");<br> 21  }<br>:<big
 style="font-weight: bold;">x </big><big style="color: rgb(255, 0, 0);"><small>exited and saved</small></big><br>"/realms/cratylus/area/weap/sword.c" 21 lines 476 bytes<br>Exit from ed.<br></big></pre>
<hr style="width: 100%; height: 2px;">
<pre><big><br><br>	First I deleted lines 1 through 5 with the command '<big
 style="font-weight: bold;">1,5d</big>'. <br>Then, for good measure, I removed the remaining blank line '<big
 style="font-weight: bold;">1d</big>'.<br>	Voila. Cleaner code.<br><br
 style="font-weight: bold;"><span style="font-weight: bold;">REPLACING STRINGS</span><br><br>	Well now I want to replace all instances of "short" with<br>"plain", and I don't feel like editing each matching line<br>manually. I can do a search and replace. First I will list which<br>lines need to change, then I will change them:<br><br></big></pre>
<hr style="width: 100%; height: 2px;">&gt; <big><span
 style="font-weight: bold;">ed sword.c</span></big><br>
<pre><big>/realms/cratylus/area/weap/sword.c, 476 bytes<br>:<big
 style="font-weight: bold;">n</big></big><big><big
 style="color: rgb(255, 0, 0);"><small> enabled line number printing</small></big></big><big><br>number on, list off<br>:<big
 style="font-weight: bold;">g/short/p</big></big><big><big
 style="color: rgb(255, 0, 0);"><small>  searched for and displayed lines containing "short"</small></big></big><big><br> 10      SetId( ({ "sword", "short sword" }) );<br> 11      SetAdjectives( ({ "short" }) );<br> 13      SetLong("A cheap and rather dull short sword.");<br>:<big
 style="font-weight: bold;">g/short/s/short/plain</big></big><big><big
 style="color: rgb(255, 0, 0);"><small>  searched for "short" and replaced with "plain"</small></big></big><big><br>:<big
 style="font-weight: bold;">g/short/p</big></big><big><big
 style="color: rgb(255, 0, 0);"><small>  searched for "short" again but found none</small></big></big><big><br>:<big
 style="font-weight: bold;">1z</big></big><big><big
 style="color: rgb(255, 0, 0);"><small>  listed file from line 1</small></big></big><big><br>  1  #include &lt;lib.h&gt;<br>  2  #include &lt;damage_types.h&gt;<br>  3  #include &lt;vendor_types.h&gt;<br>  4  <br>  5  inherit LIB_ITEM;<br>  6  <br>  7  static void create() {<br>  8      item::create();<br>  9  SetKeyName("plain sword");<br> 10      SetId( ({ "sword", "plain sword" }) );<br> 11      SetAdjectives( ({ "plain" }) );<br> 12  SetShort("a plain sword");<br> 13      SetLong("A cheap and rather dull plain sword.");<br> 14      SetMass(150);<br> 15  SetHands(1);<br> 16      SetDollarCost(50);<br> 17      SetVendorType(VT_WEAPON);<br> 18      SetClass(20);<br> 19      SetDamageType(BLADE);<br> 20      SetWeaponType("blade");<br> 21  }<br>:<big
 style="font-weight: bold;">1</big></big><big><big
 style="color: rgb(255, 0, 0);"><small>  moved to line 1</small></big></big><big><br>  1  #include &lt;lib.h&gt;<br>:<big
 style="font-weight: bold;">I</big></big><big><big
 style="color: rgb(255, 0, 0);"><small>  ran automatic indentation</small></big></big><big><br>Indenting entire code...<br>Indentation complete.<br>:<big
 style="font-weight: bold;">1z</big></big><big><big
 style="color: rgb(255, 0, 0);"><small>  listed file from line 1</small></big></big><big><br>#include &lt;lib.h&gt;<br>#include &lt;damage_types.h&gt;<br>#include &lt;vendor_types.h&gt;<br><br>inherit LIB_ITEM;<br><br>static void create() {<br>    item::create();<br>    SetKeyName("plain sword");<br>    SetId( ({ "sword", "plain sword" }) );<br>    SetAdjectives( ({ "plain" }) );<br>    SetShort("a plain sword");<br>    SetLong("A cheap and rather dull plain sword.");<br>    SetMass(150);<br>    SetHands(1);<br>    SetDollarCost(50);<br>    SetVendorType(VT_WEAPON);<br>    SetClass(20);<br>    SetDamageType(BLADE);<br>    SetWeaponType("blade");<br>}<br>:<big
 style="font-weight: bold;">x</big></big><big><big
 style="color: rgb(255, 0, 0);"><small>  exited and saved</small></big></big><big><br>"/realms/cratylus/area/weap/sword.c" 21 lines 488 bytes<br>Exit from ed.<br></big></pre>
<hr style="width: 100%; height: 2px;">
<pre><big><br><br>	The command <big style="font-weight: bold;">g/short/p</big> showed me all the lines<br>that contained the substring "short". Then I ran the global<br>search and replace command to substitute "plain" for "short",<br>:<big
 style="font-weight: bold;">g/short/s/short/plain</big><br>	Then I searched again for the string "short" and<br>nothing came up, because it had been replaced.<br><br>	Finally I went to line number 1 and issued the '<big
 style="font-weight: bold;">I</big>'<br>command. This auto-indents the code, making it neater and<br>easier to read.<br><br><big
 style="font-weight: bold; text-decoration: underline;"><big><big><br>Editor basics, part 3</big></big></big><br><br><br>Now let's look at some common problems:<br><br><br>1) <big><span
 style="text-decoration: underline;">Accidental deletion</span></big><br
 style="text-decoration: underline;"><br><br>	If you type <big><span
 style="font-weight: bold;">1,20d</span></big> when you meant to type <big
 style="font-weight: bold;">1,2d</big> you will end<br>up with a file 18 lines shorter than you intended. <big
 style="font-weight: bold;">ed</big> does not<br>have an "undo" command, so those lines will never come back.<br>	However, if you quit the editor *without saving*, then that<br>deletion will not be committed to the file. You can issue the '<big
 style="font-weight: bold;">Q</big>'<br>command:<br><br>:<big
 style="font-weight: bold;">Q</big><br><br>	To force quit without saving. Of course, if those lines<br>weren't already in the file, this won't help much.<br><br><br>2) <big><span
 style="text-decoration: underline;">Can't leave the editor</span></big><br><br><br>	You try to write and exit, but get this:<br><br>:<big
 style="font-weight: bold;">x</big><br>File command failed.<br><br>	What this means is that for some reason, you can't write<br>to the file, so you don't exit the editor. What this usually means is that<br>you tried to edit a file that does not belong to you. Since you do not<br>have permission to modify the file, ed refuses to commit your changes.<br><br>	There are two ways around this. If you don't really care<br>whether your changes are saved or not, you can just force quit the <br>editor with '<big
 style="font-weight: bold;">Q</big>':<br><br>:<big
 style="font-weight: bold;">Q</big><br>Exit from ed.<br><br>	Your changes will be lost, but you'll be out of the editor.<br><br>	If you really want to save this file, you'll have to save it<br>somewhere other than your current working directory (cwd). You can save<br>it to your home directory with the '<big
 style="font-weight: bold;">w</big>' command, then force quit:<br><br>:<big
 style="font-weight: bold;">w /realms/cratylus/sword.c</big><br>"/realms/cratylus/sword.c" 20 lines 478 bytes<br>:<big
 style="font-weight: bold;">Q</big><br>Exit from ed.<br><br><br>3) <big><span
 style="text-decoration: underline;">Indent command fails</span></big><br><br><br>	You try to auto-indent your code but get an error like this:<br><br>:<big
 style="font-weight: bold;">I</big><br>Indenting entire code...<br>Unterminated string in line 13<br>Indentation halted.<br><br>	This is pretty self explanatory. Indent relies on a certain <br>amount of coherence in your code, and if your syntax is sufficiently<br>munged, it can't figure out how to properly do its thing.<br>	Examine the line that indent complains about, and also the<br>line before it. Sometimes a good line is accused of being bad, just<br>because it comes after a bad line.<br><br><br>4) <big><span
 style="text-decoration: underline;">I need to [something] in ed, but don't know how!</span></big><br><br><br>	While in command mode, type '<big
 style="font-weight: bold;">h</big>' and enter. You'll get<br>a handy list of ed commands available to you.<br><br><br>5) <big
 style="text-decoration: underline;">My ability/patience/time is limited. I want not to use ed.</big><br><br><br>	I feel your pain. The currently available ways around<br>this are:<br><br>1) Shell account. If you can get shell, or command line access<br>to the computer that is running the mud, then you can probably<br>use an editor local to that computer (like vim) to edit files.<br>	Chances are, though, that if you are a regular rank-and-file<br>creator, you will not be given shell access. Most system admins<br>consider giving random people off the net shell access <br>an abomination.<br><br>2) Server FTP/SFTP. The server that runs the mud might have an<br>ftp server or sftpd access. Again, most security-conscious sysadmins<br>will not permit Just Some Person Off The Internet to have this<br>kind of access.<br><br>3) Mud FTP. I don't like this option. Unix FTPD is a security <br>concern as it is. Using unsupported, un-warrantied mud network code<br>to provide ftp access to files seems to me to be equivalent to pulling<br>down your pants, bending over, and whistling for the Internet to<br>come visit. But...it's an option.<br><br>4) Client upload. This is actually the most sensible option, if<br>you are truly allergic to ed. You still need to use ed, but what<br>you can do is write your code in your favorite local editor, like <br>notepad or gvim or whatever. Then use your mud client (most of them<br>have an option to "send text") to send the code by running ed,<br>entering input mode, copying the code from your editor, and<br>pasting it into your client.<br>	This is a somewhat awkward system, and ill-suited to <br>making minor changes. But it has the virtue of working well and<br>being a widely available option.<br><br>5) Suck it up. Really, you need to just get used to it. Don't<br>make me tell you stories about how when I was younger I had to<br>code using a VT terminal with no cut-and-paste, in an unheated,<br>locked computer lab 20'x10' in size, at 9600 bps. In a snowstorm.<br>Uphill both ways.<br><br><br>	<br><a
 href="index.html">Dead Souls Homepage</a><br><br><br><br></big></pre>
</body>
</html>