protected int genBehaviors(MOB mob, TriadList<String,String,Integer> behaviors, int showNumber, int showFlag)
	throws IOException
	{
		for(int b=0;b<=behaviors.size();b++)
		{
			if((b<behaviors.size())
			&&(behaviors.get(b).first.equalsIgnoreCase("MUDCHAT")
				||behaviors.get(b).first.equalsIgnoreCase("AGGRESSIVE")))
				continue;
			if((showFlag>0)&&(showFlag!=showNumber))
			{
				if(b<behaviors.size()) 
					showNumber++;
				continue;
			}
			if(b==behaviors.size())
			{
				if((mob.session()!=null)&&(!mob.session().isStopped()))
				{
					if(((showFlag<=-999)&&CMLib.genEd().prompt(mob,false,showNumber,showFlag,L("Add new mob behavior")))
					||(showNumber==showFlag))
					{
						behaviors.add("BehaviorID","",Integer.valueOf(behaviors.size()));
						b-=1;
					}
					else
					if(showFlag==-1)
						mob.tell(L("@x1. Add new mob behavior",""+showNumber));
				}
				continue;
			}
			String behavior=behaviors.get(b).first;
			String parms=behaviors.get(b).second;

			mob.tell(L("@x1. Behavior: @x2: @x3",""+showNumber,behavior,parms));
			if((showFlag==showNumber)||(showFlag<=-999))
			{
				behavior=CMLib.genEd().prompt(mob,behavior,showNumber,showFlag,L("Behavior ID (NULL to delete)"),true,toStringList(CMClass.behaviors()));
				if(behavior.length()==0)
				{
					behaviors.remove(b);
					b--;
					if((showFlag==showNumber))
						break;
					showNumber--;
					continue;
				}
				if(CMClass.getBehavior(behavior)==null)
				{
					mob.tell(L("Behavior '@x1' does not exist.  Use ? for a list.",behavior));
					b--;
					showNumber--;
					continue;
				}
				StringBuilder help=CMLib.help().getHelpText(behavior,mob,true);
				if(help==null)
					help=new StringBuilder("No help on '"+behavior+"'");
				parms=CMLib.genEd().prompt(mob,parms,showNumber,showFlag,L("Behavior Parameters"),help.toString());
				behaviors.get(b).first = behavior;
				behaviors.get(b).second = parms;
			}
			showNumber++;
		}
		return showNumber;
	}