Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / May 2007



Tip: Looking for answers? Try searching our database.

there has to be a better way than this

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Santa Claus - 13 May 2007 00:27 GMT
currently, i have -1 set as meaning "no link" and 0 on up as meaning the
record number (NSMutableArray objectAtIndex) of something.

i currently check for it like this.
 if (ourDataRecord > -1)

there HAS to be a better way to check for non negative numbers.

i was considering using
 if (!(ourDataRecord < 0))
but it seems like it would simply increase the cpu load by adding a
possible negate into the object code.

i was thinking of
 if (ourDataRecord)
but that seems like any negative number would reflect a false positive
and a zero would reflect a false negative
Jens Ayton - 13 May 2007 00:38 GMT
Santa Claus:

> currently, i have -1 set as meaning "no link" and 0 on up as meaning the
> record number (NSMutableArray objectAtIndex) of something.
[quoted text clipped - 3 lines]
>
> there HAS to be a better way to check for non negative numbers.

if (ourDataRecord >= 0).

> i was considering using
>   if (!(ourDataRecord < 0))
> but it seems like it would simply increase the cpu load by adding a
> possible negate into the object code.

No.

Signature

Jens Ayton

Gregory Weston - 13 May 2007 01:12 GMT
> currently, i have -1 set as meaning "no link" and 0 on up as meaning the
> record number (NSMutableArray objectAtIndex) of something.

If you're dealing with NSArray indices (which you may note are
unsigned), there's a predefined constant already available to you:
NSNotFound.

> i currently check for it like this.
>   if (ourDataRecord > -1)
[quoted text clipped - 5 lines]
> but it seems like it would simply increase the cpu load by adding a
> possible negate into the object code.

You're overthinking. Don't make assumptions about what the compiler is
going to emit.

> i was thinking of
>   if (ourDataRecord)
> but that seems like any negative number would reflect a false positive
> and a zero would reflect a false negative

Your suspicion is correct.

Make your "invalid index" value NSNotFound and then test for
(in)equality to decide whether or not there's an entry to retrieve.

(This, by the way, also looks like you're headed into the area of
premature optimization. What are you trying to accomplish?)
Santa Claus - 13 May 2007 04:36 GMT
> > currently, i have -1 set as meaning "no link" and 0 on up as meaning the
> > record number (NSMutableArray objectAtIndex) of something.
[quoted text clipped - 28 lines]
> (This, by the way, also looks like you're headed into the area of
> premature optimization. What are you trying to accomplish?)

i don't know about premature optimization but i like to make things take
the least amount of time possible.

i have a total of 11 cardinal directions (the standard 8 plus up, down,
and out) and if something doesn't have an exit that direction, i put in
a -1 for it.  i was just looking for a better way to test for the -1 and
i think the NSNotFound way may be much better as it would also reflect
that the exit is not found.

but... that wouldn't make it valid for existing databases so i guess
i'll just make a constant that equals -1 and call it something not
found.  it's a little late to be giving names to constants tonight.
NSNotFound is NSNotFound = 0x7fffffff (maxint) in NSObjCRuntime.h.  if
it was ffffffff then it'd be compatable.
Michael Ash - 13 May 2007 05:08 GMT
>> (This, by the way, also looks like you're headed into the area of
>> premature optimization. What are you trying to accomplish?)
>
> i don't know about premature optimization but i like to make things take
> the least amount of time possible.

It may be unintuitive, but always making sure things take the least amount
of time possible is a poor way to make your code run fast.

Programmer time is a limited resource. This is equally true whether you're
working on a hobby project or running a team of hundreds working for a
giant corporation.

Code has hotspots. This is a universal truth. The 90/10 rule always wins;
90% of your execution time is spent in 10% of your code. Often it's more
like 95/5 or 99/1.

By trying to make all of your code fast, you waste most of your effort on
the 90% of the code that makes no difference anyway. By writing your code
with an eye towards clarity and correctness, then coming back later,
analyzing it, finding the critical 10% (or 5% or 1%) and putting your
limited resources into making that code fast, the final result is faster.

Note: this is not just something that programmers who don't care about
speed say to justify being lazy. This is how you write fast code. Trying
to make all of your code fast just makes all of your code buggy and
doesn't make it go any faster.

Credentialitis: I wrote my master's thesis on high performance computing,
including a big section on optimization techniques. I also wrote what is
probably the fastest Game of Life screensaver available on the Mac. I
doubt that most people who try to make all of their code run fast will be
able to get even 10% of my performance... at least on computers with hefty
video cards.

Speaking of Life, try to get within one millionth the long-term
performance of http://golly.sourceforge.net/ using a "make everything
fast" approach. In programming, work smarter, not harder.

Signature

Michael Ash
Rogue Amoeba Software

glenn andreas - 13 May 2007 14:57 GMT
> >> (This, by the way, also looks like you're headed into the area of
> >> premature optimization. What are you trying to accomplish?)
[quoted text clipped - 4 lines]
> It may be unintuitive, but always making sure things take the least amount
> of time possible is a poor way to make your code run fast.

[snip]

> Note: this is not just something that programmers who don't care about
> speed say to justify being lazy. This is how you write fast code. Trying
> to make all of your code fast just makes all of your code buggy and
> doesn't make it go any faster.

As Donald Knuth says "We should forget about small efficiencies, about
97% of the time.  Premature optimization is the root of all evil (or at
least most of it) in programming"

And Bill Harlan: "It is easier to optimize correct code than to correct
optimized code."

John Ousterhout: "The biggest performance increase you'll ever see is
when your system goes from not working to working"
Santa Claus - 13 May 2007 18:39 GMT
In article
<gandreas-F723FC.08575613052007@sn-ip.vsrv-sjc.supernews.net>,

> > >> (This, by the way, also looks like you're headed into the area of
> > >> premature optimization. What are you trying to accomplish?)
[quoted text clipped - 21 lines]
> John Ousterhout: "The biggest performance increase you'll ever see is
> when your system goes from not working to working"

you know, that COULD be the vast majority of my problems since i'm of
the mind that you shouldn't NEED 188k of program just to print "hello"
to the screen.  my mindset is still in the old 8-bit mode that you
needed to conserve every bit of memory and cpu clock cycle as possible
but i'm seeing now that with my complex programs and interconnected
things, that won't work real well.

but i still say if you're going through several objects just to get what
you want and need to access (read) it more than once, extract it to a
local variable once then access it.

an example:

tmp = ([[[myRoomArrayData objectAtIndex: roomrecord] objectForKey:
@"ExitN"] longValue] == roomID);
hadErrorInRoomData = (hadErrorInRoomData || tmp);
if (tmp)

instead of

hadErrorInRoomData = (hadErrorInRoomData || ([[[myRoomArrayData
objectAtIndex: roomrecord] objectForKey: @"ExitN"] longValue] ==
roomID));
if (([[[myRoomArrayData objectAtIndex: roomrecord] objectForKey:
@"ExitN"] longValue] == roomID))

after thinking about it, i could just use this

if (([[[myRoomArrayData objectAtIndex: roomrecord] objectForKey:
@"ExitN"] longValue] == roomID))
{
hadErrorInRoomData = YES;
Michael Ash - 13 May 2007 20:39 GMT
> you know, that COULD be the vast majority of my problems since i'm of
> the mind that you shouldn't NEED 188k of program just to print "hello"
> to the screen.

Obviously you don't need 188k of program to do this, as proven by the fact
that entire working OSes fit on disks smaller than that. However, it's a
lot easier to write the big one than it is to write the small one.

>  my mindset is still in the old 8-bit mode that you
> needed to conserve every bit of memory and cpu clock cycle as possible
> but i'm seeing now that with my complex programs and interconnected
> things, that won't work real well.

Exactly. It can be a hard thing to unlearn. I still catch myself thinking
about the per-cycle cost of operations, before realizing that this code
will run exactly one time and the difference in speed is 100 nanoseconds
versus 500 nanoseconds.

> but i still say if you're going through several objects just to get what
> you want and need to access (read) it more than once, extract it to a
[quoted text clipped - 21 lines]
> {
> hadErrorInRoomData = YES;

The primary purpose of your code should be correctness, followed closely
by clarity. (The two often go together, which is helpful.) Because of
this, I would vote for the last one just because it's vastly easier to
understand than the first two. I can glance at the last one and instantly
see what it's doing. The first two are confusing and weird.

Remember that programmer time is the most expensive part of your program's
operation, even when it's free, and that you waste a lot of time if you
write unclear code, either because it's hard to fix, or because you have
to take a lot of time to understand it when you come back to it later.

Signature

Michael Ash
Rogue Amoeba Software

Gregory Weston - 14 May 2007 01:27 GMT
> you know, that COULD be the vast majority of my problems since i'm of
> the mind that you shouldn't NEED 188k of program just to print "hello"
> to the screen.

Happily, you don't.

Actually, I vaguely wonder where "188k" came from. It's an odd number to
pull out of nowhere, but it has no actual relationship to the size of
the program you describe.

Amusingly, the (single-architecture) binary of the simplest Cocoa GUI
hello world program is over 30% smaller than the simplest C console
hello world.

> my mindset is still in the old 8-bit mode that you
> needed to conserve every bit of memory and cpu clock cycle as possible
> but i'm seeing now that with my complex programs and interconnected
> things, that won't work real well.

No, it won't. Because you're doing things that those 8-bit machines
weren't viable tools for in the first place. I deal with single files
today that dwarf the hard drive I owned in 1988 and the sum of all
storage media I owned in 1985.

But even then, significantly optimizing something that wasn't done was a
waste of effort.

G
Santa Claus - 14 May 2007 23:34 GMT
> > you know, that COULD be the vast majority of my problems since i'm of
> > the mind that you shouldn't NEED 188k of program just to print "hello"
[quoted text clipped - 5 lines]
> pull out of nowhere, but it has no actual relationship to the size of
> the program you describe.

188k was the size of the old mac programmer's workshop compiled program
using Pascal to open a window resource and print hello to that window
(at least on my compiler).  when i saw the size of the code, i balked at
it saying it's a horrible waste of space.  JUST because computers have
more ram and hard drive space, it didn't mean we need to fill it up with
useless stuff.

ok, enough ranting here...  time to get back to the debugger and see if
there are more bugs i didn't even know about in my code.  i found
several of them already and that's just one section of 27 sections.

my thanks to ALL of you for pointing out how i can debug my plugin code.

out of curiosity, in breaking files apart into smaller ones, what would
you guys say is a good rule?  NSString.h is obviously one file that
pertains to one project and is most likely (it would seem to me) one
file as a .c or .m file.  this means to me everything to deal with
strings are in one file or includes that make up one file once
everything is included. that would also suggest to me that my method of
breaking files apart into smaller files is in much the same way similar
methodology (everything that pertains to a specific subject is in one
file).  am i missing something important in the concept here? put each
method in its own file?

i'm trying to make my programs look more like yours (smaller files) but
some things are senseless to me AS I UNDERSTAND IT.  long, complex
routines are bound to break some barrier but those routines cannot be
broken down without breaking them.

robert dell.
Michael Ash - 15 May 2007 01:20 GMT
> out of curiosity, in breaking files apart into smaller ones, what would
> you guys say is a good rule?  NSString.h is obviously one file that
[quoted text clipped - 6 lines]
> file).  am i missing something important in the concept here? put each
> method in its own file?

Well you have this part down, but I'd say that it's rather useless. One
subject per file is good, but not very interesting. The proper question to
ask is, how do you determine what a "subject" is?

In an object-oriented language such as ObjC, generally you have one class
per file. So a class is a subject. Again, not interesting. The big design
question is where you draw lines between your classes.

I have no special knowledge of Cocoa or access to how it's built, but from
what I've seen it's obvious that NSString has several subclasses which are
almost certainly implemented in separate files. There's NSString,
NSMutableString, NSConstantString, NSCFString, NSBigMutableString, etc.
Aside from that, there's also a bunch of "string" classes which aren't
actually related no NSString, such as NSAttributedString and all of its
friends. All of this stuff goes in separate files.

The key concept is not keeping your files small, but keeping your classes
small. When you have a single class which is five thousand lines long then
it does too much. It just so happens that this means your file is five
thousand lines long too, but the key problem is the size of the class.

The reason to have small classes is because it makes good design easier.
Good design entails small units of code which perform a specific task,
with clearly defined interfaces between them. Classes are those small
units of code, and the clearly defined interfaces are their public
methods. When you have a gigantic class, you tend to end up with pieces of
the class doing different things, but with no clearly defined interfaces
between them because every piece has access to the whole class. This makes
it difficult to make changes because you're not sure what's accessing
what, or what conditions are needed dto properly invoke some code, or
whatever.

> i'm trying to make my programs look more like yours (smaller files) but
> some things are senseless to me AS I UNDERSTAND IT.  long, complex
> routines are bound to break some barrier but those routines cannot be
> broken down without breaking them.

I'm certain that they can, you just don't realize how. In my own code, if
I can't see the entire method in an editor window at one time then I
consider it to be too long. Even then I strive for smallness. It's not so
much the length of the method as it is the complexity, but the two tend to
go hand in hand. Breaking them up into smaller methods is usually easy and
helps clarity a lot. If you're lucky you'll suddenly discover that you can
reuse one of the smaller pieces too.

If you want, pick one of these huge methods and post it, and maybe we can
chop it down to size.

Signature

Michael Ash
Rogue Amoeba Software

Santa Claus - 17 May 2007 01:24 GMT
> If you want, pick one of these huge methods and post it, and maybe we can
> chop it down to size.

i can't see any way to break THIS down.  it's a parser for incoming game text to perform tasks on that text
it's not so much complicated, it's just that everything needs to be tested against
for every line that comes from the game.

the declaration of the routine must be as it's typed or the plugin won't work.

----- clip -----

-(BOOL)processString: (NSString **)theString attributedString: (NSMutableAttributedString **)otherString
{
 [rawStuff appendRawText: *theString];
 long loc = 0;
 if (isLogging)
   {
   NSMutableString *mystring1 = [NSMutableString string];
   [mystring1 setString: [NSString stringWithString: *theString]];
   ignoreReplaceResults = [mystring1 replaceOccurrencesOfString: @"\r" withString: @"" options: NSCaseInsensitiveSearch range: NSMakeRange(0,[mystring1 length])];
   [logString appendString: mystring1];
   if ([logString length] > 8192)
     {
     NSFileHandle *logFileHandle;
     logFileHandle = [NSFileHandle fileHandleForWritingAtPath: [NSString stringWithString: logFileName]]; //telling aFilehandle what file write to
     [logFileHandle truncateFileAtOffset:[logFileHandle seekToEndOfFile]]; //setting aFileHandle to write at the end of the file
     [logFileHandle writeData:[logString dataUsingEncoding: nil]]; //actually write the data
     [logString setString: @""];
     }
   }
 BOOL okToDisplay = YES;
 if (theString == nil)
   {
   NSLog(@"nil inserted");
   }
 if (*theString == nil)
   {
   NSLog(@"nil inserted");
   }
 NSMutableString *mytempstring1 = [NSMutableString string];
 [mytempstring1 setString: [NSString stringWithString: *theString]];
 //You have been given these as the strengths and weaknesses of your body
 if ([*theString rangeOfString: @"You have been given these as the strengths and weaknesses of your body" options: NSCaseInsensitiveSearch].location != NSNotFound)
   {
   cmStatCheck = YES;
   }
 //To select your character's hair, skin and eye color, go NORTH
 if ([*theString rangeOfString: @"To select your character's hair, skin and eye color, go NORTH" options: NSCaseInsensitiveSearch].location != NSNotFound)
   {
   cmStatCheck = NO;
   }
 if (cmStatCheck)
   {
   //Strength=6 Reflex=8 Agility=10
   //Charisma=7 Discipline=7 Wisdom=7
   //Intelligence=9 Stamina=9
 
   if (loc = [*theString rangeOfString: @"Strength" options: NSCaseInsensitiveSearch].location != NSNotFound)
     {
     mystats[0].statvalue = [self getvalueof: [*theString substringWithRange: NSMakeRange(loc, 12)]];
     [mystats[0].statname setString: @"Strength"];
     }
   if (loc = [*theString rangeOfString: @"Reflex" options: NSCaseInsensitiveSearch].location != NSNotFound)
     {
     mystats[1].statvalue = [self getvalueof: [*theString substringWithRange: NSMakeRange(loc, 10)]];
     [mystats[1].statname setString: @"Reflex"];
     }
   if (loc = [*theString rangeOfString: @"Agility" options: NSCaseInsensitiveSearch].location != NSNotFound)
     {
     mystats[2].statvalue = [self getvalueof: [*theString substringWithRange: NSMakeRange(loc, [*theString length] - loc)]];
     [mystats[2].statname setString: @"Agility"];
     }
   if (loc = [*theString rangeOfString: @"Charisma" options: NSCaseInsensitiveSearch].location != NSNotFound)
     {
     mystats[3].statvalue = [self getvalueof: [*theString substringWithRange: NSMakeRange(loc, 12)]];
     [mystats[3].statname setString: @"Charisma"];
     }
   if (loc = [*theString rangeOfString: @"Discipline" options: NSCaseInsensitiveSearch].location != NSNotFound)
     {
     mystats[4].statvalue = [self getvalueof: [*theString substringWithRange: NSMakeRange(loc, 14)]];
     [mystats[4].statname setString: @"Discipline"];
     }
   if (loc = [*theString rangeOfString: @"Wisdom" options: NSCaseInsensitiveSearch].location != NSNotFound)
     {
     mystats[5].statvalue = [self getvalueof: [*theString substringWithRange: NSMakeRange(loc, [*theString length] - loc)]];
     [mystats[5].statname setString: @"Wisdom"];
     }
   if (loc = [*theString rangeOfString: @"Intelligence" options: NSCaseInsensitiveSearch].location != NSNotFound)
     {
     mystats[6].statvalue = [self getvalueof: [*theString substringWithRange: NSMakeRange(loc, 16)]];
     [mystats[6].statname setString: @"Intelligence"];
     }
   if (loc = [*theString rangeOfString: @"Stamina" options: NSCaseInsensitiveSearch].location != NSNotFound)
     {
     mystats[7].statvalue = [self getvalueof: [*theString substringWithRange: NSMakeRange(loc, [*theString length] - loc)]];
     [mystats[7].statname setString: @"Stamina"];
     }
   }
 if ((![self isOldLine: mytempstring1]) || (!iAmRecording))
   {
   if (firstrun)
     {
     //Welcome to DragonRealms
     NSString *mystring1 = [NSString stringWithString: *theString];
     loc = [mystring1 rangeOfString: @"Welcome to"].location;
     if ((loc != NSNotFound) && ([myGame length] == 0))
       {
       [myGame setString: mystring1];
       }
     if ([myGame length] > 0)
       {
       loc = [myGame rangeOfString: @"DragonRealms" options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         [myGameCode setString: @"DR"];
         loc = [mystring1 rangeOfString: @"Welcome to" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           NSMutableString *mystring3 = [NSMutableString string];
           [mystring3 setString: @"pause 1"];
           [self mySendScriptCommand: [NSString stringWithString: mystring3]];
           [mystring3 setString: @"inf"];
           [self mySendScriptCommand: [NSString stringWithString: mystring3]];
           if (!prefsloaded)
             {
             [self loadprefs];
             }
           }
         loc = [mystring1 rangeOfString: @"Please wait." options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           NSMutableString *mystring3 = [NSMutableString string];
           NSMutableString *mystring4 = [NSMutableString string];
           [mystring3 setString: @"pause 1"];
           [mystring4 setString: lastCommand];
           [self mySendScriptCommand: [NSString stringWithString: mystring3]];
           [self mySendScriptCommand: [NSString stringWithString: mystring4]];
           }
         loc = [mystring1 rangeOfString: @"Dokoras" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           NSMutableString *mystring3 = [NSMutableString string];
           [mystring3 appendString: @"exp all 0"];
           if ((doFollow) && (!isSleeping))
             {
             [mystring3 appendString: @"\njoin "];
             [mystring3 appendString: myLeader];
             }
           [self mySendScriptCommand: [NSString stringWithString: mystring3]];
           }
         loc = [mystring1 rangeOfString: @"Overall state of mind" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           [self mySendScriptCommand: [NSString stringWithString: @"spell\nlook"]];
           firstrun = NO;
           if (runAutostartScript)
             {
             [myScriptCommandLine setString: autostartScriptName];
             [self breakDownLine: myScriptCommandLine expandVariables: NO scriptnumber: -1];
             if ([myLineArray count] > 0)
               {
               [scriptEngineStuff loadScript:[NSMutableString stringWithString: [myLineArray objectAtIndex:0]] withCaller: -1];
               }
             }
           }
         }
       loc = [myGame rangeOfString: @"GemStone" options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         [myGameCode setString: @"GS"];
         myRT = 15;
         loc = [mystring1 rangeOfString: @"Welcome to" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           NSMutableString *mystring3 = [NSMutableString string];
           [mystring3 appendString: @"skills full"];
           [self mySendScriptCommand: [NSString stringWithString: mystring3]];
           }
         loc = [mystring1 rangeOfString: @"pickpocketing" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           NSMutableString *mystring3 = [NSMutableString string];
           [mystring3 appendString: @"info"];
           [self mySendScriptCommand: [NSString stringWithString: mystring3]];
           }
         loc = [mystring1 rangeOfString: @"silver" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           NSMutableString *mystring3 = [NSMutableString string];
           [mystring3 appendString: @"look"];
           [self mySendScriptCommand: [NSString stringWithString: mystring3]];
           firstrun = NO;
           }
         if (!prefsloaded)
           {
           [self loadprefs];
           }
         lockingMagic = NO;
         doTeach = NO;
         doListen = NO;
         doFollow = NO;
         doPer = NO;
         if (runAutostartScript)
           {
           [myScriptCommandLine setString: autostartScriptName];
           [self breakDownLine: myScriptCommandLine expandVariables: NO scriptnumber: -1];
           if ([myLineArray count] > 0)
             {
             [scriptEngineStuff loadScript:[NSMutableString stringWithString: [myLineArray objectAtIndex:0]] withCaller: -1];
             }
           }
         }
       loc = [myGame rangeOfString: @"Modus" options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         [myGameCode setString: @"MOD"];
         firstrun = NO;
         if (!prefsloaded)
           {
           [self loadprefs];
           }
         if (runAutostartScript)
           {
           [myScriptCommandLine setString: autostartScriptName];
           [self breakDownLine: myScriptCommandLine expandVariables: NO scriptnumber: -1];
           if ([myLineArray count] > 0)
             {
             [scriptEngineStuff loadScript:[NSMutableString stringWithString: [myLineArray objectAtIndex:0]] withCaller: -1];
             }
           }
         }
       loc = [myGame rangeOfString: @"Alliance" options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         [myGameCode setString: @"AOH"];
         firstrun = NO;
         if (!prefsloaded)
           {
           [self loadprefs];
           }
         if (runAutostartScript)
           {
           [myScriptCommandLine setString: autostartScriptName];
           [self breakDownLine: myScriptCommandLine expandVariables: NO scriptnumber: -1];
           if ([myLineArray count] > 0)
             {
             [scriptEngineStuff loadScript:[NSMutableString stringWithString: [myLineArray objectAtIndex:0]] withCaller: -1];
             }
           }
         }
       }
     }
   if (YES) // always check for these
     {
     NSString *mystring1 = [NSString stringWithString: *theString];
     if (keepOn)
       {
       if ([mystring1 rangeOfString: @"PLEASE RESPOND"].location != NSNotFound)
         {
         [self mySendCommand: [NSMutableString stringWithString: @"exp all 0"]];
         [self mySendCommand: [NSMutableString stringWithString: @"look"]];
         }
       }
     
     if (doSpeak)
       {
       if (([mystring1 rangeOfString: @"says, "].location != NSNotFound) || ([mystring1 rangeOfString: @"asks, "].location != NSNotFound) || ([mystring1 rangeOfString: @"exclaims, "].location != NSNotFound) || ([mystring1 rangeOfString: @"says to you, "].location != NSNotFound) || ([mystring1 rangeOfString: @"asks you, "].location != NSNotFound) || ([mystring1 rangeOfString: @"exclaims to you, "].location != NSNotFound) || ([mystring1 rangeOfString: @"whispers, "].location != NSNotFound) || ([mystring1 rangeOfString: @"whispers to your group, "].location != NSNotFound))
         {
         [self mySpeakIt: mystring1];
         }
       }
     int loc = 0;
     long ignoreresults;
     unsigned long long tempvalue3;
     ignoreresults = [self getvalueof: mystring1];
     ignoreresults = [mystring1 length];
     if (ignoreresults > 0)
       {
       tempvalue3 = (randseed & 0x8000000000000000LL);
       tempvalue3 >>= 63;
       randseed <<= 1;
       randseed ^= tempvalue3;
       randseed ^= (long long)ignoreresults;
       }
     
     isStunned     = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex:  0] boolValue];
     isBleeding    = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex:  1] boolValue];
     isJoined      = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex:  2] boolValue];
     isHidden      = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex:  3] boolValue];
     isWebbed      = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex:  4] boolValue];
     isInvisible   = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex:  5] boolValue];
     isKneeling    = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex:  6] boolValue];
     isProne       = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex:  7] boolValue];
     isSitting     = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex:  8] boolValue];
     isStanding    = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex:  9] boolValue];
     isPoisoned    = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex: 10] boolValue];
     isDiseased    = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex: 11] boolValue];
     isDead        = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex: 12] boolValue];
     isUnconscious = [[[[myCharacterArray objectAtIndex: 0] objectForKey: @"Player Status"] objectAtIndex: 13] boolValue];
     isUnableToContinue = (isStunned || isWebbed || isUnconscious || isDead);
     
     loc = [mystring1 rangeOfString: @"...wait " options: NSCaseInsensitiveSearch].location;
     if ((loc != NSNotFound) && (loc < 2))
       {
       myRT = myRT+([self getvalueof: mystring1]*10);
       }
     loc = [mystring1 rangeOfString: @"Roundtime changed to " options: NSCaseInsensitiveSearch].location;
     if ((loc != NSNotFound) && (loc < 2))
       {
       myRT = myRT+([self getvalueof: mystring1]*10) - previousRoundTime;
       inHaste = YES;
       }
     loc = [mystring1 rangeOfString: @"Cast Roundtime" options: NSCaseInsensitiveSearch].location;
     if ((loc != NSNotFound) && (loc < 2))
       {
       castRoundTime = [self getvalueof: mystring1] * 10;
       }
     loc = [mystring1 rangeOfString: @"Roundtime: " options: NSCaseInsensitiveSearch].location;
     if ((loc != NSNotFound) && (loc < 2))
       {
       if (inHaste)
         {
         inHaste = NO;
         }
       if (([mystring1 rangeOfString: @"\[" options: NSCaseInsensitiveSearch].location == NSNotFound) && ([mystring1 rangeOfString: @"]" options: NSCaseInsensitiveSearch].location == NSNotFound))
         {
         previousRoundTime = ([self getvalueof: mystring1] * 10);
         myRT = myRT + previousRoundTime;
         }
       }
     loc = [mystring1 rangeOfString: @"round time" options: NSCaseInsensitiveSearch].location;
     if ((loc != NSNotFound) && (loc < 2))
       {
       previousRoundTime = ([self getvalueof: mystring1] * 10);
       myRT = myRT + previousRoundTime;
       }
     /*    if (([[[myCharacterArray objectAtIndex: 0] objectForKey: @"Roundtime Value"] intValue]*100) > myRT)
       {
       myRT = ([[[myCharacterArray objectAtIndex: 0] objectForKey: @"Roundtime Value"] intValue]*100)+5;
       } */
     if ((myRT > 0) && (!myInRT))
       {
       [rtTimer setFireDate: [NSDate date]];
       }
     if (!isWalking)
       {
       
       [scriptEngineStuff checkScriptMatchStrings: [NSMutableString stringWithString: mystring1]];
       }
     
     if (doSing)
       {
       //(Time to Next Singing: 24 seconds.)
       loc = [mystring1 rangeOfString: @"Time to Next Singing: "].location;
       if (loc != NSNotFound)
         {
         long singtime = [self getvalueof: mystring1]+2;
         [singTimer setFireDate: [NSDate dateWithTimeIntervalSinceNow: singtime]];
         }
       }
     if ((isWalking) && ([stopWalkingAt length] > 0))
       {
       loc = [mystring1 rangeOfString: @"you also see" options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         NSMutableString *buildString = [NSMutableString string];
         [buildString setString: [mystring1 substringFromIndex: loc]];
         if ([buildString rangeOfString: stopWalkingAt].location != NSNotFound)
           {
           isWalking = NO;
           [buildString setString: @"Stopped walking, found "];
           [buildString appendString: stopWalkingAt];
           [buildString appendString: @"."];
           [self boxMessage: [NSString stringWithString: buildString]];
           [mapStuff drawMap];
           }
         }
       }
     if (getRoomDescription1)
       {
       if ([roomDescription1 length] > [mystring1 length])
         {
         NSMutableString *mystr = [NSMutableString string];
         [mystr setString: mystring1];
         ignoreReplaceResults = [mystr replaceOccurrencesOfString: @"\r" withString: @" " options: NSCaseInsensitiveSearch range: NSMakeRange(0,[mystr length])];
         ignoreReplaceResults = [mystr replaceOccurrencesOfString: @"\n" withString: @" " options: NSCaseInsensitiveSearch range: NSMakeRange(0,[mystr length])];
         if ([roomDescription1 rangeOfString: mystr options: NSCaseInsensitiveSearch range: NSMakeRange([roomDescription1 length]-[mystr length],[mystr length])].location == NSNotFound)
           {
           [roomDescription1 appendString: [NSMutableString stringWithString: mystr]];
           }
         }
       else
         {
         [roomDescription1 appendString: [NSMutableString stringWithString: mystring1]];
         }
       ignoreReplaceResults = [roomDescription1 replaceOccurrencesOfString: @"\r" withString: @" " options: NSCaseInsensitiveSearch range: NSMakeRange(0,[roomDescription1 length])];
       ignoreReplaceResults = [roomDescription1 replaceOccurrencesOfString: @"\n" withString: @" " options: NSCaseInsensitiveSearch range: NSMakeRange(0,[roomDescription1 length])];
       }
     // check next room failure
     //You can't go there.
     //What were you referring to?
     //You can't
     //i could not find
     //stops you
     //You are engaged
     //Bonk! You smash your nose.
     //and blocks
     //You will have to
     //You must be standing
     //so you're stuck here
     //You'll have to wait
     if ((([mystring1 rangeOfString: @"You can't" options: NSCaseInsensitiveSearch].location != NSNotFound) && ([mystring1 rangeOfString: @"You can't be" options: NSCaseInsensitiveSearch].location == NSNotFound)) ||
         ([mystring1 rangeOfString: @"What were you" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"i could not find" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"stops you" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"You are engaged" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"Bonk! You smash your nose." options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"and blocks you" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"perhaps you shuld hide yourself first" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"...wait" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"you will have to" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"You must be standing" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"so you're stuck here" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"You'll have to wait" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"You can't swim in that direction" options: NSCaseInsensitiveSearch].location != NSNotFound) ||
         ([mystring1 rangeOfString: @"free up your" options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff clearDirectionCommand];
       if ([walkDirections count] > 0)
         {
         [walkDirections removeAllObjects];
         isWalking = NO;
         [self boxMessage: @"Stopped walking, error occurred."];
         [mapStuff drawMap];
         }
       }
     // check the next room
     if ((([mystring1 rangeOfString: @"Obvious paths: "].location != NSNotFound) || ([mystring1 rangeOfString: @"Obvious exits: "].location != NSNotFound)) || (([mystring1 rangeOfString: @"Ship paths: "].location != NSNotFound)))
       {
       if (([mystring1 rangeOfString: @"Ship paths: "].location == NSNotFound))
         {
         [mapStuff popDirectionCommand];
         }
       getRoomDescription1 = NO;
       if (isDebugging)
         {
         //NSLog(@"got next room");
         }
       nextRoom = YES;
       [directionLine setString: [NSString stringWithString: mystring1]];
       [self breakline2: directionLine];
       previousRoomNumber = currentRoomNumber;
       [self calculateDirections];
       if (enableAutomapper || mapwindowvisible)
         {
         [mapStuff idsearch];
         }
       if (isDebugging)
         {
         //[self echoTextToGameScreen: [NSMutableString stringWithString: @"\nRoom number --> "]];
         //[self echolong: currentRoomNumber];
         }
       if (isWalking)
         {
         if ([walkDirections count] > 0)
           {
           [self mySendScriptCommand: [NSString stringWithString: [walkDirections objectAtIndex: 0]]];
           [walkDirections removeObjectAtIndex: 0];
           if ([walkDirections count] == 0)
             {
             isWalking = NO;
             [self boxMessage: @"Stopped walking, target reached."];
             [mapStuff drawMap];
             }
           lastDirection = -1;
           }
         else
           {
           if (countDirections == 2)
             {
             [self moveDirection: lastDirection];
             }
           else
             {
             isWalking = NO;
             [mapStuff drawMap];
             if (countDirections == 1)
               {
               [self boxMessage: @"Stopped walking, dead end."];
               }
             else
               {
               [self boxMessage: @"Stopped walking, multiple choices available."];
               }
             }
           }
         }
       if ([myAllScriptsArray count] > 0)
         {
         int counter = 0;
         for (counter=0; counter < [myAllScriptsArray count]; counter++)
           {
           if ([[[myAllScriptsArray objectAtIndex: counter] objectForKey: @"myscriptstatus"] intValue] == myscriptwaitingnextroom)
             {
             [[myAllScriptsArray objectAtIndex: counter] setObject:[NSNumber numberWithInt: myscriptrunning] forKey: @"myscriptstatus"];
             [scriptWindowStuff fillScriptWindow];
             }
           }
         }
       if (YES)  // detect the room data
         {
         loc = [roomDescription1 rangeOfString: @" You also see" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           [youAlsoSee setString: [roomDescription1 substringWithRange: NSMakeRange(loc + 14, (([roomDescription1 length] - 14) - loc))]];
           if ([youAlsoSee rangeOfString: @" Obvious" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             [youAlsoSee setString: [youAlsoSee substringWithRange: NSMakeRange(0, ([youAlsoSee rangeOfString: @" Obvious" options: NSCaseInsensitiveSearch].location))]];
             }
           }
         else
           {
           [youAlsoSee setString: @""];
           }
         loc = NSNotFound;
         loc = [roomDescription1 rangeOfString: @"Also in the room:" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           if ([youAlsoSee length] > 0)
             {
             if ([youAlsoSee rangeOfString: @"Also in the room:" options: NSCaseInsensitiveSearch].location != NSNotFound)
               {
               [youAlsoSee setString: [youAlsoSee substringWithRange: NSMakeRange(0, [youAlsoSee rangeOfString: @"Also in the room:" options: NSCaseInsensitiveSearch].location)]];
               }
             }
           [alsoHere setString: [roomDescription1 substringWithRange: NSMakeRange(loc + 18, (([roomDescription1 length] - 18) - loc))]];
           if ([alsoHere rangeOfString: @" Obvious" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             [alsoHere setString: [alsoHere substringWithRange: NSMakeRange(0, ([alsoHere rangeOfString: @" Obvious" options: NSCaseInsensitiveSearch].location))]];
             }
           }
         else
           {
           loc = [roomDescription1 rangeOfString: @"Also here" options: NSCaseInsensitiveSearch].location;
           if (loc != NSNotFound)
             {
             if ([youAlsoSee length] > 0)
               {
               if ([youAlsoSee rangeOfString: @"Also here" options: NSCaseInsensitiveSearch].location != NSNotFound)
                 {
                 [youAlsoSee setString: [youAlsoSee substringWithRange: NSMakeRange(0, ([youAlsoSee rangeOfString: @"Also here" options: NSCaseInsensitiveSearch].location))]];
                 }
               }
             [alsoHere setString: [roomDescription1 substringWithRange: NSMakeRange(loc + 10, (([roomDescription1 length] - 10) - loc))]];
             if ([alsoHere rangeOfString: @" Obvious" options: NSCaseInsensitiveSearch].location != NSNotFound)
               {
               [alsoHere setString: [alsoHere substringWithRange: NSMakeRange(0, ([alsoHere rangeOfString: @" Obvious" options: NSCaseInsensitiveSearch].location))]];
               }
             }
           }
         if (loc == NSNotFound)
           {
           [alsoHere setString: @""];
           }
         }
       }
     if ((getRoomDescription) && ([mystring1 caseInsensitiveCompare: [lastCommand stringByAppendingString: @"\r\n"]] != NSOrderedSame))
       {
       //NSLog(@"got room description\nlastcommand = %@\nroomDescription = %@ ", lastCommand, mystring1);
       [roomDescription setString: [NSString stringWithString: mystring1]];
       ignoreReplaceResults = [roomDescription replaceOccurrencesOfString: @"\r" withString: @"" options: NSCaseInsensitiveSearch range: NSMakeRange(0,[roomDescription length])];
       ignoreReplaceResults = [roomDescription replaceOccurrencesOfString: @"\n" withString: @"" options: NSCaseInsensitiveSearch range: NSMakeRange(0,[roomDescription length])];
       getRoomDescription = NO;
       }
     // check for the room title
     if (([mystring1 rangeOfString: @"["].location != NSNotFound) && ([mystring1 rangeOfString: @"]"].location != NSNotFound) && ([mystring1 rangeOfString: @".]"].location == NSNotFound) && ([mystring1 rangeOfString: @"]"].location > ([mystring1 length]-4)) && ([mystring1 rangeOfString: @"roundtime" options: NSCaseInsensitiveSearch].location == NSNotFound) && ([mystring1 rangeOfString: @"roomTitle" options: NSCaseInsensitiveSearch].location == NSNotFound))
       {
       [roomDescription setString: @""];
       [roomDescription1 setString: @""];
       [roomTitle setString: [NSString stringWithString: mystring1]];
       ignoreReplaceResults = [roomTitle replaceOccurrencesOfString: @"\r" withString: @"" options: NSCaseInsensitiveSearch range: NSMakeRange(0,[roomTitle length])];
       ignoreReplaceResults = [roomTitle replaceOccurrencesOfString: @"\n" withString: @"" options: NSCaseInsensitiveSearch range: NSMakeRange(0,[roomTitle length])];
       getRoomDescription = YES;
       getRoomDescription1 = YES;
       }
     
     if (doTend)
       {
       NSString *mystring1 = [NSString stringWithString: *theString];
       //    NSString *mystring2 = [NSString stringWithString: *theString];
       //The bandages binding your chest become useless and fall apart.
       int loc = [mystring1 rangeOfString: @"The bandages binding your "].location;
       if (loc != NSNotFound)
         {
         mystring1 = [mystring1 substringFromIndex: loc+26];
         loc = [mystring1 rangeOfString: @" become"].location;
         if (loc == NSNotFound)
           {
           loc = [mystring1 rangeOfString: @" soak through"].location;
           }
         if (isUnwrapping)
           {
           myRT = 15;
           isUnwrapping = NO;
           }
         mystring1 = [[mystring1 substringFromIndex: 0] substringToIndex: loc];
         NSMutableString *mystring3 = [NSMutableString string];
         [mystring3 appendString: @"tend my "];
         [mystring3 appendString: mystring1];
         [self mySendCommand: [NSMutableString stringWithString: mystring3]];
         [mystring3 setString: @"exp first aid"];
         [self mySendCommand: [NSMutableString stringWithString: mystring3]];
         if (doHide)
           {
           [mystring3 setString: @"hide"];
           [self mySendCommand: [NSMutableString stringWithString: mystring3]];
           }
         [mystring3 setString: @"hea"];
         [self mySendCommand: [NSMutableString stringWithString: mystring3]];
         }
       }
     if ([mystring1 rangeOfString: @"forces you out" options: NSCaseInsensitiveSearch].location != NSNotFound)
       {
       [followingWho setString: @""];
       }
     if ([mystring1 rangeOfString: @"You join " options: NSCaseInsensitiveSearch].location != NSNotFound)
       {
       loc = [mystring1 rangeOfString: @"'s" options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         [followingWho setString: [mystring1 substringWithRange: NSMakeRange(9, loc-9)]];
         }
       }
     loc = [mystring1 rangeOfString: @" clasps your hand" options: NSCaseInsensitiveSearch].location;
     if (loc != NSNotFound)
       {
       [followingWho setString: [mystring1 substringWithRange: NSMakeRange(0, loc)]];
       }
     loc = [mystring1 rangeOfString: @" reaches over and holds your hand" options: NSCaseInsensitiveSearch].location;
     if (loc != NSNotFound)
       {
       [followingWho setString: [mystring1 substringWithRange: NSMakeRange(0, loc)]];
       }
     /*
      NW = forward to port
      N = forward
      NE = forward to starboard
      W = port
      E = starboard
      SW = aft to port
      SE = aft to starboard
      S = aft
      */      
     if ([followingWho length] == 0)
       {
       [followingWho setString: @"******"];
       }
     if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went northwest"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group moves forward to port"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you northwest"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"nw"];
       }
     else if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went northeast"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group moves forward to starboard"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you northeast"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"ne"];
       }
     else if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went north"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group moves forward"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you north"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"n"];
       }
     else if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went southwest"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group moves aft to port"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you southwest"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"sw"];
       }
     else if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went southeast"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group moves aft to starboard"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you southeast"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"se"];
       }
     else if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went south"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group moves aft"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you south"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"s"];
       }
     else if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went east"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group moves starboard"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you east"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"e"];
       }
     else if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went west"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group moves port"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you west"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"w"];
       }
     else if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went up"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you up"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"u"];
       }
     else if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went down"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you down"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"d"];
       }
     else if (([mystring1 rangeOfString: [followingWho stringByAppendingString: @"'s group just went out"] options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: [followingWho stringByAppendingString: @"grabs you and drags you out"] options: NSCaseInsensitiveSearch].location != NSNotFound))
       {
       [mapStuff appendDirectionCommand: @"o"];
       }
     if ([followingWho isEqualTo: @"******"])
       {
       [followingWho setString: @""];
       }
     }
 
 
   if ([myGameCode rangeOfString: @"GS" options: NSCaseInsensitiveSearch].location != NSNotFound)
     {
     NSMutableString *mystring0 = [NSMutableString string];
     [mystring0 setString: [NSString stringWithString: *theString]];
     if ((doExp) && ([mystring0 rangeOfString: @"\""].location == NSNotFound))
       {
       NSMutableString *mystring1 = [NSMutableString string];
       [mystring1 setString: [NSString stringWithString: *theString]];
       int i=0;
       for (i=0; i<10; i++)
         {
         if ([mystring1 rangeOfString: mygsstats[i].statname].location != NSNotFound)
           {
           //Strength (STR):    92 (6)     ...   92 (6)
           NSMutableString *mystring2 = [NSMutableString string];
           [mystring2 setString: [NSString stringWithString: *theString]];
           int loc = [mystring1 rangeOfString: @":"].location;
           [mystring2 setString: [mystring1 substringFromIndex: loc+1]];
           [mystring1 setString: [mystring1 substringFromIndex: loc+1]];
           loc = [mystring1 rangeOfString: @"("].location;
           if (loc != NSNotFound)
             {
             [mystring1 setString: [mystring1 substringToIndex: loc]];
             [mystring2 setString: [mystring2 substringFromIndex: loc]];
             }
           mygsstats[i].statvalue = [self getfullvalueof: [NSString stringWithString: mystring1]];
           if (loc != NSNotFound)
             {
             [mystring1 setString: [mystring1 substringToIndex: loc]];
             loc = [mystring2 rangeOfString: @")"].location;
             [mystring2 setString: [mystring2 substringToIndex: loc]];
             mygsstats[i].bonusvalue = [self getfullvalueof: [NSString stringWithString: mystring2]];
             }
           else
             {
             mygsstats[i].bonusvalue = 0;
             }
           i = 9;
           }
         }
       for (i=0; i<47; i++)
         {
         if ([mystring1 rangeOfString: mygsskills[i].skillname].location != NSNotFound)
           {
           // NSLog(mystring1);
           //  Pickpocketing......................|
           //  Pickpocketing......................|       0       0
           NSMutableString *mystring2 = [NSMutableString string];
           [mystring2 setString: [NSString stringWithString: *theString]];
           int loc = [mystring1 rangeOfString: @"|"].location;
           [mystring2 setString: [mystring1 substringFromIndex: loc+1]];
           [mystring1 setString: [mystring1 substringFromIndex: loc+1]];
           [mystring2 setString: [mystring2 substringFromIndex: 9]];
           [mystring1 setString: [mystring1 substringToIndex: 9]];
           mygsskills[i].skillvalue = [self getfullvalueof: [NSString stringWithString: mystring2]];
           mygsskills[i].bonusvalue = [self getfullvalueof: [NSString stringWithString: mystring1]];
           i = 46;
           }
         }
       }
     if (hasCalipers)
       {
       NSString *mystring1 = [NSString stringWithString: *theString];
       if ([mystring1 rangeOfString: @"Measuring carefully, it looks to be" options: NSCaseInsensitiveSearch].location != NSNotFound)
         {
         if ([mystring1 rangeOfString: @"primitive" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -5 to -35\n"]];
           }
         else if ([mystring1 rangeOfString: @"rudimentary" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -40 to -75\n"]];
           }
         else if ([mystring1 rangeOfString: @"extremely easy" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -80 to -115\n"]];
           }
         else if ([mystring1 rangeOfString: @"very easy" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -120 to -155\n"]];
           }
         else if ([mystring1 rangeOfString: @"fairly easy" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -240 to -275\n"]];
           }
         else if ([mystring1 rangeOfString: @"easy" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -160 to -195\n"]];
           }
         else if ([mystring1 rangeOfString: @"very basic" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -200 to -235\n"]];
           }
         else if ([mystring1 rangeOfString: @"fairly simple" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -320 to -355\n"]];
           }
         else if ([mystring1 rangeOfString: @"simple" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -280 to -315\n"]];
           }
         else if ([mystring1 rangeOfString: @"fairly plain" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -360 to -395\n"]];
           }
         else if ([mystring1 rangeOfString: @"amazingly well-crafted" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -840 to -875\n"]];
           }
         else if ([mystring1 rangeOfString: @"moderately well-crafted" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -400 to -435\n"]];
           }
         else if ([mystring1 rangeOfString: @"extremely well-crafted" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -680 to -715\n"]];
           }
         else if ([mystring1 rangeOfString: @"extremely well-crafted" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -680 to -715\n"]];
           }
         else if ([mystring1 rangeOfString: @"very well-crafted" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -600 to -635\n"]];
           }
         else if ([mystring1 rangeOfString: @"masterfully well-crafted" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1080 to -1115\n"]];
           }
         else if ([mystring1 rangeOfString: @"absurdly well-crafted" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1240 to -1275\n"]];
           }
         else if ([mystring1 rangeOfString: @"well-crafted" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -440 to -475\n"]];
           }
         else if ([mystring1 rangeOfString: @"tricky" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -480 to -515\n"]];
           }
         else if ([mystring1 rangeOfString: @"somewhat difficult" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -520 to -555\n"]];
           }
         else if ([mystring1 rangeOfString: @"moderately difficult" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -560 to -595\n"]];
           }
         else if ([mystring1 rangeOfString: @"very difficult" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -720 to -755\n"]];
           }
         else if ([mystring1 rangeOfString: @"extremely difficult" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1000 to -1035\n"]];
           }
         else if ([mystring1 rangeOfString: @"absurdly difficult" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1320 to -1355\n"]];
           }
         else if ([mystring1 rangeOfString: @"difficult" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -640 to -675\n"]];
           }
         else if ([mystring1 rangeOfString: @"fairly complicated" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -760 to -795\n"]];
           }
         else if ([mystring1 rangeOfString: @"amazingly complicated" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1120 to -1155\n"]];
           }
         else if ([mystring1 rangeOfString: @"impressively complicated" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -920 to -955\n"]];
           }
         else if ([mystring1 rangeOfString: @"unbelievably complicated" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1360 to -1395\n"]];
           }
         else if ([mystring1 rangeOfString: @"amazingly intricate" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -960 to -995\n"]];
           }
         else if ([mystring1 rangeOfString: @"incredibly intricate" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1200 to -1235\n"]];
           }
         else if ([mystring1 rangeOfString: @"masterfully intricate" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -14000 to -1435\n"]];
           }
         else if ([mystring1 rangeOfString: @"intricate" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -800 to -835\n"]];
           }
         else if ([mystring1 rangeOfString: @"very complex" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -880 to -915\n"]];
           }
         else if ([mystring1 rangeOfString: @"extremely complex" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1040 to -1075\n"]];
           }
         else if ([mystring1 rangeOfString: @"astoundingly complex" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1160 to -1195\n"]];
           }
         else if ([mystring1 rangeOfString: @"exceedingly complex" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1280 to -1315\n"]];
           }
         else if ([mystring1 rangeOfString: @"impossibly complex" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = ??? -4665 ???\n"]];
           }
         else if ([mystring1 rangeOfString: @"???" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self echoTextToGameScreen: [NSMutableString stringWithString: @"Lock Range = -1320 to -1500\n"]];
           }
         }
       }
     }
 
   if ([myGameCode rangeOfString: @"DR" options: NSCaseInsensitiveSearch].location != NSNotFound)
     {
     NSString *mystring1 = [NSString stringWithString: *theString];
     NSString *mystring2 = [NSString stringWithString: *theString];
     int loc = 0;
     if (YES)
       {//.
       NSMutableString *mystring3 = [NSMutableString string];
       [mystring3 setString: @"A white-robed monk smiles at you."];
       loc = [mystring1 rangeOfString: mystring3 options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         [mystring3 setString: @"scoff monk"];
         if ([myCharacter rangeOfString: @"Wheller" options: NSCaseInsensitiveSearch].location != NSNotFound)
           {
           [self mySendCommand: [NSMutableString stringWithString: mystring3]];
           }
         }
       loc = [mystring1 rangeOfString: @"You flip open your bank book and see" options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         isDecodingBankBook = YES;
         int i = 0;
         for (i=1; i<15; i++)
           {
           myDRBankBalance[i].bankbalance = 0;
           }
         }
       loc = [mystring1 rangeOfString: @"Bank Listing Done" options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         isDecodingBankBook = NO;
         }
       if (isDecodingBankBook)
         {
         loc = [mystring1 rangeOfString: @"Crossing" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[crossingBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Dirge" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[dirgeBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Leth Deriel" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[lethBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Riverhaven" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[riverhavenBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Therenborough" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[therenBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Shard" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[shardBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Chyolvea Tayeu'a" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[citidelBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Ratha" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[rathaBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Surlaenis" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[aesryBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Hara'jaal" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[haraBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Hibarnhvidar" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[forfehdarBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Muspar'i" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[muspariBank].bankbalance = [self getvalueof: mystring1];
           }
         loc = [mystring1 rangeOfString: @"Throne City" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[throneBank].bankbalance = [self getvalueof: mystring1];
           }
         // this bank needs information, a placeholder is there only.
         loc = [mystring1 rangeOfString: @"merkreshBank" options: NSCaseInsensitiveSearch].location;
         if (loc != NSNotFound)
           {
           myDRBankBalance[merkreshBank].bankbalance = [self getvalueof: mystring1];
           }
         }
       loc = [mystring1 rangeOfString: @"Your current balance is" options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         [mystring3 setString: [NSString stringWithString: mystring1]];
         [mystring3 deleteCharactersInRange: NSMakeRange(0,loc)];
         [self decodeBankBalance: [NSMutableString stringWithString: mystring3]];
         //[self updateBankWindow];
         }
       loc = [mystring1 rangeOfString: @"you do not seem to have an account with us" options: NSCaseInsensitiveSearch].location;
       if (loc != NSNotFound)
         {
         [mystring3 setString: [NSString stringWithString: mystring1]];
         [mystring3 deleteCharactersInRange: NSMakeRange(0,loc)];
         [self decodeBankBalance: [NSMutableString stringWithString: mystring3]];
         //[self updateBankWindow];
         }
       if ([mystring1 rangeOfString: @"\"" options: NSCaseInsensitiveSearch].location == NSNotFound)
         {
         // You reach out with your senses and see quickly pulsating streams of Life energy coursing through the area.
         if (([mystring1 rangeOfString: @"You reach out with your senses" options: NSCaseInsensitiveSearch].location != NSNotFound) && enableAutomapper)
           {
           if ([mystring1 rangeOfString: @"vague" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 0;
             }
           else if ([mystring1 rangeOfString: @"hazy" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 1;
             }
           else if ([mystring1 rangeOfString: @"dimly flickering" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 2;
             }
           else if ([mystring1 rangeOfString: @"flickering" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 3;
             }
           else if ([mystring1 rangeOfString: @"shimmering" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 4;
             }
           else if ([mystring1 rangeOfString: @"slowly pulsating" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 5;
             }
           else if ([mystring1 rangeOfString: @"quickly pulsating" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 7;
             }
           else if ([mystring1 rangeOfString: @"pulsating" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 6;
             }
           else if ([mystring1 rangeOfString: @"fainly glowing" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 8;
             }
           else if ([mystring1 rangeOfString: @"powerfully glowing" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 10;
             }
           else if ([mystring1 rangeOfString: @"glowing" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 9;
             }
           else if ([mystring1 rangeOfString: @"softly shining" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 11;
             }
           else if ([mystring1 rangeOfString: @"shining" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 12;
             }
           else if ([mystring1 rangeOfString: @"luminous" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 13;
             }
           else if ([mystring1 rangeOfString: @"brilliant" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 14;
             }
           else if ([mystring1 rangeOfString: @"flaring" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 15;
             }
           else if ([mystring1 rangeOfString: @"glaring" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 16;
             }
           else if ([mystring1 rangeOfString: @"brightly burning" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 18;
             }
           else if ([mystring1 rangeOfString: @"burning" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 17;
             }
           else if ([mystring1 rangeOfString: @"blazing" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 19;
             }
           else if ([mystring1 rangeOfString: @"blinding" options: NSCaseInsensitiveSearch].location != NSNotFound)
             {
             currentRoomMana = 20;
             }
           [mapStuff setCurrentRoomMana: currentRoomMana];
           [mapStuff drawMap];
           }
         if (([mystring1 rangeOfString: @"You pick up" options: NSCaseInsensitiveSearch].location != NSNotFound) || ([mystring1 rangeOfString: @"gives you" options: NSCaseInsensitiveSearch].location != NSNotFound))
           {
           if (([mystring1 rangeOfString: @"Kronars" options: NSCaseInsensitiveSearch].location != NSNotFound) && (currentToting > 0))
             {
             currentToting = 1;
             [self addTotingBalance: [NSMutableString stringWithString: mystring1]];
             }
           if (([mystring1 rangeOfString: @"Lirums" options: NSCaseInsensitiveSearch].location != NSNotFound) && (currentToting > 0))
             {
             currentToting = 2;
             [self addTotingBalance: [NSMutableString stringWithString: mystring1]];
             }
           if (([mystring1 rangeOfString: @"Dokoras" options: NSCaseInsensitiveSearch].location != NSNotFound) && (currentToting > 0))
             {
             currentToting = 3;
             [self addTotingBalance: [NSMutableString stringWithString: mystring1]];
             currentToting = 0;
             }
           }
         if (([mystring1 rangeOfString: @"You give" options: NSCaseInsensitiveSearch].location != NSNotFound))
           {
           if (([mystring1 rangeOfString: @"Kronars" options: NSCaseInsensitiveSearch].location != NSNotFound) && (currentToting > 0))
             {
             currentToting = 1