/* Double Daggers II  - Coded, Programmed & Designed by
   PRINCE DESTY for C-NET Amiga

based on Double Daggers - written on atari 8-bit for carina II by Prince Desty

developement started in October 1990 then halted.
developement continued in April 1991....and continues

OPTION 1:
shareware $25  
      Manual explains how to use construction mode, plus a story about
      the world in which the game occurs and other niceties.
      About the races, classes, etc.. and how to keep a balanced game
      going.
      And All Current Construction Software
             (upgrades are Free)

OPTION 2: 
      (read below for What you can send me instead..)
      (Many lines below that is...)

---All upgrades may be downloaded from any DNK Support Board.

currently our support board is [203] 848-1381  1200-38,400 bauds
24 hours, Dark underworld is the BBS name and is an Affiliate of DNK.

I really Hate these REM statements or Comment things whatever you want
to call them, So this is the ONLY one you will see in the program.

If You really Want to Modify this program, pay the $25, and then do what 
you want.. but I really Recommend Printing it out and studying(?) how I did
it...  I don't program in any Orderly fashion, Heck, if it works why
bother trying to fix what Isn't broken... Cosmetic programming is for wimps.

Real programmers Just slam it together and if it works Great, if not they
Don't sleep til it functions without bugs.(I'm very tired at this point.)

ENJOY.

Ps. If you enjoy reading comments then by all means read all the docs
that are on the disk.  

This file is getting too big.. Jeez...ok....if you don't read comments
on disk.. NOTE this..

THIS PROGRAM WILL ONLY RUN if the Following conditions are met.

You must have at least 900k FREE RAM to run this program
for EACH PORT.  if you only have 900k and run 2 or more ports.
by all means, Make it EXCLUSIVE!!

I have 2 Megs ram myself and am Barely Able to Run this thing. I had to get
more ram, so I could continue writing this game.

The Ram Sizes mentioned DO NOT COUNT for the RAM you lose when you have a hard 
drive. so if you have 1.5M Ram and a Hard drive, which probably leaves
you with around 1.3M Ram, you may have problems running the program.

The More you have the Less chance you will have of running out of memory.

it has been tested on both Disk Drive and Hard drive based systems.
(works really fast and nicely on a Hard drive..not to mention that the 
basic program easily takes up 1 880k disk!!!)


Dungeons can be 996 rooms per level up to 998 levels.
Forests can be the same.

Now Realistically speaking, That means there is No Limit.

if you completely made EVERY ROOM of EVERY LEVEL in both the FOREST
and the DUNGEON, you would need Apx 400 MEGS of Drive space.
(and that is for only 1 DUNGEON!) now add a few hundred megs
for each dungeon after that... 
(But, That is more typing then I really care to do.)
(and unless you have some Mega Desire to get writer's cramp, I don't
think you'd try it either...)  but it is capable of doing such.
anyways..I think the Amiga directory can hold that much, I really don't
know.. I know for positive it can handle 300 files / directory.(Each room
is it's OWN FILE..) 
lots of little config files sorta...(each apx 90-320 bytes!)
(Adds up real quick though..don't let the size fool ya..)

Enough of my Rambling on... Have a Blast... 

and Hey, if you don't want to send $25...Then Please...

SEND me a few Disks of Mods, programs or whatever... GFILES would also be 
greatly appreciated... Pfiles.... etc..(Stuff YOU wrote!). 

Just remember..this Program took ALOT OF WORK to get it where it is now.

Alot of Testing, Writing, Re-Writing, Testing testing and more testing..
Until we could get it to a point where we could call it Interesting...
and Maybe even Fun...

Prince Desty..................................<---That's Me!

THANK THE GODS FOR AMIGA POWER! It Allowed us to create this HUGE memory
sucking PFILE...

Send Any payments or Items, disks, etc.. to...

Charles Brick
739 Hartford RD
Salem, CT. 06415

make checks or Money Orders out to Above Name.
(my wife helped too...but I do the money.)

also look for HackMaster 2000 (from me as well..) I released it months ago.

The Actual Program Code is Below...(I bet you were wondering if it was even
here at all!)

makesure the DDCONFIG file is in your Main PFILES: directory, or this
sucker will crash.

*/

Options Results
bufferflush
Signal on ioerr
signal on syntax
signal on error
tinkering=0
getuser 1
handle = result
getuser 12
nowdate=result
call time ('R')
tlimit=40*60
call open(config,"PFILES:DDconfig","R")
do until eof(config)=1
interpret readln(config)
end
call close config
call open(config,"PFILES:DDconfig2","R")
do until eof(config)=1
interpret readln(config)
end
call close config
getuser 27
columns=result
if columns<80 then columns=40
if columns>79 then columns=80
path = DAGPATH
users= DAGPATH||"users/"
if columns=40 then dip=dagpath||"Text/flashy.40"
if columns=80 then dip=dagpath||"text/Flashy.80"
sendfile (dip)
map.1="\c3\r1-----\r0"
map.2="\c3\r1--\r0 \r1--\r0"
map.3="\c3\r1|\r0   \r1|\r0"
map.4="\c3\r1|\r0    "
map.5="\c3    \r1|\r0"
map.6="\c3     "
map.7="\c3\r1|\r0  ^\r1|\r0"
map.8="\c3\r1|\r0v  \r1|\r0"
map.9="\c3  o  "
map.10="\c3\r1|\r0 o  "
map.11="\c3  o \r1|\r0"
map.12="\c3\r1|\r0 o \r1|\r0"
map1.1="\c5     "
map1.2="\c5  \r1#\r0  "
map1.3="\c5  \r1#\r0  "
map1.4="\c5  \r1###\r0"
map1.5="\c5\r1###\r0  "
map1.6="\c5\r1#####\r0"
map1.7="\c5  \r1# ^\r0"
map1.8="\c5 \r1v#\r0  "
map1.9= "\c5\r1##o##\r0"
map1.10="\c5 \r1#o##\r0"
map1.11="\c5\r1##o#\r0 "
map1.12="\c5 \r1#o#\r0 "
textpath = DAGPATH||"text/"
monsterpath = DAGPATH||"monsters/"
dungeonpath = DAGPATH||"dungeon/1/"
forestpath = DAGPATH||"forest/1/"
itemspath = DAGPATH||"items/"
spellspath = DAGPATH||"spells/"
mitemspath = DAGPATH||"mitems/"
Playerfile = DAGPATH||"users/"||handle
toolspath=DAGPATH||"tools/"
getuser 28
termtype = result
if termtype=3 then termtype=2
title=DAGPATH||"ddtitle"||columns||"."||termtype
sendfile (title)
Transmit "\c1\n1(Any Key)\g0\h9\f1"
pretitles=DAGPATH||"pretitle"
pretitle:
sendfile (Pretitles)
Sendstring "\n1\c3Option: \c1" 
getchar
xtx=upper(left(result,1))
if xtx="#" then signal quit
if xtx="A" then do;transmit "About";sendfile (DAGPATH||"news/ABOUT");signal pretitle;end
if xtx="H" then do;Transmit "History";sendfile (DAGPATH||"news/History");signal pretitle;end
if xtx="O" then do;Transmit "Ordering";sendfile (DAGPATH||"news/Ordering");signal pretitle;end
if xtx="C" then do;Transmit "Credits";sendfile (DAGPATH||"news/Credits");signal pretitle;end
if xtx="R" then do;transmit "Read Paper";sendfile (DAGPATH||"text/ddpaper");signal pretitle;end 
transmit "Play Double Daggers II"
Costpath=dagpath||"TodayPrices"
sendfile (costpath)
transmit "\c1(Any Key)\g0\h9\h1"
Bufferflush
sendstring "\n1\c7Loading Treasures..."
call open(Treas,DAGPATH||"text/treasurelist","R")
do i = 1 to maxtreasures;tres.i=readln(treas);end
call close treas
transmit "loaded!"
sendstring "\n1\c7Loading Blood & Guts..."
call open(Gorel,DAGPATH||"text/gorelist","R")
do i = 1 to maxgore;gore.i=readln(Gorel);end
call close Gorel
transmit "loaded!"
if exists(playerfile) then do;Call Loadcharacter;call doubledaggers;end
Transmit "\c3Ahh.. .A New Player..\c2Let me Dig a Body up for ya!\w1"
Transmit "\f1\c1 Double Daggers..Creating Character..."
whatsex:
sendstring "\c1Sex <Male/Female>: "
getchar
u.1=upper(left(result,1))
if u.1="#" then call quit
if u.1 ="M" then do;Transmit "Male";call whatrace;end
if u.1 ="F" then do;Transmit "Female";call Whatrace;end
call whatsex
whatrace:
filename=DAGPATH||"text/racelist"
call open(races,filename,'R')
i=0
do until eof(races)
i=i+1
racename.i=readln(races)
rkey.i=readln(races)
rstr.i=readln(races)
rint.i=readln(races)
rdex.i=readln(races)
rcon.i=readln(races)
rchr.i=readln(races)
rdes.i=readln(races)
end
maxraces=i-1
call close races
Raceoptions:
Transmit "\f1\c1 Race Options \n1"
transmit "\c3[V]\c1iew Races "
transmit "\c3[P]\c1ick a Race"
sendstring "\n1\c4Race Cmd:\c1 "
getchar
xtx=upper(left(result,1))
if xtx="#" then signal quit
if xtx="P" then do;Transmit "Pick a Race";signal showraces;end
if xtx="V" then do;transmit "View Races";signal viewraces;end
viewraces:
transmit "\f1\c1 Select a Race to View\n1"
do i=1 to maxraces
transmit "\c2["rkey.i"]\c1 "racename.i
end
pickrace1:
query"\n1\c1Your choice?: "
xtx=upper(left(result,1))
if xtx="#" then signal quit
do i = 1 to maxraces
if xtx=rkey.i then do;signal setup339;end
end
signal viewraces
setup339:
sendfile (Rdes.i)
transmit "\c1[Any Key]\g0\h9\h1"
signal raceoptions
showraces:
transmit "\f1\c1 Select a Race \n1"
do i=1 to maxraces
transmit "\c2<"rkey.i">\c1 "racename.i
end
pickrace:
query"\n1\c1Your choice?: "
xtx=upper(left(result,1))
if xtx="#" then signal quit
do i = 1 to maxraces
if xtx=rkey.i then do;signal setup33;end
end
signal showraces
setup33:
sendfile (rdes.i)
transmit "\c1(any key)\g0\h9\h1"
u.2=racename.i
u.7=random(10,18,time('s'))
u.8=random(10,18,time('s'))
u.9=random(10,18,time('s'))
u.10=random(10,18,time('s'))
u.11=random(10,18,time('s'))
u.3=u.10;u.4=u.3
u.5=u.8;u.6=u.5
u.20=random(150,400,time('s'))
u.7=u.7+rstr.i
u.8=u.8+rint.i
u.9=u.9+rdex.i
u.10=u.10+rcon.i
u.11=u.11+rchr.i
transmit "\n1\c4Strength     :\c7 "u.7
transmit "\c4Intelligence :\c7 "u.8
transmit "\c4Dexterity    :\c7 "u.9
transmit "\c4Stamina      :\c7 "u.10
transmit "\c4Charisma     :\c7 "u.11"\n1"
transmit "\c4Starting Gold:\c7 "u.20"\n1"
newplayerstatassign:
u.21=0;u.12="Hands";u.14=1;u.16=10
u.13="clothing";u.15=0;u.17=2
u.18=1;u.19=0;u.22=0;u.23=0;u.24="None"
u.25="0";u.26="0"
u.28=2;u.29=5;u.30=0;u.31=0;u.32="000";u.33="001";u.34="000"
u.35=0;u.36=nowdate;u.37=50;u.38=0
u.39=0;u.40=0;u.41=0;u.42=0;u.43=0;u.44=0;u.48=0
do z=52 to 62;u.z=0;end
u.58=0;u.56=0;u.53=1;u.54=1;u.55=0
call fixplayer3
LoadClasses:
filename=DAGPATH||"text/classlist"
call open(class,filename,'R')
i=0
do until eof(class);i=i+1
clname.i=readln(class)
clkey.i=readln(class)
cl2.i=readln(class)
cl3.i=readln(class)
cl4.i=readln(class)
cl5.i=readln(class);cl6.i=readln(class);cl7.i=readln(class)
cl8.i=readln(class);cl9.i=readln(class);cl10.i=readln(class)
end
call close class
maxclass=i-1
Classoptions:
Transmit "\f1\c1 Class Option Menu\n1 "
Transmit "\c3[V]\c7iew Class Info "
Transmit "\c3[P]\c7ick a Class"
sendstring "\c4\n1Class Cmd:\c1 "
getchar
xtx=upper(left(result,1))
if xtx="#" then signal Quit
if xtx="V" then do;Transmit "View Class Info";signal viewclassinfo;end
if xtx="P" then do;Transmit "Pick a Class";signal showclass;end
signal classoptions
ViewClassinfo:
Transmit "\c1\f1 Select a Profession to View\n1"
do i = 1 to maxclass
transmit "\c2["clkey.i"]\c1 "clname.i
end
selectclass1:
query "\n1\c1Your Choice?: "
xtx=upper(left(result,1))
if xtx="#" then signal quit
do z=1 to maxclass
if xtx=clkey.z then signal cont987
end
signal classoptions
cont987:
sendfile (cl9.z)
TRANSMIT   "\C1---------------------------"
Sendstring "\c3Can Cast Spells         :\c1 "
if cl2.z="1" then Transmit "Yes";else Transmit "No"
sendstring "\c3Can Perform Thieving    :\c1 "
if cl3.z="1" then transmit "Yes";else Transmit "No"
sendstring "\c3Fighting Bonus          :\c1 ";transmit cl4.z
sendstring "\c3Can Cast Combat Spells  :\c1 "
if cl5.z="1" then transmit "Yes";else Transmit "No"
sendstring "\c3Can Cast Healing Spells :\c1 "
if cl6.z="1" then Transmit "Yes";else Transmit "No"
sendstring "\c3Can Wear Armor          :\c1 "
if cl8.z="1" then transmit "Yes";else Transmit "No"
sendstring "\c3Experience Needed/Level :\c1 ";transmit cl10.z
TRANSMIT   "\C1---------------------------"
transmit "\n1\c7[Any Key]\g0\h9\h1"
signal classoptions
showclass:
Transmit "\c1\f1 Select a Profession \n1"
do i = 1 to maxclass
transmit "\c2<"clkey.i">\c1 "clname.i
end
selectclass:
query "\n1\c1Your Choice?: "
xtx=upper(left(result,1))
if xtx="#" then signal quit
do z=1 to maxclass
if xtx=clkey.z then do;u.27=clname.z;u.45=cl2.z;u.46=cl3.z;u.47=cl10.z;u.49=cl6.z;u.50=cl5.z;u.51=cl8.z;signal cont5;end
end
signal showclass
cont5:
sendfile (cl9.z)
transmit "\c1(any key)\g0\h9\h1"
u.7=u.7+cl4.z
if u.46="1" then do;u.39=5;u.40=5;u.41=5;u.44=5;end
call cleanupclasses;call cleanupraces
if ~exists(DAGPATH||"ULIST") then do;Transmit "Making New File...";signal off error;call open(ulist,DAGpath||"ULIST","W");signal on error;call close ulist;end
transmit "checking if you are here already..."
call open(ulist,DAGpath||"ULIST","R")
do until eof(ulist);TEMP=READLN(ULIST);if temp=handle then do;call close ulist;signal cont99;end;end
addulist:
transmit "\c1\n1Adding You to the Roster."
call open(ULIST,DAGpath||"ulist","A")
signal off error
writeln(ulist,handle)
signal on error
call close ulist
cont99:
pathh=Dagpath||"MagicItems/"||handle
if ~exists(pathh) then do
sendstring "\c3Creating Equipment File..."
do i=1 to 14
ma1.i="0";ma2.i="0";ma3.i="0";ma4.i="0";ma5.i="0";ma6.i="0"
end
call open(fle,pathh,"W")
signal off error
do i = 1 to 14
writeln(fle,ma1.i)
writeln(fle,ma2.i)
writeln(fle,ma3.i)
writeln(fle,ma4.i)
writeln(fle,ma5.i)
writeln(fle,ma6.i)
end
signal on error
call close fle
transmit "Done."
end
call fixplayer3
call savecharacter
call loadcharacter
signal doubledaggers

loadcharacter:
Sendstring "Loading Character..."
call open(user,playerfile,"R")
do i = 1 to 60;u.i = readln(user);end
call close user
call fixplayer3
transmit "Loaded!"
pathh=Dagpath||"MagicItems/"||handle
if ~exists(pathh) then do
sendstring "\c3Creating Equipment File..."
do i=1 to 14
ma1.i="0";ma2.i="0";ma3.i="0";ma4.i="0";ma5.i="0";ma6.i="0"
end
call open(fle,pathh,"W")
signal off error
do i = 1 to 14
writeln(fle,ma1.i)
writeln(fle,ma2.i)
writeln(fle,ma3.i)
writeln(fle,ma4.i)
writeln(fle,ma5.i)
writeln(fle,ma6.i)
end
signal on error
call close fle
transmit "Done."
end
inky:
Sendstring "\c7Loading Equipment File..."
signal off error
call open(fle,pathh,"R")
do i = 1 to 14
ma1.i=readln(fle)
ma2.i=readln(fle)
ma3.i=readln(fle)
ma4.i=readln(fle)
ma5.i=readln(fle)
ma6.i=readln(fle)
end
call close fle
transmit "Loaded!"
if u.34=1 then do;awoke=1;Transmit "\c1Resuming where you left off in the Dungeon...";signal dungeon;end
if u.34=2 then do;awoke=1;transmit "\c1Resuming where you left off in the Forest...";signal forest;end
if u.34=0 then do;Transmit "\c1Entering the Grand City of Astenia.";signal doubledaggers;end
return

fixplayer3:
if u.58=0 then u.61="Body Part"
if u.58=1 then u.61="Edged"
if u.58=2 then u.61="Bashing"
if u.58=3 then u.61="Ranged"
if u.58=4 then u.61="Vapor"
if u.58=5 then u.61="Poison"
if u.58=6 then u.61="Heat"
if u.58=7 then u.61="Cold"
if u.58=8 then u.61="Pole Arm"
if u.58>8 then u.61="Unknown"
if u.58<0 then u.61="Unknown"
if u.52=0 then u.62="None"
if u.52=1 then u.62="Edged"
if u.52=2 then u.62="Bashing"
if u.52=3 then u.62="Ranged"
if u.52=4 then u.62="Vapor"
if u.52=5 then u.62="Poison"
if u.52=6 then u.62="Heat"
if u.52=7 then u.62="Cold"
if u.52=8 then u.62="Pole Arm"
if u.52>8 then u.62="Unknown"
if u.52<0 then u.62="Unknown"
return
fixplayer4:
return

SaveCharacter:
Sendstring "\c1Saving Character..."
call fixplayer3
signal off error
call open(user,playerfile,"W")
do i= 1 to 60;WRITELN(user,u.i);end
signal on error
call close user
transmit "Saved!"
pathh=Dagpath||"MagicItems/"||handle
Sendstring "\c7Saving Equipment File..."
signal off error
call open(fle,pathh,"W")
do i = 1 to 14
signal off error
Writeln(fle,ma1.i)
writeln(fle,ma2.i)
writeln(fle,ma3.i)
writeln(fle,ma4.i)
writeln(fle,ma5.i)
writeln(fle,ma6.i)
end
signal on error
call close fle
transmit "Saved!"
return

quit:
shutdown
exit

showmagic:
Transmit "\c5 ## \c4  Magic Item Name   \c3 Charges \c1  Active(y/n)"
Transmit "\c6---- ------------------ --------- -------------" 
do z=1 to 14
if ma1.z="0" then ma1.z="Empty"
sendstring "\c3 "right(z,2," ")"\c7  "left(ma1.z,17)"\c2   \c4"left(ma5.z,7," ")
if ma6.z=1 then Transmit "   Yes"
else Transmit "   No"
end
Transmit "\c6-----------------------------------------------" 
return

showstats:
path=DAGPATH||"stats"
call open(ick,path,"R")
do until eof(ick)=1
interpret readln(ick)
end
call close ick
return

doubledaggers:
pnam=u.12;ppow=u.14;psdc=u.16;ptyp=u.58;pdes=u.61
clloc=0;u.34=0;u.36=nowdate;tleft=time('E')
if u.3=0 then if u.20=0 then if u.21=0 then do;Transmit "\n1\c1You hold out your Tin cup..\w1\n1\c7A Passing citizen Tosses in 6 Gold pieces.";u.20=6;end
if u.3<0|u.3=0 then u.3=1
signal township
signal doubledaggers
Townmenu:

display:
if flzz="01" then call ARMORY
if flzz="02" then call WEAPON
if flzz="03" then call HEALER
if flzz="04" then do;u.32="000";u.33="001";call CHOOSEDUNGEON;end
if flzz="05" then do;u.32="000";u.33="001";call FOREST;end
if flzz="06" then call THEEND
if flzz="07" then call TRAINING
if flzz="08" then call MAGICSHOP
if flzz="09" then call SUPPLIES
if flzz="10" then call TAVERN
if flzz="11" then call GROCER
if flzz="12" then call BROTHEL
if flzz="13" then call INN
if flzz="14" then call CASINO
if flzz="15" then call showstats
if flzz="17" then call Otherplayers
if flzz="18" then call BANK
if flzz="19" then call postoffice
if flzz="20" then BBSCOMMAND "CHAT"
if flzz="21" then BBSCOMMAND "MS"
if flzz="22" then BBSCOMMAND "MR"
if flzz="23" then BBSCOMMAND "ET"
if flzz="16" then call council
if flzz="24" then call Suicide
if flzz="25" then signal sendmoney
if flzz="26" then signal TavernTalk
signal town2

postoffice:
transmit "\c1The Astenian Post Office.\n1"
transmit "\c4[1]\c3 Send Email"
transmit "\c4[2]\c3 Read Email"
transmit "\c4[3]\c3 Send Feedback"
transmit "\c4[4]\c3 Edit Terminal"
transmit "\c4[Q]\c5 Return to Town"
sendstring "\n1\c2Post Office Cmd:\c7 "
getchar
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="1" then do;transmit "Send Email";bbscommand "MS";end
if xtx="2" then do;transmit "Read Email";bbscommand "MR";end
if xtx="3" then do;transmit "Feedback!";bbscommand "FEEDBACK";end
if xtx="4" then do;transmit "Edit Terminal";bbscommand "ET";end
if xtx="Q" then do;transmit "Exiting...";signal doubledaggers;end
transmit "_Invalid_"
signal postoffice

TavernTalk:
line="\c5------------------------------------------------------------------------------\c3"
base="Tavern Talk"
path=DAGPATH||"MESS/"
fle="msg."
main77:
controlpath=path||"Control"
if ~exists(controlpath) then do;signal off error;call open(fle,controlpath,"W");writeln(fle,"0");writeln(Fle,"0");signal on error;call close fle;end
call open(fle,controlpath,"R");low=readln(fle);high=readln(fle);call close fle
Main0:
if high>u.59 then do
nwmess=high-u.59
transmit "\c4There are \c1"nwmess"\c4 New Messages."
end
transmit "\c4Existing Messages \c1[\c3"low+1"\c1 - \c3"High"\c1]"
transmit "\n1\c1[\c3R\c1]\c4ead Message(s)"
transmit "\c1[\c3N\c1]\c4ew Messages!"
transmit "\c1[\c3W\c1]\c4rite a Message"
transmit "\c1[\c3Q\c1]\c4uit"
sendstring "\c5\n1Choice:\c1 "
getchar
xtx=upper(Left(result,1))
if xtx="#" then do;transmit "Hang Up Detected";Signal TheEnd;end
if xtx="R" then do;Transmit "Read";signal ReadMessages;end
if xtx="W" then do;transmit "Write";signal PostAMessage;end
if xtx="Q" then do;transmit "Return to Town";Signal DoubleDaggers;end
if xtx="N" then do;Transmit "Read New";nim=u.59+1;signal mess3;end
signal main0
ReadMessages:
if high=0 & low=0 then do;transmit "\c2There are No Messages Written";signal main0;end
query "\c4Start Reading at What #[Q=quit]:\c7 "
xtx=result
if upper(left(xtx,1))="Q" then signal main0
if datatype(xtx,"N")=0 then signal readmessages
nim=xtx
if nim=0 then signal endmess
mess3:
if nim>high then signal readmessages
if nim<low then signal readmessages
path2=path||"Msg."||nim
if ~exists(path2) then do;transmit "\c7Message Not Found";signal readmessages;end
call open(fle,path2,"R")
i=0
do until eof(fle)=1
i=i+1
r.i=readln(fle)
end
maxline=i
call close fle
transmit "\n1\c5Message \c1"nim"\c5 of \c7"high"\n1"
transmit "\z5\c1To  :\z0 \c7"r.2
transmit "\z5\c1From:\z0 \c7"r.1
transmit line
do i=3 to maxline
transmit r.i
end
transmit line
endmess:
sendstring "\n1\c4\c1[\c3N\c1]\c4ext \c1[\c3P\c1]\c4revious \c1[\c3Q\c1]\c4uit \c1[\c3R\c1]\c4eply \c1[\c3J\c1]\c4ump to #:\c7 "
getchar
xtx=upper(left(result,1))
if xtx="#" then Do;Transmit "Hung Up";Signal TheEnd;end
if xtx="Q" then do;transmit "Quit";call checkhigh;signal main0;end
if xtx="N" then do;transmit "Next!";signal nextmess;end
if xtx="P" then do;transmit "Previous!";signal prevmess;end
if xtx="R" then do;transmit "Reply";signal REPLY;end
if xtx="J" then do;transmit "Jump!";signal JUMPMESS;end
signal endmess
checkhigh:
if nim>u.59 then u.59=nim
return
jumpmess:
Transmit "\c4Existing Messages \c1"low+1"\c4 - \c1"high
query "\n1\c3Jump to What Message?\c1 "
zz=result
if datatype(zz,"N")=0 then signal endmess
if zz>high then do;transmit "\c2Message Not Found.";signal endmess;end
if zz<low+1 then do;transmit "\c2Message Not Found.";signal endmess;end
nim=zz
signal mess3
nextmess:
nim=nim+1
if nim>high then do;transmit "\c2End of Messages";nim=high;signal endmess;end
signal mess3
prevmess:
nim=nim-1
if nim<low+1 then do;transmit "\c2You are at the First Message";nim=low+1;signal endmess;end
signal mess3 
Reply:
rep=1
Transmit "\c3Replying to "r.1
m.2=r.1;m.1=handle
signal post2
PostAMessage:
rep=0
query "\c4To Whom Shall we Write to?:\c1 "
xtx=result
if left(xtx,1)="#" then Signal TheEnd
if xtx="" then signal main0
transmit "\c3Writing to \c7\r1 "xtx" \r0"
m.1=handle
m.2=xtx
post2:
do i=3 to 8;m.i=""
transmit "\c5 Enter up to 6 Lines of Text(80 Characters max / line.)"
transmit "\c5 Hit return at the end of Each Line.  "
transmit "\c5 Enter \c1EXIT\c5 to end the Message.\n1" 
do i=3 to 8
query "\c1"i-2")\c3"
m.i=result
if m.i="" then m.i=" "
if left(m.i,1)="#" then Signal TheEnd
if upper(left(m.i,4))="EXIT" then signal EDIT
end
edit:
endline=i-1
query "\c4End Msg Cmd:[?]\c1 "
xtx=upper(left(result,1))
if xtx="#" then Signal TheEnd
if xtx="?" then do
transmit "\n1[S]ave\n1[A]bort"
end
if xtx="S" then signal savemessage
if xtx="A" & rep=0 then do;transmit "\n1Aborting Message.";signal main0;end
if xtx="A" & rep=1 then do;transmit "\n1Aborting Message.";signal endmess;end
signal edit
savemessage:
sendstring "\n1\c7Scribing..."
numero=high+1
path1=path||"Msg."||numero
call open(fle,path1,"W")
signal off error
do i = 1 to endline
writeln(fle,m.i)
end
signal on error
call close fle
call open(fle,controlpath,"W")
signal off error
writeln(fle,low)
high=high+1
writeln(fle,High)
signal on error
call close fle
transmit "\h6ed!"
call update
if rep=0 then signal main0
if rep=1 then signal endmess
signal main0
Update:
if high-low>maxmess then do
transmit "\c7Killing Old Messages..."
x=high-maxmess
do i=low+1 to x
ppx=path||"Msg."||i
trz = "\$0delete "||PPX||"\"
transmit trz
end
low=x
path1=path||"Control"
call open(fle,path1,"W")
signal off error
writeln(fle,low)
writeln(fle,High)
signal on error
call close fle
end
return
signal main0

CheckExist:
call open(ulist,dagpath||"ULIST","R")
do until eof(ulist);TEMP=READLN(ULIST)
if upper(left(temp,22," "))=upper(left(Namen,22," ")) then do
call close ulist
exis=1
return
end
end
exis=0
call close ulist
return

SendMoney:
Transmit "\n1\c1   -=:] Astenia Express Money Send [:=- "
Query "\n1\c3Send money to Who?\c7 "
namen=result
if upper(left(namen,20)) = upper(left(handle,20)) then do;transmit "\c1You can't send money to yourself!";signal doubledaggers;end
if left(namen,1)="#" then signal theend
if left(namen,1)=" " then signal doubledaggers
if namen="" then signal doubledaggers
call checkexist
if exis=0 then do;transmit "\c2No such user on Account! \c0";signal doubledaggers;end
sendmoney2:
transmit "\c4You have:\c1 "u.20 " gold!"
query "\c4\n1Send how much?:\c7 "
xtx=result
if left(xtx,1)="#" then signal theend
dx=datatype(xtx,'N')
if dx=0 then signal sendmoney2
if xtx=0 then signal doubledaggers
if xtx>u.20 then do;transmit "\c2You haven't that Much gold!";signal doubledaggers;end
if xtx<1 then do;Transmit "\c2Yeah right...Get real!";signal doubledaggers;end
pathaction=DAGPATH||"users/"namen
call open(x,pathaction,'R')
do i=1 to 60;z.i=readln(x);end
call close x
sendstring "\c4Transfering Funds..."
u.20=u.20-xtx
z.21=z.21+xtx
call open(x,pathaction,'W')
signal off error
do i=1 to 60;writeln(x,z.i);end
signal on error
call close x
transmit "Complete!\n1"
signal doubledaggers

Suicide:
Transmit "\n1\c1\r1 Suicide....Restart Character.... \r0\n1"
query "\c3Are you Sure? [y/N]: "
xtx = result
if left(xtx,1)="#" then signal theend
if upper(left(xtx,1))="Y" then signal Deleteplayer
return
deleteplayer:
temp='\$0Delete "'||playerfile||'"\'
transmit "\c1Comitting Suicide...\c2you throw yourself into a Pit of Vipers.."
transmit "you die horribly...Painfully.. "
transmit temp
temp='\$0delete "'||dagpath||'Magicitems/'||handle||'"\'
transmit temp
transmit "\c4Re-Enter the game to start a NEW Character!"
shutdown
exit

Council:
Transmit "\c1(any key)\g0\h9\f1"
Transmit "\c7<---* The High Council *--->\n1"
Transmit "\c1[H]\c4 Help File"
transmit "\c1[L]\c4 List Other Adventurers"
transmit "\c1[Y]\c4 Your FULL Status Report!"
transmit "\c1[Q]\c4 Exit to Town"
Sendstring "\n1\c4Choice: \c1"
Getchar
xtx=upper(left(result,1))
transmit xtx
if xtx="#" then signal theend
if xtx="H" then signal AboutDungeon
if xtx="Y" then call showstats
if xtx="L" then call otherplayers
if xtx="Q" then signal doubledaggers
signal council
AboutDungeon:
Text1path=DAGPATH||"text/DaggersHelp"
sendfile (Text1Path)
transmit "\n1\c1(Any Key)\g0\h9\h1"
signal council

CASINO:
Transmit "\c1(any key)\g0\h9\f1\c1 Gorgs Casino II \n1"
if u.20<1 then do;transmit "\c1You have NO MONEY! OUT!!!";signal doubledaggers;end
Transmit "\c1\r1[1]\r0 \c3Number Guesser "
transmit "\c1\r1[2]\r0 \c3Executioner! "
transmit "\c1\r1[3]\r0 \c3Coin toss"
transmit "\c1\r1[Q]\r0\c3 Return to Town"
query "\n1\c3Casino Cmd:\c7 "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="Q" then signal doubledaggers
if xtx="1" then signal NumberGuesser
if xtx="2" then signal execution
if xtx="3" then signal cointoss
signal casino

cointoss:
sendfile (DAGPATH||"text/CoinToss")
transmit "\n1\c3You have: \c7"u.20" Gold"
query "\n1\c4Place your bet[max=25]: "
xtx=result
if left(xtx,1)="#" then signal theend
cx=datatype(xtx,'N')
if cx=0 then signal casino
if xtx>u.20 then do;transmit "\c2You haven't that much gold!";signal casino;end
if xtx<1 then do;transmit "\c2Yeah, yeah, right...";signal casino;end
if xtx>25 then do;transmit "\c3Bet is too large to cover!";signal casino;end
bet=xtx
exe3:
query "\c4\n1Heads\c2 or \c4Tails:\c7[H/T]: \c1"
x=upper(left(result,1))
if x="H" then do;Transmit "\c3Betting on Heads.";x=1;signal toss2;end
if x="T" then do;transmit "\c3Betting on Tails.";x=2;signal toss2;end
if x="#" then signal theend
signal exe3
toss2:
transmit "\c1\s4Up goes the coin....here it comes...\w1\s0"
cx=random(1,100,time('S'))
if cx<50 then win=1
if cx>49 then win=2
if win=1 then Transmit "\c4Heads!"
if win=2 then transmit "\c4Tails!"
if win=x then do;transmit "\c3You won\c7 "bet*2" Gold!";u.20=u.20+bet+bet;end
if win~=x then do;Transmit "\c3You Lost.";u.20=u.20-bet;end
signal casino

execution:
sendfile (DAGPATH||"text/Execution")
transmit "\n1\c3You have: \c7"u.20" Gold"
query "\n1\c4Place your bet[max=500]: "
xtx=result
if left(xtx,1)="#" then signal theend
cx=datatype(xtx,'N')
if cx=0 then signal casino
if xtx>u.20 then do;transmit "\c2You haven't that much gold!";signal casino;end
if xtx<1 then do;transmit "\c2Yeah, yeah, right...";signal casino;end
if xtx>500 then do;transmit "\c3Bet is too large to cover!";signal casino;end
bet=xtx
exe2:
query "\c1\n1How many chops(1-20): \c3"
xtx=result
if left(xtx,1)="#" then signal theend
cx=datatype(xtx,'N')
if cx=0 then signal exe2
if xtx>20 then signal exe2
if xtx<1 then signal exe2
transmit "\n1\c7Ok, you bet "bet" gold that The chicken's head will roll on chop # "xtx"."

chop=xtx
win=0
z1=random(1,20,time('s'));z2=random(1,20,time('s'));z3=random(1,20,time('s'))
transmit "\c1Chicken #1: \c2CHOPPED on \c1#"z1
transmit "\c1Chicekn #2: \c2CHOPPED on \c1#"z2
transmit "\c1Chicken #3: \c2CHOPPED on \c1#"z3
if chop=z1 then win=win+1 
if chop=z2 then win=win+1
if chop=z3 then win=win+1
transmit "\c3You made "win" correct Guesses!"
if win=0 then do;transmit "\c1Sorry you didn't win this time..try again...";u.20=u.20-bet;signal casino;end
x=win*bet
transmit "\c3You won \c7" x " Gold!"
u.20=u.20+x
transmit "\c1(any key)\g0\h9\h1"
signal casino

NumberGuesser:
rannum=random(1,100,time('s'))
transmit "\c1Ok, The Number has Been Chosen."
Transmit "the Range of Numbers is 1-100 ,1 and 100 are Included."
Transmit "\n1\c3Gold: \c7"u.20
query "\c1What is your Bet?<max=50>: "
xtx=result
if upper(left(result,1))="#" then signal theend
cx=datatype(result,'N')
if cx=0 then signal casino
if xtx<1 then signal casino
if xtx>u.20 then do;transmit "\c1You don't have that much!";signal casino;end
if xtx>50 then do;Transmit "\c1We can't cover a Bet that High!";signal casino;end
bet=xtx
numcount=1
Picknum:
query "\c3Try #"numcount": "
xtx=result
if upper(left(result,1))="#" then signal theend
cx=datatype(result,'N')
if cx=0 then signal picknum
if xtx<1 then signal picknum
if xtx<rannum then do;transmit "\c1Number is Higher!";end
if xtx>rannum then do;Transmit "\c1Number is Lower!";end
if xtx=rannum then do;Transmit "\c1You got it!";signal winguess;end
numcount=numcount+1;if numcount=7 then do;Transmit "\c1Too Many Tries!";signal loseguess;end
signal picknum
Winguess:
winnings=bet*2
u.20=u.20+winnings
transmit "\c7You won "winnings" Gold Coins!"
signal casino
loseguess:
u.20=u.20-bet
transmit "\c7You LOST "bet" Gold Coins."
signal casino
OtherPlayers:
Transmit "\f1\c1 Other Players \n1"
call open(ulist,DAGpath||"ULIST","R")
xrrr=0
transmit "\c2Players Name                Class        lev     Race      Located "
transmit "\c1--------------------   ----------------  ---  -----------  ------- "
do until eof(ulist)=1
xrrr=xrrr+1
temp=readln(ulist)
if temp="" then do;call close ulist;return;end
path2=DAGPATH||"users/"||temp
if exists(path2) then do;call open(other,path2,'R');do i=1 to 60;zzn.i=readln(other);end;call close other;end
if zzn.34=1 then oloc="\c4Dungeon "
if zzn.34=2 then oloc="\c4Forest  "
if zzn.34=0 then oloc="\c4Town    "
if zzn.3<0 then  oloc="\c4Hospital"
statline="\c7"||left(temp,20)||"  \c5 "||left(zzn.27,16)||"   "||left(zzn.18,2)||"  \c4"||left(zzn.2,11)||"\c3  "||Oloc
if ~exists(path2) then statline="\c7"||left(temp,20)||"\c3   \c4 Unknown Stats"
if temp="" then do;call close ulist;transmit "\n1";return;end
if temp~="" then do;transmit statline;end
end
call close ulist
transmit "\n1"
call cleanupzzn
return

INN:
Transmit "\f1\c1Blue Belly Inn!\n1"
Transmit "\c3<S>\c7tay the Night"
transmit "\c3<Q>\c7uit to Town"
query "\n1\c1Choice: "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="Q" then signal DoubleDaggers
if xtx="S" then call staynight
signal inn
Staynight:
Transmit "\n1\c5It costs 50 Gold coins to stay the night."
query "\c1Do you pay the 50? "
xtx=upper(left(Result,1))
if xtx="#" then signal theend
if xtx="N" then signal inn
if xtx="Y" then signal Staynightyes
signal staynight
staynightyes:
if u.20<50 then do;transmit "\c1Insufficient Gold!";signal inn;end
u.20=u.20-50;transmit "\c1You hand the Innkeeper 50 Gold Coins."
transmit "\c3He shows you to your room."
sendstring "\n1\c1Sleeping...Evening\w2";u.3=u.4;u.5=u.6
sendstring "\h7Night\w2"
sendstring "\h5Midnight\w2"
sendstring "\h8Dawn\w2"
sendstring "\h4Morning\w2"
transmit "\n1\c7You awaken, Feeling Fully Refreshed!"
signal doubledaggers

randomgold:
gp=random(1,10,time('s'))
return

BROTHEL:
Transmit "\f1\c1The House of Pleasures.\n1"
loadGIRLS:
filename=DAGPATH||"text/girlslist"
call open(Girls,filename,'R')
aa=0
do until eof(girls)
aa=aa+1
girlkey.aa=readln(girls)
girlname.aa=readln(girls)
girltext.aa=readln(girls)
girldis.aa=readln(girls)
girlcost.aa=readln(girls)
end
maxgirls=aa-1
call close girls
Displaychicks:
transmit "\s2\c3You Enter a Room, lit by a Few candles..."
transmit "seated in the room are Some scantly Clothed People..."
Transmit "\s0\n1\c1Take your Pick!"
do i = 1 to maxgirls
transmit "\2<"girlkey.i">\c1 "left(girlname.i,20)"\c4 Cost:\c7 "girlcost.i
end
choosechick:
Transmit "\n1\c1 Enter 0 to Leave.."
query "\c7Who might Yea be Interested in? "
xtx=Upper(left(result,1))
if xtx="#" then signal theend
if xtx="0" then do;call cleanupgirls;signal Doubledaggers;end
do z=1 to maxgirls
if xtx=girlkey.z then do;signal checkoutchick;end
end
Transmit "\c1\n1Sorry I don't see anyone by that name.."
signal brothel
checkoutchick:
Transmit "\n1\c1Ahh. You chose "girlname.z
Transmit "\c3\n1\s1"girlname.z" Stands up and walks towards you.. "
Transmit "\c7Hello there, for the Pleasures of my Body, it will cost you "girlcost.z" Gold Coins."
query "\n1\c1Are you still Interested in me? "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="Y" then signal BUYCHICK
transmit "\c3Sorry, I don't work for peanuts."
signal brothel
buychick:
if girlcost.z>u.20 then do;transmit "\s0Hey, You don't have Enough Money!!!";signal doubledaggers;end
u.20=u.20-girlcost.z
Transmit "\c1\n2You hand "girlname.z" "girlcost.z" Gold Coins.."
sendfile (girltext.z)
transmit "\c1(any key)\g0\h9"
if girldis.z~="0" then do;transmit "You caught some Sort of Disease...";dis=girldis.z;call diseasecrap;end
call cleanupgirls;signal doubledaggers 
diseasecrap:
u.23=dis
if dis="1" then Transmit "You are A carrier of Hendrixia."
if dis="2" then transmit "You have a common Cold." 
if dis="3" then transmit "You Have Toximilous."
if dis="4" then trasnmit "You have Astenian Fever."
return

BANK:
transmit "\c1(any key)\g0\h9\f1The Red Roof Bank\n1"
Transmit "\c2<C>heck Balance"
transmit "\c2<D>epoit"
transmit "\c2<W>ithdraw"
transmit "\c2<Q>uit to Town"
query "\n1\c1Bank Cmd: "
xtx=upper(left(Result,1))
if xtx="#" then signal theend
if xtx="C" then do;Transmit "\n1\c1Your Account Balance is "u.21;signal bank;end
if xtx="Q" then signal doubledaggers
if xtx="D" then signal bankdeposit
if xtx="W" then signal banktake
Signal Bank
bankdeposit:
Transmit "\c7\n1\r1 Deposit \r0"
transmit "\c3You have "u.20" Gold Coins in Hand."
query "\c1\n1Deposit How Much? "
xtx=result
if xtx="" then signal bank
if upper(left(result,1))="#" then signal theend
if datatype(xtx,'N')=0 then signal deposit
if xtx<1 then signal bank
if xtx>u.20 then do;Transmit "\c1You haven't that MUCH!!!";signal bank;end
u.20=u.20-xtx;u.21=u.21+xtx
transmit "\c1You deposit "xtx" Gold Coins."
signal bank
banktake:
transmit "\c7\n1\r1 WithDraw \r0"
transmit "\c3You have "u.21" Gold Coins in the Bank."
query "\c1\n1WithDraw How Much? "
xtx=result
if xtx="" then signal bank
if upper(left(result,1))="#" then signal theend
if datatype(xtx,'N') =0 then signal banktake
if xtx<1 then signal bank
if xtx>u.21 then do;transmit "\c1You haven't that much!!!";signal bank;end
u.20=u.20+xtx;u.21=u.21-xtx
transmit "\c1You withdrew "xtx" Gold Coins."
signal bank

GROCER:
transmit "\c1(any key)\g0\h9"
transmit "\f1\c1Arnies Food Goods"
transmit "\c2----------------------->"
transmit "\c1<B> \c2Buy Food     "
transmit "\c1<Q> \c2Exit to Town "
query "\n1\c1Choice:\c3 "
txx = upper(left(result,1))
if txx="Q" then signal DoubleDaggers
if txx="#" then signal theend
if txx="B" then signal BUYFOOD
signal grocer
BUYFOOD:
bufferflush
transmit "\c3The Going Price is "FoodCost" Gold / Ration"
Query "\c1Buy How Many? \c4"
fb=result
if fb=0 then signal grocer
if fb="#" then signal theend
ck=datatype(fb,'N')
if ck=0 then signal buyfood
if fb<1 then signal buyfood
if fb*foodcost>u.20 then do;transmit "You don't have enough Gold!";signal grocer;end
cost=fb*foodcost
u.20=u.20-cost;transmit "\c1You hand Arnie "cost" Gold Coins and he gives you a Sack of Food."
u.37=u.37+fb
signal grocer

SPELLLIST:
if u.45=0 then do;transmit "\c1Members of your Profession CanNOT cast spells.";return;end
transmit "\f1\c1Which of your Spell books do you wish to open?\n1 "
transmit "\c3[H]\c7 Book of Healing "
transmit "\c3[C]\c7 Book of Combat"
transmit "\c3[M]\c7 Book of All Else"
Sendstring "\n1\c2Enter Choice: \c1:";getchar
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="H" then do;transmit "Healing";sptype=2;signal spelllist2;end
if xtx="C" then do;transmit "Combat!";sptype=1;signal spelllist2;end
if xtx="M" then do;transmit "Miscellaneous";sptype=3;signal spelllist2;end
Transmit "None"
signal gohome
spelllist2:
Transmit "\f1\c1Opening Spellbook..."
Spellpath=DAGPATH||"text/SpellList"
call open(spells,spellpath,'R')
i=0
do until eof(spells)
i=i+1
spellkey.i = readln(spells)
spellname.i=readln(spells)
spellcastpath.i=readln(Spells)
mananeed.i=readln(spells)
spellaction.i=readln(spells)
end
maxspell=i-1
call close spells
Transmit "\c1 Spells You have Enough Points to Cast...\n2"
Transmit "\c7\r1  #    Mana   Type        Spell Name    \r0"
transmit "\c3----- ------ ------- -------------------"
do r=1 to maxspell
if (u.5+1)> mananeed.r & spellaction.r=sptype then do;Sendstring "\c1("left(spellkey.r,3)")  "left(mananeed.r,5)"\c4 ";end
if spellaction.r=1 & (U.5+1)>mananeed.r & spellaction.r=sptype then sendstring "Combat "
if spellaction.r=2 & (u.5+1)>mananeed.r & spellaction.r=sptype then sendstring "Healing"
if spellaction.r=3 & (u.5+1)>mananeed.r & spellaction.r=sptype then sendstring "Unknown"
if (u.5+1)>mananeed.r & Spellaction.r=sptype then transmit "\c7  "left(spellname.r,20)
end
transmit "\c3----------------------------------------"
bufferflush
Query "\c7\n1Cast Which Spell?<0=none> ";xtx=""
veri=result
xtx=upper(left(veri,2))
xxtx=upper(left(veri,1))
if xxtx="#" then signal theend
if xxtx="0" then do;transmit "\n1\c1Putting away spell book";return;end
do v=1 to maxspell
if xtx=spellkey.v then signal Castit
end
transmit "\c1I don't know any spell by that name."
return
Castit:
if spellaction.v=2 & U.49~="1" then do;transmit "\c1You cannot cast Healing Spells!";return;end
if spellaction.v=1 & U.50~="1" then do;Transmit "\c1You cannot Cast Combat Spells!";return;end
if mananeed.v>u.5 then do;transmit "\c1Not enough Spell Points!";return;end
u.5=u.5-mananeed.v
if u.5<1 then u.5=0
if spellfails=1 & Clloc=1 then do;Transmit "\c1The Walls of the Room Absorb the Spell";return;end
if spellfails=1 & clloc=2 then do;Transmit "\c1The Air Around you Absorbs the spell!";return;end
if spellfails=1 & clloc=0 then do;Transmit "\c1The Air around you Absorbs the Spell!";return;end
call close cast
call open(cast,spellcastpath.v,'R')
do until eof(cast)=1
interpret readln(cast)
end
call close cast
call cleanupspells
return

TAVERN:
transmit "\c1Black Dragon Tavern.. \n1"
pat.1=random(1,maxpatrons,time('s'))
Locflow1:
pat.2=random(1,maxpatrons,time('s'))
if pat.2=pat.1 then signal locflow1
Tavernpath=DAGPATH||"patrons/"
tavernpath1=tavernpath||"Patron."||pat.1
tavernpath2=Tavernpath||"Patron."||Pat.2
CALL open(tales1,tavernpath1,'R')
do i=1 to 7;patron1.i=readln(tales1);end
call close tales1
call open(tales2,tavernpath2,'R')
do i=1 to 7;patron2.i=readln(tales2);end
call close tales2
Transmit "\c1\s1You Enter into a Smoke Filled Room..."
transmit "In here now are Two Other People..."
Transmit patron1.1" is seated with "patron2.1
Transmit "\n1\c3The Bartender Greets you 'HEY "handle", what'll it be Today?'\s0"
tavern2:
Query "\n1\c7Tavern:[?]Menu: "
xtx=upper(left(Result,1))
if xtx="#" then signal theend
if xtx="?" then do;Transmit "\n1\c1 Tavern Menu \n2\c7\r1[H]\r0 Tavern Help\n1\c7\r1[A]\r0ttempt to Pickpocket Someone\n1\r1[T]\r0alk to Patron\n1\r1[B]\r0uy a Drink\n1\r1[Q]\r0uit to Town";end
if xtx="B" then signal buydrink
if xtx="A" then signal pickpocket
if xtx="T" then signal patrontalk
if xtx="Q" then do;call cleanuppatrons;signal doubledaggers;end
if xtx="H" then signal Tavernhelp
signal tavern2
TavernHelp:
Transmit "\c1Conversing with Patrons...\n1\c3 The Patron will tell you something, When the patron finishes"
transmit "it will say \c1Questions?\c3 At that point, you may type ONE(1) Word"
transmit "they will respond to Two(2) Keywords from what is in the conversation"
transmit "they had with you.. Such as "
transmit "\c7Hey Dude.. I love Beer and Women"
transmit "\c3Keyword1 might be BEER and keyword 2 might be WOMEN"
transmit "after typing in that one word, they will tell you more."
Transmit "\c1The 3rd word they understand is BYE..which means you are going"
transmit "back to what you were doing before you decided to come over to see them."
transmit "\c1\n1(any key)\g0\h9"
signal tavern2
pickpocket:
Transmit "\c1\n1You walk up to an Unsuspecting Patron...\w1"
Transmit "\c3You Carefully...\w1Stick your hand in thier Purse...\w1"
chance=random(1,100,time('s'))
if u.46=0 then Transmit "\c2You got Caught!!!";signal CatchThief;end
if chance>u.39 then do;Transmit "\c2You got Caught!!!";signal Catchthief;end
call randomgold
transmit "\c7You Manage to get "gp" Coins!";u.20=u.20+gp
signal tavern2
CatchThief:
transmit "\c3\s1The Bartender Grabs the back of your head and slams it into the Wall"
Transmit "\c2You stand up dazed... He Nearly Breaks your Hand as he Grabs it and Twists.."
transmit "\c1GET OUT!!! and Don't Come back!\s0"
signal doubledaggers
BuyDrink:
Transmit "\c1The Bartender Gives you a Drinks Menu\n1\c3"
transmit "\r1         Drinks Menu     \r0"
transmit "-------------------------\c1"
transmit "(1) Beer          2 Coins"
transmit "(2) Ale           5 Coins"
transmit "(3) Wine          7 Coins"
transmit "(4) Bloody Mary  30 Coins"
query "\n1\c3Order what? (0=Nothing): "
xtx=Upper(left(result,1))
if xtx="#" then signal theend
if xtx="1" then signal BuyBeer
if xtx="2" then signal buyale
if xtx="3" then signal buywine
if xtx="4" then signal Bloodymary
if xtx="0" then signal tavern
signal buydrink
BuyBeer:
transmit "\c1The cost is 2 coins..";if u.20<2 then do;transmit "Get out!";signal doubledaggers;end
transmit "\c2The bartender hands you a Beer, You give him 2 coins.";u.20=u.20-2
Transmit "\c3After drinking your beer, you Feel Refreshed.."
signal tavern2
Buyale:
Transmit "\c1The cost is 5 coins..";if u.20<5 then do;transmit "Get out!";signal doubledaggers;end
Transmit "\c2The Bartnder hands you a Frosty Mug of Ale, you give him 5 coins.";u.20=u.20-5
Transmit "\c3Ahh.. The Good Life, you sit back and drink your Ale."
signal tavern2
buyWine:
transmit "\c1The cost is 7 Coins..";if u.20<7 then do;transmit "Get out!";signal doubledaggers;end
transmit "\c2the Bartender hands you a Glass of Wine, you give him 7 Coins."
transmit "\c3You Tantalize your senses as you Gingerly Sip your Wine."
signal tavern2
bloodymary:
Transmit "\c1The Cost is 30 Coins..";if u.20<30 then do;Transmit "Get out!";signal doubledaggers;end
Transmit "\c4You hand the Bartender 30 Coins.\w1He goes into the backroom.."
transmit "\w1\c2You hear a Girl Screaming....\w1"
transmit "He Comes back out with a Glass of Red liquid..pours some Rum into it and hands it to ya.."
Transmit "\c3You Sit back and drink your Pleasure..\w1The Liquid is Still Warm..Ahh.. so nice."
signal tavern2
Patrontalk:
Transmit "\n1\c3(1) "patron1.1", "patron1.3
transmit "\c3(2) "Patron2.1", "patron2.3
query "\n1\c7Who do you want to talk to?(0=Exit): "
xtx=upper(Left(result,1))
if xtx="#" then signal theend
if xtx="0" then signal tavern2
if xtx="1" then do i=1 to 7;patty.i=Patron1.i;end
if xtx="2" then do i=1 to 7;patty.i=patron2.i;end
if xtx="1" then signal patrontalk2
if xtx="2" then signal patrontalk2
signal patrontalk
patrontalk2:
Transmit "\f1\c1You go over and Talk to "patty.1
Transmit "\n1\c3"Patty.1" returns the conversation."
sendfile (patty.2)
Transmit "\n1\c1Enter "BYE" to Leave"
Quiver:
Query "\n1\c3Response:\c1 "
xtx=upper(Result)
if left(xtx,1)="#" then signal theend
if left(xtx,3)="BYE" then do;Transmit "\c3See Ya Around "handle;signal tavern2;end
if xtx=patty.4 then sendfile (patty.6)
if xtx=Patty.5 then sendfile (Patty.7)
if xtx="###PANIC" then signal theend
signal quiver

SUPPLIES:
transmit "\c1(any key)\g0\h9\f1"
Transmit "\c1Supply Depot. "
transmit "\c2-------------------->"
transmit "\c1<T>\c3 Buy Torches"
transmit "\c1<M>\c3 Buy Matches"
transmit "\c1<R>\c3 Buy Rope"
Transmit "\c1<P>\c3 Buy Thieves Tools"
transmit "\c1<L>\c3 Buy a Lantern"
Transmit "\c1<O>\c3 Buy Oil for Lantern"
transmit "\c1<Q>\c4 Quit to Town"
query "\c1\n1Choice: "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="T" then signal buytorches
if xtx="M" then signal Buymatches
if xtx="Q" then signal doubledaggers
if xtx="R" then signal BUYROPE
if xtx="P" then signal BUYPICKS
if xtx="L" then signal BuyLantern
if xtx="O" then signal BuyOil
signal supplies

buylantern:
Transmit "\c1A Lantern Goes for 1000 Gold!"
query "\n1\c3Do you wish to buy one? "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="Y" then signal payforlantern
signal supplies
payforlantern:
if u.20<1000 then do;transmit "\c1Insufficient Funds!";signal supplies;end
u.20=u.20-100;transmit "\n1\c3You hand the Fellow 1000 Gold Coins."
u.30=1;transmit "\c7He hands you a Nice New Lantern!"
signal supplies

buyOil:
transmit "\c1Oil Costs "OilCost" Gold per Unit."
query "\c7Buy How many Units?\c2 "
xtx=result
ck=datatype(xtx,'N')
if ck=0 then signal buyoil
if xtx<1 then signal supplies
if xtx="#" then signal theend
cost=xtx*oilcost
if cost>u.20 then do;transmit "\c1Insufficient Funds!";signal supplies;end
u.31=u.31+xtx;transmit "\c3He Fills a Skin with "xtx" Units of Oil."
u.20=u.20-cost;Transmit "\c7deducted "cost" Gold."
signal supplies

buyrope:
Transmit "\c1Rope goes for $100."
query "\n1\c3Do you wish to buy one? "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="Y" then signal payforrope
signal supplies
payforrope:
if u.20<100 then do;transmit "\c1Insufficient Funds!";signal supplies;end
u.20=u.20-100;transmit "\n1\c3You hand the Fellow 100 Gold Coins."
u.42=1;transmit "\c7He hands you a 50' Rope."
signal supplies

buypicks:
transmit "\c1Thieves Picks & Tools Go for $150"
query "\n1\c3Do you wish to buy a set? "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="Y" then signal payforpicks
signal supplies
payforpicks:
if u.20<150 then do;transmit "\c1Insufficient Funds!";signal supplies;end
u.20=u.20-150;transmit "\n1\c3You hand the Guy 150 Gold Coins."
u.43=1;transmit "\c7He hands you a Nice New Set of Thieves Tools."
signal supplies

BUYTORCHES:
Transmit "\c1Torches cost "TorchCost" Gold Each."
query "\c7How Many do you wish to buy? "
xtx=result
ck=datatype(xtx,'N')
if ck=0 then signal buytorches
if xtx<1 then signal supplies
if xtx="#" then signal theend
if xtx*TorchCost>u.20 then do;Transmit "\c1Insufficient Funds!";signal Supplies;end
u.20=u.20-(xtx*torchcost);transmit xtx*torchcost "\c7 Gold Deducted."
u.28=u.28+xtx;Transmit "\c3He hands you "xtx" Torches."
signal supplies

BUYMATCHES:
transmit "\c1Matches Cost 1 Gold Each."
query "\c7How Many do you wish to buy? "
xtx=result
ck=datatype(xtx,'N')
if ck=0 then signal buymatches
if xtx<1 then signal supplies
if xtx="#" then signal theend
if xtx>u.20 then do;transmit "\c1Insufficient Funds!";signal supplies;end
u.29=u.29+xtx;transmit "\c3He hands you "xtx" Matches."
u.20=u.20-xtx;Transmit "\c7deducted "xtx" Gold."
signal supplies

MONSTERFIND:
realchar=0
rum=random(1,maxmonsters,time('s'))
filepath=monsterpath||"Monster."||rum
call open(monster,filepath,"R")
do i=1 to 14;monster.i=readln(monster);end
call close monster
DISPLAYMONSTER:
DIST=30
if clloc=1 then Transmit "\c1From out of the Shadows it Moves..:\c2 "
if clloc=2 then transmit "\c1Stepping out into your Path, you see...:\c2 "
if clloc=0 then transmit "\c1The Enemy Steps forth...: \c2"
Transmit  monster.10
call fixplayer3
transmit " "
signal fight
fight:
fr=1
pnam=u.12;ppow=u.14;psdc=u.16;ptyp=u.58;pdes=u.61
yourchancetohit=(u.7-15)+(u.9-15)+ppow-monster.3
hischancetohit=(1+monster.6)+1-u.15
rum1=random(1,10,time('s'))
rum2=random(1,10,time('s'))
yourchancetohit=yourchancetohit+rum1
hischancetohit=hischancetohit+rum2
fight2:
Transmit "\n1\c3Distance--->:\c7 "dist
sendstring "\c3Combat type :\c7 "
if dist=10 then transmit "Any";else transmit "Ranged Only!"
sendstring "\n1\c3Fight Cmd:\c2[?]:\c1 "
getchar
xtx=upper(left(result,1))
if xtx="&" then do;Transmit "Use Magic Item";signal usemagic;end
if xtx="?" then do;Transmit "Menu";call fightmenu;end
if xtx="#" then signal Theend
if xtx="Y" then do;transmit "Your Status.";call quickstats;end
if xtx="A" then do;Transmit "Attack.";signal Attack;end
if xtx="D" then do;Transmit "Drink Healing.";call Drinkhealing;signal monsterattack;end
if xtx="C" then do;Transmit "Cast Spell.";Ft=1;call spelllist;signal checkmonstershit;end
if xtx="E" then do;transmit "Drink Mind-Elixer";call drinkelixer;signal monsterattack;end
if xtx="+" then do;Transmit "Advance!";signal advance;end
if xtx="-" then do;transmit "Retreat!";signal retreat;end
if xtx="W" then do;transmit "Wait.";signal monsterattack;end
if xtx="P" then do;Transmit "Pull out "u.24;call changeweapons;signal monsterattack;end
signal fight2

changeweapons:
if u.24=0 then do;Transmit "\c2No Secondary Weapon!";return;end
if u.24="None" then do;Transmit "\c2No Secondary Weapon!";return;end
if u.24="Hands" then do;transmit "\c2No Secondary Weapon!";return;end
Transmit "\n1\c7Putting "u.12" Away."
temp1=u.12;temp2=u.14;temp3=u.16;temp4=u.58
u.12=u.24;u.14=u.25;u.16=u.26;u.58=u.52
u.24=temp1;u.25=temp2;u.26=temp3;u.52=temp4
call fixplayer3
pnam=u.12;ppow=u.14;psdc=u.16;ptyp=u.58;pdes=u.61
transmit "\n1\c7Pulling out "u.12"."
return

fightmenu:
Transmit "\c1\r1 Fight Commands\c1\r0\n1"
transmit "\c3\r1[A]\r0\c5 Attack with "pnam
transmit "\c3\r1[D]\r0\c5 Drink Healing Potion"
transmit "\c3\r1[E]\r0\c5 Drink Mind Elixer"
transmit "\c3\r1[C]\r0\c5 Cast A Spell  "
transmit "\c3\r1[Y]\r0\c5 Your Status"
transmit "\c3\r1[+]\r0\c5 Advance "
transmit "\c3\r1[-]\r0\c5 Retreat!"
transmit "\c3\r1[W]\r0\c5 Wait..."
transmit "\c3\r1[P]\r0\c5 Pull out "u.24
transmit "\c3\r1[&]\r0\c5 Use Magic Item"
return

Advance:
if dist=10 then do;Transmit "\c1You are as close as you can get!";signal monsterattack;end
dist=dist-10
if dist<10 then do;dist=10;end
transmit "\c1You Advance Towards your Foe!"
signal monsterattack

Retreat:
dist=dist+10
if dist>60 then do;transmit "\c1You've Completely Retreated!";fr=0;signal gohome;end
else transmit "\c1You are Retreating..."
signal monsterattack

Drinkhealing:
if u.35<1 then do;transmit "\c7You have no Healing Potions!";return;end
u.35=u.35-1;transmit "\c1You Slug down a Potion..."
ef=random(4,7,time('s'))
ww=u.3+ef
if ww>u.4 then do;Transmit "\c1You are Totally Healed of All Wounds.";u.3=u.4;end
if ww<u.4 then do;Transmit "\c1You heal "ef" Points";u.3=u.3+ef;end
if ww=u.4 then do;transmit "\c1You are Totally Healed of All Wounds.";u.3=u.4;end
return
DrinkElixer:
if u.48<1 then do;transmit "\c7You have No Mind Elixers!";return;end
u.48=u.48-1;transmit "\c1You Slug down an Elixer..."
ef=random(5,10,time('s'))
ww=u.5+ef
if ww>u.6 then do;Transmit "\c1Your Mind is Totally Restored.";u.5=u.6;end
if ww<u.6 then do;transmit "\c1You Regain "ef" Spell Points.";u.5=u.5+ef;end
if ww=u.6 then do;transmit "\c1Your Mind is Totally Restored.";u.5=u.6;end
return

attack:
attack1:
if dist>10 & ptyp=3 then signal attack3
if dist>10 & ptyp=4 then signal attack3
if dist=10 then signal attack3
Transmit "\c1You are too far away!"
signal monsterattack
attack3:
if ptyp<3|ptyp>4 then do;Transmit "\c7You Swing with your "pnam;end
if ptyp=3 then do;Transmit "\c7You Fire at "monster.1" With your "pnam;end
if ptyp=4 then do;Transmit "\c7Vapors Blast forth from your "pnam".";end
hit=random(1,10,time('s'))
dmg=random(1,5,time('s'))
dmg=dmg+ppow
if hit<yourchancetohit then do;transmit "\c1You hit the \r1 "monster.1" \r0 for "dmg " Points!";monster.14=monster.14-dmg;end
if hit>yourchancetohit then do;transmit "\c1You Missed!";end
if monster.7>0 then if hit=yourchancetohit then do;transmit "\c1You hit his Armor!\n1Damaging it.";monster.4=monster.4-dmg;if monster.4=0 then do;transmit "\c4His Armor is Destroyed!";monster.2="None";monster.3=0;monster.4=0;end;end
if monster.7<1 then if hit=yourchancetohit then do;transmit "\c1You hit the \r1 "monster.1" \r0 for "dmg " Points!";monster.14=monster.14-dmg;end
checkmonstershit:
if monster.14<1 then do;call gore;signal takeweapon;end
signal monsterattack

Gore:
u.19=u.19+monster.13
m=length(monster.1)
r=random(1,maxgore,time('s'))
temp=gore.r
old = gore.r
x=pos("%m",temp)
if x~=0 then do
temp2 = delstr(temp,x,2)
old = insert(monster.1,temp2,x-1,m," ")
end
transmit old
return

takeweapon:
if monster.9=0 then do;Transmit "He has no weapon for you to take.";signal takeweapon2;end
query "\c1Do you wish to take his "monster.5"? "
xtx=upper(left(result,1))
if xtx~="Y" then signal takeweapon2
query "\c1\n1Put Weapon in [P]rimary or [S]econdary Spot or [F]orget it:\c3 "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="P" then do;u.12=monster.5;u.14=monster.6;u.16=monster.7;u.58=monster.11;transmit "\c7You drop your Weapon and take his.";call fixplayer3;end
if xtx="S" then do;u.24=monster.5;u.25=monster.6;u.26=monster.7;u.52=monster.11;transmit "\c7You drop your Weapon and Take his.";call fixplayer3;end
takeweapon2:
pnam=u.12;ppow=u.14;psdc=u.16;ptyp=u.58;pdes=u.61
if monster.12=0 then do;transmit "he has no treasure...";signal takewep3;end
if monster.12>0 then do;transmit "\c1 the "monster.1" had \c7"monster.12" Gold Coins.\n1\c3You take them.";u.20=u.20+monster.12
call gettres;end
takewep3:
if realchar=1 then signal saveenemycharacter
call cleanupmonster;call cleanupenmon
fr=0
zz=random(1,100,time('s'))
if zz>7 & zz<14 then signal loadfoundmagic
signal gohome

gettres:
x=random(1,maxtreasures,time('s'))
cash=random(1,20,time('s'));u.20=u.20+cash
transmit "\c1You also find \c3"tres.x"\c1 which is worth \c7"cash" gold!"
return

monsterattack:
if dist>10 & monster.11=3 then signal monsterattack2
if dist>10 & monster.11=4 then signal monsterattack2
if dist=10 then signal monsterattack2
signal monsteris
monsterattack2:
if monster.11<3|monster.11>4 then do;Transmit "\c1The "monster.1" Attacks with its "monster.5;end
if monster.11=3 then do;Transmit "\c1The "Monster.1" Shoots at you!";end
if monster.11=4 then do;Transmit "\c1The "monster.1" Breaths at You!";end
hit=random(1,10,time('s'))
dmg=random(1,5,time('s'))
dmg=dmg+monster.6
if hit<hischancetohit then do;transmit "\c1You were hit for "dmg" points!";u.3=u.3-dmg;end            
if hit>hischancetohit then do;transmit "\c1He missed!";end
if u.17>0 then if hit=hischancetohit then do;Transmit "\c1He hit your Armor!\n1Damaging it.";u.17=u.17-dmg;if u.17<1 then do;transmit "\c3Your Armor was Destroyed!";u.13="None";u.15=0;u.17=0;end;end                 
if u.17<1 then if hit=hischancetohit then do;transmit "\c1You were hit for "dmg " points!";u.3=u.3-dmg;end
if u.3<1 then do;Transmit "\c2***You were killed by the "monster.1;signal characterdies;end
if hit=hischancetohit & monster.11=5 then do;Transmit "\c2Extreme Pain...Arrrghh.";u.22=1;end
signal fight

monsteris:
rv=random(1,10,time('s'))
if rv=5 & dist>10 then Do;dist=dist-10;transmit "\c1The "monster.1" Advances!";signal fight2;end
if rv=1 & dist>10 then Do;dist=dist-10;transmit "\c1The "monster.1" Advances!";signal fight2;end
if rv=3 then do;dist=dist+10;transmit "\c1The "monster.1" is Reatreating!";signal fight2;end
if rv=4 & dist>10 then Do;dist=dist-10;transmit "\c1The "monster.1" Advances!";signal fight2;end
if dist>60 then do;transmit "\c1The "monster.1" Escapes!";fr=0;signal gohome;end
Transmit "\c1The "monster.1" Is Waiting..."
signal fight2


signal monsterattack2

MAGICSHOP:
az=0
Transmit "\c1(any key)\g0\h9\f1"
transmit "Elegir's Magic Shoppe\c3"
transmit "----------------------->\n1\c4"
transmit "\c3[Q]\c4 Quit to Town "
transmit "\c3[H]\c4 Healing Potions"
Transmit "\c3[M]\c4 Mind Elixers"
Transmit "\c3[S]\c4 Magic Items "
Query "\n1\c1Choice: "
xtx=upper(left(result,1))
if xtx="Q" then do;az=0;signal doubledaggers;end
if xtx="H" then signal buypotions
if xtx="M" then signal BuyMindElixer
if xtx="S" then signal BuyScrolls
signal magicshop
BuyScrolls:
Transmit "\f1\r1\c2 These are what Magic Items we Sell \r0\n1"
transmit "\c1[1]\c3 Scroll of Cure Blindness "
transmit "\c1[2]\c3 Scroll of Cure Disease   "
transmit "\c1[3]\c3 Scroll of Cure Poison"
transmit "\c1[4]\c3 Gem of Light "
transmit "\c1[5]\c3 Scroll of Fire Blast"
transmit "\c1[6]\c3 Wand of Stars"
transmit "\c1[7]\c3 Ring of Ice "
transmit "\c7[-]\c4Return to Previous Menu "
transmit "\n1\c4Items cost 200 gp / Charge!"
query "\n1\c2Your choice:\c7 "
xtx=upper(left(Result,1))
if xtx="#" then signal theend
if xtx="1"|xtx="2"|xtx="3"|xtx="4"|xtx="5"|xtx="6"|xtx="7" then signal buymagicitem
if xtx="-" then signal magicshop
signal buyscrolls

BuyMagicItem:
az=1
zxz=xtx
if datatype(zxz,'N')=0 then do;az=0;signal buyScrolls;end
query "\c4How Many charges?(200gp/Charge):\c1 "
xtx=Result
if datatype(xtx,'N')=0 then do;az=0;signal buyscrolls;end
if xtx<1 | xtx>25 then do;transmit "\c2Max 25,Min 1 Charge Permissive.";az=0;signal buyscrolls;end
cost=200*xtx
if cost>u.20 then do;Transmit "\c1You haven't that much Gold!";signal magicShop;signal findmagic;end
u.20=u.20-cost
if zxz="1" then do;fm.1="Scroll of Cure Blindness";fm.2=Dagpath||"Maction/SCureBlind";fm.3="0";fm.4="0";fm.5=zxz;fm.6="0";signal findmagic;end
if zxz="2" then do;fm.1="Scroll of Cure Disease";fm.2=Dagpath||"Maction/SCureDisease";fm.3="0";fm.4="0";fm.5=zxz;fm.6="0";signal findmagic;end
if zxz="3" then do;fm.1="Scroll of Cure Poison";fm.2=Dagpath||"Maction/SCurePoison";fm.3="0";fm.4="0";fm.5=zxz;fm.6="0";signal findmagic;end
if zxz="4" then do;fm.1="Gem of Light";fm.2=Dagpath||"Maction/GemOfLight";fm.3="0";fm.4="0";fm.5=zxz;fm.6="0";signal findmagic;end
if zxz="5" then do;fm.1="Scroll of Fire Blast";fm.2=Dagpath||"Maction/SFireBlast";fm.3="0";fm.4="0";fm.5=zxz;fm.6="0";signal findmagic;end
if zxz="6" then do;fm.1="Wand of Stars";fm.2=Dagpath||"Maction/WandOfStars";fm.3="0";fm.4="0";fm.5=zxz;fm.6="0";signal findmagic;end
if zxz="7" then do;fm.1="Ring of Ice";m.2=Dagpath||"Maction/RingOfIce";fm.3="0";fm.4="0";fm.5=zxz;fm.6="0";signal findmagic;end
az=0
signal buyscrolls


BuyMindElixer:
Transmit "\r1\c6 Mind Elixers \r0"
Transmit "\c1\n1The Going Price is "ElixerCost" Gold per Elixer."
query "\n1\c4Buy How many Elixers?\c1 "
xtx=result
ck=datatype(xtx,'N')
if ck=0 then signal magicshop
if xtx<1 then signal magicshop
cost=(xtx*elixercost)
if cost>u.20 then do;Transmit "\c1Insufficient Funds!";signal Magicshop;end
u.20=u.20-cost;transmit "\c3You buy "xtx" Elixers."
u.48=u.48+xtx;transmit "\c5You hand him \c7"cost" Gold Coins."
signal magicshop
buypotions:
Transmit "\r1\c6 Healing Potions \r0"
transmit "\c1\n1The Going Price is "HealPcost" Gold per Potion."
Query "\n1\c4Buy how many potions? "
xtx=result
ck=datatype(xtx,'N')
if ck=0 then signal magicshop
if xtx<1 then signal magicshop
cost=(xtx*healpcost)
if cost>u.20 then do;transmit "\c1Insufficient Funds!";signal magicshop;end
u.20=u.20-cost;transmit "\c3You Buy "xtx" Potions."
u.35=u.35+xtx;transmit "\c5You hand Him \c7"cost" Gold Coins."
signal magicshop

TRAINING:
Transmit "\c1(any key)\g0\h9\f1Training Guild...\n1"
if u.19<u.47 then do;transmit "\c1You need to be More Experienced.";signal doubledaggers;end
u.19=u.19-u.47
Transmit "\c1Raising you 1 Level!\n1"
transmit "\c4Raising Hitpoints"
hpbonus=random(1,5,time('s'))
u.18=u.18+1
transmit "\c4Raising Spellpower if so needed..."
u.3=u.3+hpbonus;u.4=u.4+hpbonus
if u.45=1 then do
spbonus=random(1,5,time('s'))
u.5=u.5+spbonus
u.6=u.6+spbonus
end
transmit "\c4Raising Thieving abilities if so needed..."
b1=random(1,5,time('s'));b2=random(1,5,time('s'));b3=random(1,5,time('s'));b4=random(1,5,time('s'))
if u.46=1 then do;u.39=u.39+b1;u.40=u.40+b2;u.41=u.41+b3;u.44=u.44+b4;end
if u.46=1 & u.45=0 then do;stbon=random(1,3,time('s'));u.7=u.7+stbon;end
if u.7>30 then u.7=30
transmit "\c4Raising Physical/mental Attributes..."
if u.46=1 then do;u.9=u.9+1;end
if u.45=1 then do;u.8=u.8+1;end
if u.45=0 & u.46=0 then do;u.7=u.7+1;end
temp=u.47+u.47
u.47=temp
transmit "\c1You now need "u.47" experience for next level!\n1"
Transmit "\w1\c7Your Training is Complete, Appropriate Stats Raised."
signal doubledaggers

enemycharacter:
Realchar=1
if ~exists(dhabi) then do;fr=0;signal gohome;end
call open(dload,dhabi,'R')
do i=1 to 14;monster.i=readln(dload);end
call close dload
if monster.1=Handle then do;call cleanupmonster;fr=0;signal gohome;end
namen=monster.1
call checkexist
if exis=1 then do
enemystatspot=DAGPATH||"users/"||monster.1
if ~exists(enemystatspot) then do;Transmit "\c1They Run From you.";fr=0;signal gohome;end
call open(enmon,enemystatspot,'R')
do i=1 to 60;en.i=readln(enmon);end
call close enmon
end
call displaymonster

gohome:
if az=1 then signal magicshop
if fr=1 then signal CheckMonsterShit
if tinkering=1 then do;tinkering=0;call killitem;end
if clloc=1 then signal dungeon2
if clloc=2 then signal forest2
if clloc=0 then signal town2
signal doubledaggers

SaveenemyCharacter:
sendstring "Saving Enemy!"
call open(enmon,dhabi,'W')
signal off error
do i=1 to 14;writeln(enmon,monster.i);end
call close enmon
if exis=1 then do
en.3=monster.14
call open(enmon,enemystatspot,'W')
do i=1 to 60;writeln(enmon,en.i);end
call close enmon
end
if realchar=1 then do
if monster.14<1 then do
delpath="\$0delete "||dhabi||"\"
transmit delpath
end
if monster.14<1 then do
paptext="\c1"||handle||"\c2 Defeated the\c3 "||monster.1
call paperadd
transmit "\h9\h4Enemy Saved!"
end
end
call cleanupmonster
fr=0
signal gohome

Paperadd:
paperpath=DAGPATH||"text/ddpaper"
if ~exists(paperpath) then do
signal off error
call open(paper,paperpath,'W')
writeln(paper,"\c7\r1 Recently in the News \r0\n1\c3")
call close paper
signal on error
end
call open(paper,paperpath,'A')
signal off error
writeln(paper,paptext)
call close paper
signal on error
return

CheckHealth:
if u.22=1 then do;Transmit "\c2Fire Burns through your Veins...Pain..";u.3=u.3-.5;end
if u.23=1 then do;Transmit "\n1\c2You are feeling very sick...";u.3=u.3-.5;end
return

ChooseDungeon:
pnam=u.12;ppow=u.14;psdc=u.16;ptyp=u.58;pdes=u.61
if u.3<1 then do;Transmit "\n1\c2Heal first!";signal doubledaggers;end
if u.37<1 then do;Transmit "\n1\c2Buy FOOD first!";signal doubledaggers;end
FILENAMEN=DAGPATH||"text/Dungeonlist"
aa=0
call open(dun,filenamen,"R")
Do until EOF(dun);aa=aa+1;key.aa=readln(dun);dname.aa=readln(dun);dtxt.aa=readln(dun);dpat.aa=Readln(dun);end
max=aa-1
call close dun
Chodun1:
Transmit "\f1\n1\c4\r1 -+- The Dungeons -+- \r0\n1"
DO I=1 to max
Transmit "\c7[\c2"key.i"\c7] \c3"dname.i
end
query "\c4\n1Pick your Fate or\c3(0=Back to Town):\c1 "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="0" then signal doubledaggers
do z=1 to max
if xtx=key.z then Signal Godungeon
end
signal chodun1

GoDungeon:
u.55=dpat.z
transmit "\f1\c1\r1 "dname.z" \r0\n1"
sendfile (dtxt.z)
transmit "\n1\c1(\c2Any Key\c1)\g0\h9\h1"
signal dungeon

DUNGEON:
pnam=u.12;ppow=u.14;psdc=u.16;ptyp=u.58;pdes=u.61
dpath=u.55
if u.55=0 then do;Transmit "\c1Dungeon Alterations Have occurred..You are sent back to town...";signal doubledaggers;end
u.34=1;clloc=1
dtext=DAGPATH||"TEXT/DUNGEONMENU"
Transmit "\c1Descending..."
dungeon0:
pnam=u.12;ppow=u.14;psdc=u.16;ptyp=u.58;pdes=u.61
u.32=right(u.32,3,"0")
droom=DAGPATH||Dpath||"/"||u.32||"/rooms/room."||u.33
Dhabi=DAGPATH||Dpath||"/"||u.32||"/HABI/Room."||u.33
if awoke=1 then call cleardungeon
dungeon3:
call open(room,droom,"R")
do n = 1 to 26;code.n=READLN(room);end
call close room
transmit "\f1"
if u.38 >0 & u.54=1 & u.56~=1 then do
transmit "\c7\n1"
if left(code.23,1)~="." then transmit code.23
if left(code.24,1)~="." then transmit code.24
if left(code.25,1)~="." then transmit code.25
Transmit "\n1"
end
if u.53=1 & u.56~=1 & code.26=1 then call drawmap2D
if u.53=1 & u.56~=1 & code.26=0 then call drawmap1D
if u.38<1 & u.56~=1 then transmit "\c1              \r1 It's Dark in here. \r0\n2"
if u.56=1 then transmit "\c1\r1 YOU ARE BLIND! \r0"
if exists(dhabi) then do;call enemycharacter;end
Transmit "\c1Possible Exits from here:"
sendstring "\c1[\c2"
if code.2 ~= "000" then sendstring "North,"
if code.3 ~= "000" then sendstring "South,"
if code.4 ~= "000" then sendstring "East,"
if code.5 ~= "000" then sendstring "West,"
if code.7 ~= "000" then sendstring "Up,"
if code.8 ~= "000" then sendstring "Down,"
transmit "\c1]"
if u.37<10 then transmit "\n1\c1\z2 You are Low on Food! \z0"
if code.18 = "1" then Transmit "\n1\z6\c7 There is Water Here. \z0"
if Exists(Dtres) then call findtres
Dungeon2:
u.37=u.37-.25;if u.37<1 then call starvation
ft=0
if u.3<1 then signal Characterdies
if u.38~=0 then do;u.38=u.38-1;end
encount=random(1,100,time('s'));if encount>75 then signal monsterfind
call checkforevent
tleft1=time('E')
tleft=tlimit-tleft1
tleft2=tleft/60
Transmit "\n1\c1Time Left:\c3 "tleft2
if tleft2<1 then do;transmit "Time Runs out... ";signal theend;end
call checkhealth
Sendstring "\c2\n2Dungeon Cmd:\c1 ";getchar
spellfails=0
xtx=upper(left(result,1))
fr=0
if xtx="#" then signal theend
if xtx="K" then signal messwithitem
if xtx="&" then do;Transmit "Use Magic Item";signal usemagic;end
if xtx="N" & code.2 ="999" then do;u.32="000";u.33=dungeonexit;Transmit "North";signal doubledaggers;end
if xtx="S" & code.3 ="999" then do;u.32="000";u.33=dungeonexit;transmit "South";signal doubledaggers;end
if xtx="E" & code.4 ="999" then do;u.32="000";u.33=dungeonexit;Transmit "East";signal doubledaggers;end
if xtx="W" & code.5 ="999" then do;u.32="000";u.33=dungeonexit;Transmit "West";signal doubledaggers;end
if xtx="N" & code.2 ~= "000" then do;u.33=code.2;Transmit "North";signal dungeon0;end
if xtx="S" & code.3 ~= "000" then do;u.33=code.3;Transmit "South";signal dungeon0;end
if xtx="E" & code.4 ~= "000" then do;u.33=code.4;transmit "East";signal dungeon0;end
if xtx="W" & code.5 ~= "000" then do;u.33=code.5;Transmit "West";signal dungeon0;end
if xtx="U" & code.7 ="999" then do;u.32="000";u.33=dungeonexit;Transmit "Up";signal doubledaggers;transmit "\c1You climb out of the Dungeon!";end
if xtx="U" & code.7 ="998" then do;u.32=u.32-1;u.33=code.9;transmit "Up";signal dungeon0;end
if xtx="D" & code.8 ="998" then do;u.32=u.32+1;u.33=code.10;transmit "Down";signal dungeon0;end
if xtx="U" & code.7 ~="000" then do;u.33=code.7;transmit "Up";signal dungeon0;end
if xtx="D" & code.8 ~="000" then do;u.33=code.8;Transmit "Down";signal dungeon0;end
if xtx="Q" then do;u.34="1";Transmit "Quit & Save";call Dungeonsave;end
if xtx="L" then do;transmit "Look";signal DUNGEON3;end
if xtx="I" then do;transmit "Ignite Torch";signal Ignite ;end
if xtx="T" then do;transmit "Taste Water";signal Fountain;end
if xtx="C" then do;Transmit "Check for Secret Doors";signal CheckforSecretDoors;end
if xtx="Y" then do;Transmit "Quick Status";call quickstats;end
if xtx="H" then do;transmit "Drink Healing";call drinkhealing;end
if code.16=0 then spellfails=1
if xtx="P" then do;Transmit "Cast a Spell";call spelllist;end
if xtx="R" then do;transmit "Rest...";call rest;end
if xtx="1" then do;Transmit "Who?";bbscommand "WHO";end
if xtx="2" then do;Transmit "Olm";BBSCOMMAND "OLM";end
if xtx="?" then do;Transmit "Menu";sendfile (dtext);end
if xtx="M" then do;transmit "Drink Elixer";call drinkelixer;end
if xtx="Z" & u.53=0 then do;u.53=1;transmit "Map On!";signal dungeon2;end
if xtx="Z" & u.53=1 then do;u.53=0;transmit "Map Off!";signal dungeon2;end
if xtx="%" & u.54=0 then do;u.54=1;transmit "Desc. On!";signal dungeon2;end
if xtx="%" & u.54=1 then do;u.54=0;transmit "Desc. Off!";signal dungeon2;end
if xtx="!" then do;Transmit "Light Lantern.";signal lightlantern;end
signal Dungeon2

LightLantern:
if u.30~="1" then do;transmit "\c2You have No lantern!";signal dungeon2;end
if u.31<1 then do;transmit "\c2You have No Oil!";signal dungeon2;end
if u.29<1 then do;Transmit "\c2You have No Matches!";signal dungeon2;end
Transmit "\c4\n1Filling Lantern with Oil...\w1";u.31=u.31-1
Transmit "\c4Lighting it...\w1";u.29=u.29-1
Transmit "\c7Ah! Light!";u.38=u.38+51
signal dungeon3

needarope:
Transmit "Sorry, You need a Rope to go that Way!"
signal gohome

Rest:
Sendstring "\n1\c7Resting"
do i=1 to 2
sendstring "."
do z=1 to 30
end
u.5=u.5+1
if u.5>u.6 then u.5=u.6
end
Transmit "\n1Rested."
return

checkforevent:
rum=random(1,25,time('s'))
if rum="5" then Transmit "\c2You hear a Scream off in the Distance."
if rum="10" then transmit "\c1Your Footsteps echo through the Dungeon."
if rum="15" then transmit "\c1A Rat Scurries across the Floor."
if rum="20" then transmit "\c1A Bat Flutters By."
return

quickstats:
Transmit "\n1\r1 Quick Status Report \r0\n1"
transmit "\c3Weapon : \c1"pnam
transmit "\c3   Type: \c1"pdes
Transmit "\c3Armor  : \c1"u.13
transmit "\c3 ---SDC: \c1"u.17
transmit "\c3Hp/Max : \c1"u.3"\c2/\c1"u.4
transmit "\c3Sp/Max : \c1"u.5"\c2/\c1"u.6
transmit "\c3Healing: \c1"u.35
transmit "\c3Light  : \c1"u.38
transmit "\c3Gold   : \c1"u.20
transmit "\c3Torches: \c1"u.28
transmit "\c3Matches: \c1"u.29
transmit "\c3Expernc: \c1"u.19
transmit "\c3Food   : \c1"u.37
transmit "\c3Oil    : \c1"u.31
transmit "\c3Elixers: \c1"u.48
Sendstring "\c3Poison : \c1"
if u.22=1 then transmit "Yes";else Transmit "No"
sendstring "\c3Disease: \c1"
if u.23=1 then transmit "Yes";else transmit "No"
transmit "\n1"
return

checkforsecretdoors:
rum=random(1,100,time('S'))
if rum>40 then do;transmit "\c1You Search, but find no Secret Doors.";signal Dungeon2;end
if code.6="000" then do;Transmit "You Search, but find no Secret Doors.";signal Dungeon2;end 
transmit "\c7 * you found a Secret Door!"
query "\c1Do you wish to enter the secret Door? "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx~="Y" then signal dungeon2
transmit "\n1\c1You Enter the Secret Door!"
if code.6="999" then do;u.32="000";u.33=DungeonExit;signal doubledaggers;end
u.33=code.6
signal dungeon0


checkdeath:
if u.3<1 then do; transmit "You have Died.!";signal theend;end
return
lowercharisma:
u.11=u.11-1;if u.11<1 then u.11=1
Transmit "\c2Your Face is Permanently Scarred."
return

FOUNTAIN:
if code.18=0 then do;transmit "\c1There is no Water Here!";signal dungeon2;end
rum=Random(1,6,time('S'))
if rum=1 then do;fntype="Red Glowing water.";dmg=5;heal=0;spel=0;end
if rum=2 then do;fntype="Bluish water.";dmg=0;heal=5;spel=0;end
if rum=3 then do;fntype="Greenish Water. ";dmg=0;heal=0;spel=5;u.56=1;end
if rum=4 then do;fntype="Black Murky Water.";dmg=10;heal=0;spel=0;end
if rum=5 then do;fntype="Crystal Clear Water.";dmg=3;heal=0;spel=5;end
if rum=6 then do;fntype="Pure Black Water!";dmg=0;heal=0;spel=0;u.56=1;end
Transmit "You take a Sip of the "fntype"."
if dmg>0 then do;transmit "\c3You feel Fire burning through your blood...";u.3=u.3-dmg;end
if heal>0 then do;transmit "\c3You Feel Lightheaded...";u.3=u.3+heal;end
if spel>0 then do;Transmit "\c3You Feel your Blood Boiling...";u.5=u.5+spel;end
if u.3>u.4 then u.3=u.4
if u.5>u.6 then u.5=u.6
signal dungeon2
characterdies:
u.34=0;u.32="000";u.33="001"
transmit "\n2\c1\s3As the Last of your Life pours out of you... Your Body Crumples to the Ground...\s0"
transmit "\w3\s1\n1\c3Passing Adventurers Take your Remains back to the City...\s0"
u.3=0
signal theend

ignite:
if u.28="0" then do;Transmit "\c1You have no Torches!";signal dungeon2;end
if u.29="0" then do;transmit "\c1You have no Matches to light the Torches!";signal dungeon2;end
u.28=u.28-1
u.29=u.29-1;transmit "\c7You light the torch.."
u.38=u.38+15
Transmit "\n1\c1You can see Now!"
signal dungeon3

FOREST:
sendfile (dagpath||"text/ForestIntro")
if u.3<1 then do;Transmit "\n1\c2Heal first!";signal doubledaggers;end
if u.37<1 then do;Transmit "\n1\c2Buy FOOD first!";signal doubledaggers;end
u.34=2;clloc=2;dtext=DAGPATH||"TEXT/FORESTMENU";Transmit "\c1Entering The Forest..."
Forest0:
pnam=u.12;ppow=u.14;psdc=u.16;ptyp=u.58;pdes=u.61
u.32=right(u.32,3,"0")
droom=DAGPATH||"Forest/"||u.32||"/rooms/room."||u.33;Dhabi=DAGPATH||"Forest/"||u.32||"/HABI/Room."||u.33
if awoke=1 then call cleardungeon
Forest3:
call open(room,droom,"R")
do n = 1 to 18;code.n=READLN(room);end
call close room
transmit "\f1\c7\n1"
if u.56=1 then transmit "\c1\r1 YOU ARE BLIND! \r0"
if u.54=1 & u.56~=1 then do
if left(code.13,1)~="." then transmit code.13
if left(code.14,1)~="." then transmit code.14
if left(code.15,1)~="." then transmit code.15
end
Transmit "\n1"
if u.53=1 & u.56~=1 & code.18=1 then call drawmap2F
if u.53=1 & u.56~=1 & code.18=0 then call drawmap1F
if exists(dhabi) then do;call enemycharacter;end
Transmit "\c1Paths Lead from here:"
sendstring "\c1[\c2"
if code.2 ~= "000" then sendstring "North,"
if code.3 ~= "000" then sendstring "South,"
if code.4 ~= "000" then sendstring "East,"
if code.5 ~= "000" then sendstring "West,"
if code.16 ~= "000" then sendstring "Up,"
if code.17 ~= "000" then sendstring "Down,"
transmit "\c1]"
if u.37<10 then transmit "\n1\c1\z2 You are Low on Food! \z0"
if code.11 = "1" then Transmit "\n1\z6\c7 There is Water Here. \z0"
if Exists(Dtres) then call findtres
Forest2:
temp=right(u.32,3,'0')
u.37=u.37-.25;if u.37<1 then call starvation
ft=0;if u.3<1 then signal Characterdies
encount=random(1,100,time('s'));if encount>75 then signal monsterfind
call checkforevent2
tleft1=time('E');tleft=tlimit-tleft1;tleft2=tleft/60;Transmit "\c1\n1Time Left:\c3 "tleft2
if tleft2<1 then do;transmit "Time Runs out... ";signal theend;end
call checkhealth
Sendstring "\c5\n2Forest Cmd:\c7 ";getchar
spellfails=0
xtx=upper(left(result,1))
fr=0
if xtx="#" then signal theend
if xtx="K" then signal messwithitem
if xtx="&" then do;Transmit "Use Magic Item";signal usemagic;end
if xtx="N" & code.2 ="999" then do;u.32="000";u.33=ForestExit;Transmit "North";signal doubledaggers;end
if xtx="N" & code.2 ~= "000" then do;u.33=code.2;Transmit "North";signal Forest0;end
if xtx="S" & code.3 ="999" then do;u.32="000";u.33=ForestExit;transmit "South";signal doubledaggers;end
if xtx="S" & code.3 ~= "000" then do;u.33=code.3;Transmit "South";signal Forest0;end
if xtx="E" & code.4 ="999" then do;u.32="000";u.33=ForestExit;Transmit "East";signal doubledaggers;end
if xtx="E" & code.4 ~= "000" then do;u.33=code.4;Transmit "East";signal Forest0;end
if xtx="W" & code.5 ="999" then do;u.32="000";u.33=ForestExit;Transmit "West";signal doubledaggers;end
if xtx="W" & code.5 ~= "000" then do;u.33=code.5;Transmit "West";signal Forest0;end
if xtx="U" & code.16 = "999" then do;u.32="000";u.33=ForestExit;Transmit "Up";signal doubledaggers;end
if xtx="U" & code.16 = "998" then do;u.32=u.32+1;u.33=code.6;Transmit "Up";signal Forest0;end
if xtx="D" & code.17 = "998" then do;u.32=u.32-1;u.33=code.7;Transmit "Down";signal Forest0;end
if xtx="U" & code.16 ~="000" then do;u.33=code.16;Transmit "Up";signal Forest0;end
if xtx="D" & code.17 ~="000" then do;u.33=code.17;Transmit "Down";signal Forest0;end
if xtx="Q" then do;u.34="2";Transmit "Quit & Save";call Dungeonsave;end
if xtx="L" then do;Transmit "Look";signal Forest3;end
if xtx="T" then Do;Transmit "Taste Water";signal Fountain2;end
if xtx="Y" then Do;Transmit "Quick Status";call quickstats;end
if xtx="H" then do;Transmit "Drink Healing";call drinkhealing;end
if code.10=0 then spellfails=1
if xtx="P" then do;Transmit "Cast a Spell";call spelllist;end
if xtx="R" then do;transmit "Rest...";call rest;end
if xtx="1" then do;Transmit "Who?";bbscommand "WHO";end
if xtx="2" then do;Transmit "Olm";BBSCOMMAND "OLM";end
if xtx="?" then do;Transmit "Menu";sendfile (dtext);end
if xtx="M" then do;Transmit "Drink Elixer";call drinkelixer;end
if xtx="C" then do;transmit "Check for hidden Pathways...";call checkforsecretdoors2;end
if xtx="Z" & u.53=0 then do;u.53=1;transmit "Map On!";signal forest2;end
if xtx="Z" & u.53=1 then do;u.53=0;transmit "Map Off!";signal forest2;end
if xtx="%" & u.54=0 then do;u.54=1;transmit "Desc. On!";signal forest2;end
if xtx="%" & u.54=1 then do;u.54=0;transmit "Desc. Off!";signal forest2;end
signal Forest2

DrawMap1D:
if u.38<1 then return
if code.2~="000" then smap.1=map.2;else smap.1=map.1
if code.3~="000" then smap.5=map.2;else smap.5=map.1
if code.4~="000" & code.5~="000" then smap.3=map.6
if code.4~="000" & code.5="000" then smap.3=map.4
if code.4="000" & code.5~="000" then smap.3=map.5
if code.4="000" & code.5="000" then smap.3=map.3
if code.7~="000" then smap.2=map.7;else smap.2=map.3
if code.8~="000" then smap.4=map.8;else smap.4=map.3
if code.18="1" & code.4~="000" & code.5~="000" then smap.3=map.9
if code.18="1" & code.4="000" & code.5="000" then smap.3=map.12
if code.18="1" & code.4~="000" & code.5="000" then smap.3=map.10
if code.18="1" & code.4="000" & code.5~="000" then smap.3=map.11
transmit "\>9\c3  North"
transmit "\>9\c3W \c7"||smap.1||"\c3 E"
transmit "\>9\c3e \c7"||smap.2||"\c3 a"
transmit "\>9\c3s \c7"||smap.3||"\c3 s"
transmit "\>9\c3t \c7"||smap.4||"\c3 t"
transmit "\>9\c7  "||smap.5||"\c3"
transmit "\>9\c3  South"
transmit "\c3"
return
DrawMap1F:
if code.2~="000" then smap.1=map.2;else smap.1=map.1
if code.3~="000" then smap.5=map.2;else smap.5=map.1
if code.4~="000" & code.5~="000" then smap.3=map.6
if code.4~="000" & code.5="000" then smap.3=map.4
if code.4="000" & code.5~="000" then smap.3=map.5
if code.4="000" & code.5="000" then smap.3=map.3
if code.16~="000" then smap.2=map.7;else smap.2=map.3
if code.17~="000" then smap.4=map.8;else smap.4=map.3
if code.11="1" & code.4~="000" & code.5~="000" then smap.3=map.9
if code.11="1" & code.4="000" & code.5="000" then smap.3=map.12
if code.11="1" & code.4~="000" & code.5="000" then smap.3=map.10
if code.11="1" & code.4="000" & code.5~="000" then smap.3=map.11
transmit "\c3"
transmit "\>9\c3  North"
transmit "\>9\c3W \c7"||smap.1||"\c3 E"
transmit "\>9\c3e \c7"||smap.2||"\c3 a"
transmit "\>9\c3s \c7"||smap.3||"\c3 s"
transmit "\>9\c3t \c7"||smap.4||"\c3 t"
transmit "\>9\c7  "||smap.5||"\c3"
transmit "\>9\c3  South"
transmit "\c3"
return

DrawMap2D:
if u.38<1 then return
if code.2~="000" then do;smap.1=map1.2;smap.2=map1.2;end
if code.2="000" then do;smap.1=map1.1;smap.2=map1.1;end
if code.3~="000" then do;smap.5=map1.2;smap.4=map1.2;end
if code.3="000" then do;smap.5=map1.1;smap.4=map1.1;end
if code.4~="000" & code.5~="000" then smap.3=map1.6
if code.4~="000" & code.5="000" then smap.3=map1.4
if code.4="000" & code.5~="000" then smap.3=map1.5
if code.4="000" & code.5="000" then smap.3=map1.3
if code.7~="000" then smap.2=map1.7
if code.8~="000" then smap.4=map1.8
if code.18="1" & code.4~="000" & code.5~="000" then smap.3=map1.9
if code.18="1" & code.4="000" & code.5="000" then smap.3=map1.12
if code.18="1" & code.4~="000" & code.5="000" then smap.3=map1.10
if code.18="1" & code.4="000" & code.5~="000" then smap.3=map1.11
transmit "\>9\c3  North"
transmit "\>9\c3W \c7"||smap.1||"\c3 E"
transmit "\>9\c3e \c7"||smap.2||"\c3 a"
transmit "\>9\c3s \c7"||smap.3||"\c3 s"
transmit "\>9\c3t \c7"||smap.4||"\c3 t"
transmit "\>9\c7  "||smap.5||"\c3"
transmit "\>9\c3  South"
transmit "\c3"
return
DrawMap2F:
if code.2~="000" then do;smap.1=map1.2;smap.2=map1.2;end
if code.2="000" then do;smap.1=map1.1;smap.2=map1.1;end
if code.3~="000" then do;smap.5=map1.2;smap.4=map1.2;end
if code.3="000" then do;smap.5=map1.1;smap.4=map1.1;end
if code.4~="000" & code.5~="000" then smap.3=map1.6
if code.4~="000" & code.5="000" then smap.3=map1.4
if code.4="000" & code.5~="000" then smap.3=map1.5
if code.4="000" & code.5="000" then smap.3=map1.3
if code.16~="000" then smap.2=map1.7
if code.17~="000" then smap.4=map1.8
if code.11="1" & code.4~="000" & code.5~="000" then smap.3=map1.9
if code.11="1" & code.4="000" & code.5="000" then smap.3=map1.12
if code.11="1" & code.4~="000" & code.5="000" then smap.3=map1.10
if code.11="1" & code.4="000" & code.5~="000" then smap.3=map1.11
transmit "\c3"
transmit "\>9\c3  North"
transmit "\>9\c3W \c7"||smap.1||"\c3 E"
transmit "\>9\c3e \c7"||smap.2||"\c3 a"
transmit "\>9\c3s \c7"||smap.3||"\c3 s"
transmit "\>9\c3t \c7"||smap.4||"\c3 t"
transmit "\>9\c7  "||smap.5||"\c3"
transmit "\>9\c3  South"
transmit "\c3"
return

checkforsecretdoors2:
rum=random(1,100,time('S'))
if rum>20 then do;transmit "\c1You Search, but find no hidden pathways.";signal Forest2;end
if code.12="000" then do;Transmit "You Search, but find no Hidden pathways.";signal Forest2;end 
transmit "\c7 * you found a Hidden Pathway!"
query "\c1Do you wish to enter the Hidden Pathway? "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx~="Y" then signal Forest2
transmit "\n1\c1You Enter the Hidden Pathway!"
if code.12="999" then do;u.32="000";u.33=ForestExit;signal doubledaggers;end
u.33=code.12
signal Forest0

checkforsecretdoors3:
rum=random(1,100,time('S'))
if rum>20 then do;transmit "\c1You Search, but find no hidden Walkways.";signal Town2;end
if code.12="000" then do;Transmit "You Search, but find no Hidden walkways.";signal Town2;end 
transmit "\c7 * you found a Hidden walkway!"
query "\c1Do you wish to enter the Hidden walkway? "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx~="Y" then signal Town2
transmit "\n1\c1You Enter the Hidden walkway!"
if code.12="999" then do;u.32="000";u.33="001";signal doubledaggers;end
u.33=code.12
signal Town0

checkforevent2:
rum=random(1,25,time('s'))
if rum="5" then Transmit "\c2You hear a Scream off in the Distance."
if rum="10" then transmit "\c1You hear the Baying of a Wolf off in the Distance."
if rum="15" then transmit "\c1Birds are singing in the Trees."
if rum="20" then transmit "\c1Something is rustling in the bushes nearby."
return

checkforevent3:
rum=random(1,25,time('s'))
if rum="5" then Transmit "\c2You hear a Scream off in the Distance."
if rum="10" then transmit "\c1You hear the Baying of a Wolf off in the Distance."
if rum="15" then transmit "\c1A Cat Runs past you."
if rum="20" then transmit "\c1A Drunken Bum stumbles past you."
return

FOUNTAIN2:
if code.11=0 then do;transmit "\c1There is no Water Here!";signal Forest2;end
rum=Random(1,6,time('S'))
if rum=1 then do;fntype="Red Glowing water.";dmg=5;heal=0;spel=0;end
if rum=2 then do;fntype="Bluish water.";dmg=0;heal=5;spel=0;end
if rum=3 then do;fntype="Greenish Water. ";dmg=0;heal=0;spel=5;end
if rum=4 then do;fntype="Pure Black Water!";dmg=0;heal=0;spel=0;u.56=1;end
if rum=5 then do;fntype="Black Murky Water.";dmg=10;heal=0;spel=0;end
if rum=6 then do;fntype="Crystal Clear Water.";dmg=3;heal=0;spel=5;end
Transmit "You take a Sip of the "fntype"."
if dmg>0 then do;transmit "\c3You feel Fire burning through your blood...";u.3=u.3-dmg;end
if heal>0 then do;transmit "\c3You Feel Lightheaded...";u.3=u.3+heal;end
if spel>0 then do;Transmit "\c3You Feel your Blood Boiling...";u.5=u.5+spel;end
if u.3>u.4 then u.3=u.4
if u.5>u.6 then u.5=u.6
signal Forest2

FOUNTAIN3:
if code.11=0 then do;transmit "\c1There is no Water Here!";signal Town2;end
rum=Random(1,6,time('S'))
if rum=1 then do;fntype="Red Glowing water.";dmg=5;heal=0;spel=0;end
if rum=2 then do;fntype="Bluish water.";dmg=0;heal=5;spel=0;end
if rum=3 then do;fntype="Greenish Water. ";dmg=0;heal=0;spel=5;end
if rum=4 then do;fntype="Pure Black Water!";dmg=0;heal=0;spel=0;u.56=1;end
if rum=5 then do;fntype="Black Murky Water.";dmg=10;heal=0;spel=0;end
if rum=6 then do;fntype="Crystal Clear Water.";dmg=3;heal=0;spel=5;end
Transmit "You take a Sip of the "fntype"."
if dmg>0 then do;transmit "\c3You feel Fire burning through your blood...";u.3=u.3-dmg;end
if heal>0 then do;transmit "\c3You Feel Lightheaded...";u.3=u.3+heal;end
if spel>0 then do;Transmit "\c3You Feel your Blood Boiling...";u.5=u.5+spel;end
if u.3>u.4 then u.3=u.4
if u.5>u.6 then u.5=u.6
signal Town2

Starvation:
Transmit "\c1You Have run out of Food...and are Starving!!!"
u.3=u.3-1;if u.3<1 then u.3=0
if u.3=0 then Transmit "You have Died.";signal characterdies
return

HEALER: 
transmit "\c1(any key)\g0\h9\f1"
Transmit "\c1The Temple of Siassina"
transmit "\c2----------------------->"
transmit "\c1<H>\c3 Heal Wounds     "
transmit "\c1<D>\c3 Cure Diseases   "
transmit "\c1<P>\c3 Cure Poisons    "
transmit "\c1<B>\c3 Cure Blindness  "
transmit "\c1<Q>\c4 Quit to Town    "
Query "\c1\n1Choice: "
XTX=UPPER(LEFT(RESULT,1))
if xtx="#" then signal theend
if xtx="Q" then signal Doubledaggers
if xtx="H" then Signal Healwounds
if xtx="P" then signal Healpoisons
if xtx="D" then signal HealDiseases
if xtx="B" then signal HealBlind
signal healer
HEALDISEASES:
if u.23="0" then do;transmit "\c1You are not Diseased!";signal healer;end
transmit "\c2it will cost you 50 Gold to cure your Diseases."
query "\c1\n1Do you wish to do so? "
xtx=upper(left(result,1));if xtx="#" then signal theend
if xtx~="Y" then signal healer
if u.20<50 then do;transmit "\c1Insufficient Gold!";signal Healer;end
u.20=u.20-50;transmit "\c7You hand the Healer 50 Gold Coins."
u.23=0;transmit "\c3He mumbles Some Mumbo-Jumbo...\w1...then Touches your head..."
Transmit "You are no longer Diseased!"
signal healer

HEALBLIND:
if u.56="0" then do;transmit "\c1You are not Blind!";signal healer;end
transmit "\c2it will cost you 50 Gold to cure your Blindness."
query "\c1\n1Do you wish to do so? "
xtx=upper(left(result,1));if xtx="#" then signal theend
if xtx~="Y" then signal healer
if u.20<50 then do;transmit "\c1Insufficient Gold!";signal Healer;end
u.20=u.20-50;transmit "\c7You hand the Healer 50 Gold Coins."
u.56=0;transmit "\c3She mumbles Some Mumbo-Jumbo...\w1...then Touches your head..."
Transmit "You are no longer Blind!"
signal healer

HEALPOISONS:
if u.22="0" then do;Transmit "\c1You are not poisoned!";signal healer;end
transmit "\c2It will cost 35 Gold to Cure The Poison in your system."
Query "\c1\n1Do you wish to do so? "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx~="Y" then signal healer
if u.20<35 then do;transmit "\c1Insufficient Gold!";signal healer;end
u.20=u.20-35;transmit "\c7You hand the Healer 35 Gold Coins."
u.22=0;transmit "\c3He Mumbles a Few words...\w1...Then touches your head.."
transmit "You are No longer poisoned."
signal healer
 
healwounds:
transmit "\c1Each Point Costs "u.18*healcost" Gold to cure."
totalhealneed=u.4-u.3
transmit "\c3You need "totalhealneed" Points Healed to be Totally healed."
transmit "which would cost you\c7 "totalhealneed*(u.18*healcost)" Gold Coins."
query "\n1\c1How many do you wish to heal? "
xtx=result
ck=datatype(xtx,'N')
if ck=0 then signal healer
if xtx<1 then signal healer
if xtx="#" then signal theend
if xtx="" then signal healer
if xtx=0 then signal healer
if xtx>0 then cost=xtx*(u.18*healcost)
if xtx>totalhealneed then do;transmit "Your body can't heal that much!";signal healer;end
if cost>u.20 then do; Transmit "\c1Insufficient Funds!";signal healer;end
u.20=u.20-cost;transmit "\c3You Hand him\c7 "cost" Gold"
transmit "\c3He lays his hands upon thy wounds...\w1"
u.3=u.3+xtx
transmit "\c7You feel Better!"
signal healer

WEAPON:
Transmit "\c1(any key)\g0\h9\f1"
transmit "\c3Shaina's Fine Weapons"
transmit "\c1------------------------>\n1"
transmit "\c3Primary  :\c7 "u.12
transmit "\c3Secondary:\c7 "u.24
transmit "\c1------------------------>\n1"
transmit "\c3[B]\c4 Buy Weapon         "
transmit "\c3[S]\c4 Sell Weapon        "
transmit "\c3[Q]\c2 Quit to Town      \n1"
query "\c1Choice: "
cmn=upper(left(result,1))
if cmn="B" then call loadweaponlist
if cmn="Q" then do;call cleanupstore;signal Doubledaggers;end
if cmn="#" then signal theend
if cmn="S" then call sellweapon
signal Weapon
sellweapon:
query "\c4Sell [P]rimary or [S]econdary Weapon [F]orget it:\c1 "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if xtx="P" then signal sellweapon1
if xtx="S" then signal sellweapon2
if xtx="F" then signal weapon
signal weapon

SELLweapon1:
transmit "\c4Attempting to Sell Primary Weapon\n1"
if u.12="Hands" then do;Transmit "\c1I AM NO FOOL!!! You can't sell your Hands!!\n1\c3GET OUT!!!";signal doubledaggers;end
offer=(U.14*2)+u.16
Transmit "\c7I'll Offer ya "offer " Gold coins for your "u.12
query "\c1ACCEPT\c3<y/n>:\c1 "
cdx=upper(left(result,1))
if cdx="#" then signal theend
if cdx="N" then signal weapon
if cdx="Y" then do;u.12="Hands";u.14="1";u.16="5";u.20=u.20+offer;u.58=0
transmit "\c3You Give him your weapon and Pocket the "offer" Gold Coins"
signal weapon
SELLweapon2:
transmit "\c4Attempting to Sell Secondary Weapon\n1"
if u.24="None" then do;Transmit "\c1I AM NO FOOL!!! You Have no Weapon there!!\n1\c3GET OUT!!!";signal doubledaggers;end
if u.24=0 then do;transmit "\c1Get lost!";signal weapon;end
offer=(U.25*2)+u.26
Transmit "\c7I'll Offer ya "offer " Gold coins for your "u.24
query "\c1ACCEPT\c3<y/n>:\c1 "
cdx=upper(left(result,1))
if cdx="#" then signal theend
if cdx="N" then signal weapon
if cdx="Y" then do;u.24="None";u.25="0";u.26="0";u.20=u.20+offer;u.52=0
transmit "\c3You Give him your weapon and Pocket the "offer" Gold Coins"
signal weapon
LOADweaponLIST:
FILENAMEN=DAGPATH||"text/weaponlist"
aa=0
call open(weapon,filenamen,"R")
Do until EOF(weapon);aa=aa+1;key.aa=readln(weapon);itm.aa=readln(weapon);cost.aa=readln(weapon);pow.aa=Readln(weapon);pnts.aa=readln(weapon);Tp.aa=Readln(weapon);end
max=aa-1
call close weapon
call tpcon1
DISPLAYweapon:
Transmit "\c1 These are what you can Afford.\n1"
Transmit "\c4KEY   Item Name                Cost       Type  "
transmit "\c1--- ----------------------   -----------  ------------"
do z = 1 to max
if (u.20+1)>cost.z then Transmit "\c1("key.z")\c2 "left(itm.z,26,".")" \c7 "left(cost.z,11,".")"\c4"wtype.z
end
BUYweapon:
Query" \n1\c1Buy Which \c3(0=Exit)\c1"
zxr=upper(left(result,1))
if zxr="#" then call theend
if zxr="0" then return
do z=1 to max
if upper(key.z)=zxr then do;wtp=wtype.z;tap=tp.z;ar=itm.z;pn=pnts.z;pw=pow.z;call checkweapon;end
end
return
checkweapon:
if cost.z>u.20 then do;transmit "Not enough gold!";signal weapon;end
u.20=u.20-cost.z
checkweapon9:
query "\c4Put this weapon where [P]rimary [S]econdary [F]orget it!: "
xtx=upper(left(result,1))
if xtx="#" then signal theend
prim=0;second=0
if xtx="F" then signal weapon
if xtx="P" then do;prim=1;second=0;end
if xtx="S" then do;prim=0;second=1;end
if prim=0 & Second=0 then signal checkweapon9
if prim=1 then do;u.12=ar;u.14=pw;u.16=pn;u.58=tap;u.61=Wtp;end
if prim=0 then do;u.24=ar;u.25=pw;u.26=pn;u.52=tap;u.62=wtp;end
Transmit "\c1You Bought the "ar" for "cost.z" \c7Gold coins."
Transmit "\c1It has an Weapon Rating of "pw" and has "pn" Resistance Points."
signal weapon

cleardungeon:
awoke=0
delpath="\$0delete "||dhabi||"\"
transmit delpath
return

TPCON1:
do i=1 to max
if tp.i=0 then wtype.i="Body Part"
if tp.i=1 then wtype.i="Edged"
if tp.i=2 then wtype.i="Bashing"
if tp.i=3 then wtype.i="Ranged"
if tp.i=4 then wtype.i="Vapor"
if tp.i=5 then wtype.i="Poison"
if tp.i=6 then wtype.i="Heat"
if tp.i=7 then wtype.i="Cold"
if tp.i=8 then wtype.i="Pole Arm"
if tp.i>8 then wtype.i="Unknown"
if tp.i<0 then wtype.i="Unknown"
end
return

Dungeonsave:
if ~exists(dhabi) then signal savethem
if exists(dhabi) then do;transmit "\c1You can't save in this room!";return;end
savethem:
call open(dload,dhabi,'W')
signal off error
sendstring "\c1Saving Location..."
writeln(dload,handle)
writeln(dload,u.13)
writeln(dload,u.15)
writeln(dload,u.17)
writeln(dload,u.12)
writeln(dload,u.14)
writeln(dload,u.16)
writeln(dload,"1")
writeln(dload,"1")
writeln(dload,"A "||u.27||" Steps out of the Shadows.")
writeln(dload,u.58)
writeln(dload,u.20)
vul=u.4*u.18
writeln(dload,vul)
writeln(dload,u.3)
call close dload
signal on error
transmit "\h6\h9ed!"
signal theend

ARMORY:
if u.51~="1" then do;Transmit "\c1Members of your Profession Cannot Wear Armor!";signal doubledaggers;end
Transmit "\c1(any key)\g0\h9\f1"
Transmit "\c3Rocky's Armor Shoppe."
transmit "\c1------------------------>\n1"
transmit "\c3[B]\c4 Buy Armor               "
Transmit "\c3[S]\c4 Sell Armor              "
Transmit "\c3[Q]\c2 Quit to Town            \n1"
query "\c1Choice: "
cmn=upper(left(result,1))
if cmn="B" then call loadarmorlist
if cmn="Q" then do;call cleanupstore;signal doubledaggers;end
if cmn="#" then signal THEEND
if cmn="S" then call SellArmor
signal Armory
SELLARMOR:
if u.13="None" then do;Transmit "\c1I AM NO FOOL!!! GET OUT!!!";signal doubledaggers;end
offer=(U.15*3)
Transmit "\c7I'll Offer ya "offer " Gold coins for your "u.13
query "\c1ACCEPT\c3<y/n>:\c1 "
cdx=upper(left(result,1))
if cdx="#" then signal theend
if cdx="N" then signal Armory
if cdx="Y" then do;u.13="None";u.15="0";u.17="0";u.20=u.20+offer
transmit "\c3You Give him your Armor and Pocket the "offer" Gold Coins"
signal armory
LOADARMORLIST:
FILENAMEN=TEXTPATH||"armorlist"
aa=0
call open(Armor,filenamen,"R")
Do until EOF(ARMOR)
aa=aa+1
key.aa=readln(armor)
itm.aa=readln(armor)
cost.aa=readln(armor)
pow.aa=Readln(armor)
pnts.aa=readln(Armor)
end
max=aa-1
call close armor
DISPLAYARMOR:
Transmit "\c1These are What you can Afford."
Transmit "\n1\c4KEY   Item Name                Cost  "
transmit "\c1--- ----------------------   --------"
do z = 1 to max
if (u.20+1)>cost.z then Transmit "\c1("key.z")\c2 "left(itm.z,26,".")" \c7 "cost.z
end
BUYARMOR:
Query" \n1\c1Buy Which \c3(0=Exit)\c1"
zxr=upper(left(result,1))
if zxr="#" then call theend
if zxr="0" then return
do z=1 to max
if upper(key.z)=zxr then do;ar=itm.z;pn=pnts.z;pw=pow.z;call checkarmor;end
end
return
checkarmor:
if cost.z>u.20 then do;transmit "Not enough gold!";signal ARMORY;end
u.20=u.20-cost.z
u.13=ar;u.15=pw;u.17=pn
Transmit "\c1You Bought the "ar" for "cost.z" \c7Gold coins."
Transmit "\c1It has an Armor Rating of "pw" and has "pn" Resistance Points."
signal armory

cleanupstore:
return
cleanupcode:
return
cleanupmonster:
return
cleanupenmon:
return
cleanuppatrons:
return
cleanupspells:
return
cleanupgirls:
return
cleanupzzn:
return
cleanupclasses:
return
cleanupraces:
return

FindTres:
call open(tres,dtres,"R")
do i=1 to 7
dt.i=readln(tres)
end
call close tres
Transmit "\n1\z6\c7 You notice: \z0\c1 "
transmit dt.3
return

THEEND:
Transmit "\c7\n1Thanks for Playing... "
transmit "\c4\n1This program Brought to you By D.N.K.\n1"
call savecharacter;call quit

TOWNSHIP:
u.34=0;clloc=0;dtext=DAGPATH||"TEXT/TOWNMENU"
TOWN0:
pnam=u.12;ppow=u.14;psdc=u.16;ptyp=u.58;pdes=u.61
u.32=right(u.32,3,"0")
droom=DAGPATH||"TOWN/"||u.32||"/rooms/room."||u.33;Dhabi=DAGPATH||"TOWN/"||u.32||"/HABI/Room."||u.33
dtres=dagpath||"TOWN/"||U.32||"/Tres/Room."||u.33
if awoke=1 then call cleardungeon
Town3:
call open(room,droom,"R")
do n = 1 to 19;code.n=READLN(room);end
call close room
transmit "\f1\c7\n1"
if u.56=1 then transmit "\c1\r1 YOU ARE BLIND! \r0"
if u.54=1 & u.56~=1 then do
if left(code.13,1)~="." then transmit code.13
if left(code.14,1)~="." then transmit code.14
if left(code.15,1)~="." then transmit code.15
end
Transmit "\n1"
if u.53=1 & u.56~=1 & code.18=1 then call drawmap2F
if u.53=1 & u.56~=1 & code.18=0 then call drawmap1F
if exists(dhabi) then do;call enemycharacter;end
Transmit "\c1Paths Lead from here:"
sendstring "\c1[\c2"
if code.2 ~= "000" then sendstring "North,"
if code.3 ~= "000" then sendstring "South,"
if code.4 ~= "000" then sendstring "East,"
if code.5 ~= "000" then sendstring "West,"
if code.16 ~= "000" then sendstring "Up,"
if code.17 ~= "000" then sendstring "Down,"
transmit "\c1]"
sendstring "\n1\c1--> \c7 "
if code.19="000" then transmit "None "
if code.19~="000" then call checkbuilding
if code.19~="000" then transmit " - \c2[\c7X\c2]\c3 To Enter"
if code.11 = "1" then Transmit "\n1\z6\c1 There is Water Here. \z0"
if Exists(Dtres) then call findtres
TOWN2:
temp=right(u.32,3,'0')
if u.37<20 then transmit "\z2\c1 You are LOW on Food! \z0"
ft=0;if u.3<1 then do;u.3=1;transmit "\c7\z2 You are Very Weak! \z0";end
encount=random(1,100,time('s'));if encount>85 then signal monsterfind
call checkforevent3
tleft1=time('E');tleft=tlimit-tleft1;tleft2=tleft/60;Transmit "\c1\n1Time Left:\c3 "tleft2
if tleft2<1 then do;transmit "Time Runs out... ";signal theend;end
call checkhealth
Sendstring "\c5\n2TOWN Cmd:\c7 ";getchar
spellfails=0
xtx=upper(left(result,1))
fr=0

if xtx="#" then signal theend
if xtx="V" then do;transmit "View Town Map.";sendfile (Dagpath||"TownMap");transmit "\n1\c1(Any Key)\g0\h9\h1";end
if xtx="K" then signal messwithitem
if xtx="&" then do;Transmit "Use Magic Item";signal usemagic;end
if xtx="N" & code.2 ="999" then do;u.32="000";u.33=S"001";Transmit "North";signal doubledaggers;end
if xtx="N" & code.2 ~= "000" then do;u.33=code.2;Transmit "North";signal TOWN0;end
if xtx="S" & code.3 ="999" then do;u.32="000";u.33="001";transmit "South";signal doubledaggers;end
if xtx="S" & code.3 ~= "000" then do;u.33=code.3;Transmit "South";signal TOWN0;end
if xtx="E" & code.4 ="999" then do;u.32="000";u.33="001";Transmit "East";signal doubledaggers;end
if xtx="E" & code.4 ~= "000" then do;u.33=code.4;Transmit "East";signal TOWN0;end
if xtx="W" & code.5 ="999" then do;u.32="000";u.33="001";Transmit "West";signal doubledaggers;end
if xtx="W" & code.5 ~= "000" then do;u.33=code.5;Transmit "West";signal TOWN0;end
if xtx="U" & code.16 = "999" then do;u.32="000";u.33="001";Transmit "Up";signal doubledaggers;end
if xtx="U" & code.16 = "998" then do;u.32=u.32+1;u.33=code.6;Transmit "Up";signal TOWN0;end
if xtx="D" & code.17 = "998" then do;u.32=u.32-1;u.33=code.7;Transmit "Down";signal TOWN0;end
if xtx="U" & code.16 ~="000" then do;u.33=code.16;Transmit "Up";signal TOWN0;end
if xtx="D" & code.17 ~="000" then do;u.33=code.17;Transmit "Down";signal TOWN0;end
if xtx="L" then do;Transmit "Look";signal TOWN3;end
if xtx="T" then Do;Transmit "Taste Water";signal Fountain3;end
if xtx="Y" then Do;Transmit "Status";call ShowStats;end
if xtx="X" & code.19~="000" then do;transmit "Enter Building...";call gobuilding;end
if xtx="H" then do;Transmit "Drink Healing";call drinkhealing;end
if code.10=0 then spellfails=1
if xtx="P" then do;Transmit "Cast a Spell";call spelllist;end
if xtx="R" then do;transmit "Rest...";call rest;end
if xtx="1" then do;Transmit "Who?";bbscommand "WHO";end
if xtx="2" then do;Transmit "Olm";BBSCOMMAND "OLM";end
if xtx="?" then do;Transmit "Menu";sendfile (dtext);end
if xtx="M" then do;Transmit "Drink Elixer";call drinkelixer;end
if xtx="C" then do;transmit "Check for hidden Pathways...";call checkforsecretdoors3;end
if xtx="Z" & u.53=0 then do;u.53=1;transmit "Map On!";signal TOWN2;end
if xtx="Z" & u.53=1 then do;u.53=0;transmit "Map Off!";signal TOWN2;end
if xtx="%" & u.54=0 then do;u.54=1;transmit "Desc. On!";signal TOWN2;end
if xtx="%" & u.54=1 then do;u.54=0;transmit "Desc. Off!";signal TOWN2;end
if xtx="Q" then do;transmit "Quit & Save.";signal theend;end
signal TOWN2
gobuilding:
if code.19="900" Then do;Flzz="01" ;transmit "\c3Entering \c7Armory";call display;end
if code.19="901" Then do;Flzz="02" ;transmit "\c3Entering \c7Weaponry";call display;end
if code.19="902" Then do;Flzz="03" ;transmit "\c3Entering \c7Healers";call display;end
if code.19="903" Then do;Flzz="04" ;transmit "\c3Entering \c7Dungeon";call display;end
if code.19="904" Then do;Flzz="05" ;transmit "\c3Entering \c7Forest";call display;end
if code.19="905" Then do;Flzz="06" ;transmit "\c3Entering \c7Bunk House(Save Game)";call display;end
if code.19="906" Then do;Flzz="07" ;transmit "\c3Entering \c7Training Guild";call display;end
if code.19="907" Then do;Flzz="08" ;transmit "\c3Entering \c7Magic Shoppe";call display;end
if code.19="908" Then do;Flzz="09" ;transmit "\c3Entering \c7Supply Depot";call display;end
if code.19="909" Then do;Flzz="10" ;transmit "\c3Entering \c7Black Dragon Tavern";call display;end
if code.19="910" Then do;Flzz="11" ;transmit "\c3Entering \c7Grocer";call display;end
if code.19="911" Then do;Flzz="12" ;transmit "\c3Entering \c7Brothel";call display;end
if code.19="912" Then do;Flzz="13" ;transmit "\c3Entering \c7Inn";call display;end
if code.19="913" Then do;Flzz="14" ;transmit "\c3Entering \c7Grog's Casino";call display;end
if code.19="914" Then do;Flzz="16" ;transmit "\c3Entering \c7The High council";call display;end
if code.19="915" Then do;Flzz="18" ;transmit "\c3Entering \c7Red Roof Bank";call display;end
if code.19="916" Then do;Flzz="19" ;transmit "\c3Entering \c7Post Office";call display;end
if code.19="917" Then do;Flzz="24" ;transmit "\c3Entering \c7The Suicide Pit";call display;end
if code.19="918" Then do;Flzz="25" ;transmit "\c3Entering \c7Money Express Send";call display;end
if code.19="919" Then do;Flzz="26" ;transmit "\c3Entering \c7Dream Tavern(Msg Base)";call display;end
signal town2

checkbuilding:
if code.19="900" then sendstring "Armory"
if code.19="901" then sendstring "Weaponry"
if code.19="902" then sendstring "Healers"
if code.19="903" then sendstring "Dungeon"
if code.19="904" then sendstring "Forest"
if code.19="905" then sendstring "Bunk House(Save Game)"
if code.19="906" then sendstring "Training Guild"
if code.19="907" then sendstring "Magic Shoppe"
if code.19="908" then sendstring "Supply Depot"
if code.19="909" then sendstring "Black Dragon Tavern"
if code.19="910" then sendstring "Grocer"
if code.19="911" then sendstring "Brothel"
if code.19="912" then sendstring "Inn"
if code.19="913" then sendstring "Grog's Casino"
if code.19="914" then sendstring "The High council"
if code.19="915" then sendstring "Red Roof Bank"
if code.19="916" then sendstring "Post Office"
if code.19="917" Then sendstring "The Suicide Pit"
if code.19="918" then sendstring "Money Express Send"
if code.19="919" then sendstring "Dream Tavern(Msg Base)"
return

MessWithItem:
if ~exists(dtres) then do;transmit "\c7What Item?";signal town2;end
tinkering=1
locked=0
if dt.6=1 then locked=1
mess2:
Transmit "\c4Tinkering with Item...\n1"
transmit "\c7"dt.3"\n1"
transmit "\c3[\c7O\c3]\c5pen    \c3[\c7R\c3]\c5ead \c3[\c7J\c3]\c5immy"
transmit "\c3[\c7E\c3]\c5xamine \c3[\c7T\c3]\c5ake \c3[\c7D\c3]\c5isarm"
transmit "\c3[\c7L\c3]\c5eave   \c3[\c7C\c3]\c5heck for traps"
Sendstring "\n1\c4Your Choice:\c7 "
getchar
xtx=upper(left(Result,1))
if xtx="#" then signal theend
if xtx="L" Then do;transmit "leave";tinkering=0;signal town2;end
if xtx="R" & dt.1=3 then do;Transmit "Read";sendfile (dt.5);end
if xtx="R" & dt.1~=3 then do;tranmsit "Read What?";end
if xtx="T" then do;transmit "Take";call takeitem;end
if xtx="E" then do;transmit "Examine";call examineitem;end
if xtx="C" then do;Transmit "Check for Traps";call checktraps;end
if xtx="O" & dt.1=1 then do;Transmit "Open";call openchest;end
if xtx="O" & dt.1~=1 then do;transmit "\c7Open What?";end
if xtx="D" then do;transmit "Disarm";call disarmtrap;end
if xtx="J" then do;transmit "Jimmy The Lock";call jimmylock;end
signal mess2
takeitem:
if dt.4~=1 then do;Transmit "\c7Item cannot be taken!";return;end
if dt.1=2 then do;mpath=dt.5;signal foundmagic2;end
if dt.1=4 then do;u.20=u.20+dt.2;transmit "\c1You take the Coins.";signal gohome;end
return
JimmyLock:
if u.46=0 then do;transmit "\c3You have no Skill for that!";return;end
if u.43=0 then do;transmit "\c4You have no Tools!";return;end
if dt.6=1 then do
xv=random(1,100,time('s'))
if xv<=u.44 then do;Transmit "\c7You picked the Lock!";locked=0;return;end
if xv>u.44 then do;Transmit "\c7You failed to pick the lock!";locked=1;return;end
end
transmit "\c7What Lock?"
return
disarmtrap:
if u.46=0 then do;transmit "\c3You have no Skill for that!";return;end
xzx=random(1,100,time('s'))
if xzx<u.41 & dt.7=1 then do;transmit "\c7You Disarmed a Trap!";armed=2;return;end
if xzx>=u.41 & dt.7=1 then do;transmit "\c7You Failed!";call traphurt;return;end
transmit "\c7What Trap?"
return
traphurt:
xr=random(1,10,time('s'))
transmit "You set off the Trap!"
transmit "\c3It caused "xr" dmg to you!"
u.3=u.3-xr
call checkdeath
return
examineitem:
transmit "\n1\c4You carefully examine the item..\c3\n1"dt.3
if dt.6=1 then do;locked=1;transmit "\c3You notice it is Locked!";end
return
checkTraps:
if u.46=0 then do;transmit "\c3You have no Skill for that!";return;end
xvx=random(1,100,time('s'))
if xvx<u.40 & dt.7=1 then do;transmit "You Found a Trap!";trapf=1;armed=1;end
if xvx>=u.40 & dt.7=1 then do;Transmit "You found no Traps!";trapf=0;armed=1;end
return
openchest:
if dt.6=1 & locked=1 then do;Transmit "\c1It's Locked!";return;end
if dt.6=1 & locked=0 then do;transmit "\c1You open it!"
if dt.7=1 & armed~=2 then do;Transmit "\c2The Chest was Trapped!";call traphurt;end
Transmit "\c3And Find "dt.2" Coins inside!";u.20=u.20+dt.2
transmit "\c7You take them!"
signal killitem
end
if dt.6~=1 then Transmit "\c7Open What?"
return
killitem:
transmit "Wait..."
pathx="\$0delete "||dtres||"\"
transmit pathx
transmit "\h8"
tinkering=0
signal gohome

loadFoundMagic:
r=random(1,maxmagic,time('s'))
mpath=dagpath||"mitems/MagicItem."||r
foundmagic2:
if ~exists(Mpath) then do;Transmit "\c2Error in Magic System...sorry";signal gohome;end
call open(fle,mpath,"R")
do i=1 to 6
fm.i=readln(fle)
end
call close fle
wantmagic:
Transmit "\n1\c5You found \c1"fm.1"\c5."
sendstring "\c4Do you wish to take this Item?[y/n]:\c7 "
getchar
xtx=Upper(result)
if xtx="#" then signal theend
if xtx="Y" then do;transmit "Yes";signal findmagic;end
if xtx="N" then do;transmit "No!";signal gohome;end
Signal wantmagic

FindMagic:
call showmagic
findm2:
query "\c5Put "fm.1" into which Slot?\c2[\c71\c2-\c114\c2]:\c7 "
xtx=result
if left(xtx,1)="#" then signal theend
if datatype(xtx,'N')=0 then signal findm2
z=xtx
if z>14 then signal findm2
if z<1 then signal findm2
if left(ma1.z,5)~="Empty" then do;transmit "\c7That Slot is not Empty!";call dropmitem;end
transmit "\c5You take the "fm.1"!"
ma1.z=fm.1;ma2.z=fm.2;ma3.z=fm.3;ma4.z=fm.4;ma5.z=fm.5;ma6.z=fm.6
signal gohome

dropmitem:
sendstring "\c4Do you wish to drop the "ma1.z"?\c7 "
Getchar
xtx=upper(result)
if xtx="#" then signal theend
if xtx="Y" then do;transmit "Yes!";ma1.z=fm.1;ma2.z=fm.2;ma3.z=fm.3;ma4.z=fm.4;ma5.z=fm.5;ma6.z=fm.6;Transmit "\c4\n1You Dropped It and took the "fm.1".";signal gohome;end
transmit "No";end
signal findm2

Usemagic:
call showmagic
magi2:
Query "\c5\n1Use Which Item:\c7 "
xtx=upper(left(result,1))
if xtx="#" then signal theend
if datatype(xtx,'N')=0 then signal Magi2
if xtx<1 then do;transmit "\c5No such Item!";signal gohome;end
if xtx>14 then do;transmit "\c5No Such Item!";signal gohome;end
v=xtx
if left(ma1.v,5)="Empty" then do;transmit "\c5No Such Item!";signal gohome;end
transmit "\c4\n1Using \c1"ma1.v
ma6.v=1
if ma5.v~=999 then do;ma5.v=ma5.v-1;transmit "\c3Expending 1 Charge!";end
if ~exists(ma2.v) then do;transmit "\c2 NOTIFY SYSOP that ITEM doesNOT work!!!";signal gohome;end
call open(mitem,ma2.v,'R')
do until eof(mitem)=1;interpret readln(mitem);end
call close mitem
if ma5.v=0 then do;Transmit "\c4Your Item has Expended it's Final Charge...Poof.";ma1.v="Empty";ma2.v=0;ma3.v=0;ma4.v=0;ma5.v=0;ma6.v=0;end
signal gohome

ERROR:
Transmit "\c1\n1Program Cannot Continue.. Some type of Error"
Logentry 'DD_II - error Line# 'SIGL
logentry errortext (rc)
x = storage()
logentry x
temp="last room was: "||Droom
logentry temp
signal quit

IOERR:
Transmit "\c1\n1Program Cannot Continue.. I/O Error"
logentry 'DD_II - IOERR line# 'SIGL
x = storage()
logentry x
temp="last room was: "||Droom
logentry temp
signal quit

SYNTAX:
Transmit "\c1\n1Program Cannot Continue.. Syntax Error"
logentry 'DD_II - Syntax Line# 'SIGL
x = storage()
logentry x
temp="last room was: "||Droom
logentry temp
signal quit
