-These are the functions I added.  I called the funcion newbieitems from 
-the function creatchar.  Alot may seem redundant but this is the only  
-way i could get it to work without it locking up(loops didn't work)
-There were some things i didn't notice while i was cutting and pasting from .004 to .005
-I made those changes here like MORE, MORE2, etc...
 
 ----  in uox3.h
extern char script4[512]; // added to use for newbie items

-added newbie_script to extern Script 
 
int secndbstskll(int m, int bstskll);
// gives second best skill

int thrdbstskll(int n, int scnbst);  
// gives third

void addfromitemlist(int itemlist); 
// this is what I use to grab items from itemlists, couldnt get other // to work

void newbieitems();
// main function
                  
void read3 ();              
// like read1 but use script3 & script4

void read4 ();
// same a above

----in globals.cpp
char script4[512]; //added for newbie items

newbie_script ("newbie.scp") was added toe the script caching part.

----in uox3.cpp

void read3 () // used for newbie items
{
 readscript();
 sprintf(script3, "%s", temp);
}

void read4 () // used for newbie items
{
 int i;
 readscript();
 i=0;
 script3[0]=0;
 script4[0]=0;
 while(temp[i]!=0 && temp[i]!=' ')
 {
  i++;
 }
 strncpy(script3, temp, i);
 script3[i]=0;
 if (script1[0]!='}' && temp[i]!=0) strcpy(script4, temp+i+1);
 return;
}

int secndbstskll(int m, int bstskll)  // Which skill is the second highest
{
 int i, a=0, b=0;

 for (i=0;i<TRUESKILLS;i++) 
 {
  if ((chars[m].baseskill[i]>b)&&(chars[m].baseskill[i]<chars[m].baseskill[bstskll])&&(bstskll!=i))
  {
   a=i;
   b=chars[m].baseskill[i];
  }
  if ((chars[m].baseskill[i]==chars[m].baseskill[bstskll])&&(bstskll!=i))
  {
   a=i;
   b=chars[m].baseskill[i];
  }
 }
 return a;
}

int thrdbstskll(int n, int scnbst)  // Which skill is the third highest
{
 int i, a=0, b=0;

 for (i=0;i<TRUESKILLS;i++)  
 { 
  if ((chars[n].baseskill[i]>b)&&(chars[n].baseskill[i]<chars[n].baseskill[scnbst])&&(scnbst!=i))
  {
   a=i;
   b=chars[n].baseskill[i];
  }
  if ((chars[n].baseskill[i]==chars[n].baseskill[scnbst])&&(scnbst!=i))
  {
   a=i;
   b=chars[n].baseskill[i];
  }
 }
 return a;
}

void newbieitems()
 {
  int first, second, third, tmp, storeval;
  char sect[512];
  long int pos, pos2;
  tile_st tile;

  first=bestskill(charcount);
  second=secndbstskll(charcount,first);
  third=thrdbstskll(charcount,second);
  if (chars[charcount].baseskill[third]<190) third=46;

  openscript("newbie.scp");
  sprintf(sect, "BESTSKILL %i", first);
  if (!newbie_script.find(sect)) 
  {
   closescript();
   return;
  }
  do
  {
   read2();
   if (script1[0]!='}')
   { 
    if (!(strcmp("PACKITEM",script1)))
    {
     inititem(itemcount);
     items[itemcount].ser1=itemcount2/16777216;
     items[itemcount].ser2=itemcount2/65536;
     items[itemcount].ser3=itemcount2/256;
     items[itemcount].ser4=itemcount2;
     items[itemcount].cont1=items[packitem(charcount)].ser1;
     items[itemcount].cont2=items[packitem(charcount)].ser2;
     items[itemcount].cont3=items[packitem(charcount)].ser3;
     items[itemcount].cont4=items[packitem(charcount)].ser4;
     items[itemcount].layer=0x01;
     items[itemcount].x=50+(rand()%80);
     items[itemcount].y=50+(rand()%80);
     items[itemcount].z=9;
     items[itemcount].priv=items[itemcount].priv|0x02;
     storeval=str2num(script2);
     pos=ftell(scpfile);
     closescript();
     openscript("items.scp");
     sprintf(sect, "ITEM %i", storeval);
     if (!items_script.find(sect))
     {
      closescript();
      return;
     }
     do
     {
      read4();
      if (script3[0]!='}')
      {
       if (!(strcmp("NAME",script3)))
       {
        sprintf(items[itemcount].name, "%s", script4);
       }
       if (!(strcmp("ITEMLIST", script3)))
       {
        storeval=str2num(script4);        
        pos2=ftell(scpfile);
        closescript();
        addfromitemlist(storeval);
        openscript("items.scp");
        fseek(scpfile, pos2, SEEK_SET);
        sprintf(script3, "DUMMY");
       }
       if (!(strcmp("ID",script3)))
       {
        tmp=hstr2num(script4);
        items[itemcount].id1=tmp/256;
        items[itemcount].id2=tmp%256;
       }
       if (!(strcmp("AMOUNT",script3)))
       {
        items[itemcount].amount=str2num(script4);
       }
       if (!(strcmp("COLOR",script3)))
       {
        tmp=hstr2num(script4);
        items[itemcount].color1=tmp/256;
        items[itemcount].color2=tmp%256;
       }
       if (!(strcmp("TYPE",script3)))
       {
        items[itemcount].type=str2num(script4);
       }
       if ((!(strcmp("DAMAGE",script1)))||(!(strcmp("ATT",script3))))
       {
        items[itemcount].att = getstatskillvalue(script4);
       }
       if (!(strcmp("DEF",script3)))
       {
        items[itemcount].def=str2num(script4);
       }
       if (!(strcmp("HP", script3)))
       {
        items[itemcount].hp=str2num(script4);
       }
       if (!(strcmp("STR", script3)))
       {
        items[itemcount].st=str2num(script4);
       }
       if (!(strcmp("LODAMAGE", script3)))
       {
        items[itemcount].lodamage=str2num(script4);
       }
       if (!(strcmp("HIDAMAGE", script3)))
       {
        items[itemcount].hidamage=str2num(script4);
       }
       if (!(strcmp("MOVABLE",script3)))
       {
        items[itemcount].magic=str2num(script4);
       }
       if (!(strcmp("VISIBLE",script3)))
       {
        items[itemcount].visible=str2num(script4);
       }
       if (!(strcmp("DYE",script3)))
       {
        items[itemcount].dye=str2num(script4);
       }
       if (!(strcmp("MORE", script3)))
       {
        tmp=str2num(script4);
        items[itemcount].more1=tmp/16777216;
        items[itemcount].more2=tmp/65536;
        items[itemcount].more3=tmp/256;
        items[itemcount].more4=tmp%256;
       }
       if (!(strcmp("MORE2", script3)))
       {
        tmp=str2num(script4);
        items[itemcount].moreb1=tmp/16777216;
        items[itemcount].moreb2=tmp/65536;
        items[itemcount].moreb3=tmp/256;
        items[itemcount].moreb4=tmp%256;
       }
       if (!(strcmp("MOREX",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morex=tmp;
       }
       if (!(strcmp("MOREY",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morey=tmp;
       }
       if (!(strcmp("MOREZ",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morez=tmp;
       }
       if (!(strcmp("DIR",script3)))
       {
        items[itemcount].dir=str2num(script4);
       }
       if (!(strcmp("DECAY",script3)))
       {
        items[itemcount].priv=items[itemcount].priv|0x01;
       }
       if (!(strcmp("DISPELLABLE",script3)))
       {
        items[itemcount].priv=items[itemcount].priv|0x04;
       }
       if (!(strcmp("VALUE",script3)))
       {
        items[itemcount].value=str2num(script4);
       }
       if (!(strcmp("RESTOCK",script3)))
       {
        items[itemcount].restock=str2num(script4);
       }
       if (!(strcmp("SPD", script3)))
       {
        items[itemcount].spd=str2num(script4);
       }
      }
     }
     while (script3[0]!='}');
     closescript();
     itemcount++;
     itemcount2++;
     openscript("newbie.scp");
     fseek(scpfile, pos, SEEK_SET);
    }
   }  
  }
  while (script1[0]!='}');
  closescript();
  openscript("newbie.scp");
  sprintf(sect, "BESTSKILL %i", second);
  if (!newbie_script.find(sect)) 
  {
   closescript();
   return;
  }
  do
  {
   read2();
   if (script1[0]!='}')
   {
    if (!(strcmp("PACKITEM",script1)))
    {
     inititem(itemcount);
     items[itemcount].ser1=itemcount2/16777216;
     items[itemcount].ser2=itemcount2/65536;
     items[itemcount].ser3=itemcount2/256;
     items[itemcount].ser4=itemcount2;
     items[itemcount].cont1=items[packitem(charcount)].ser1;
     items[itemcount].cont2=items[packitem(charcount)].ser2;
     items[itemcount].cont3=items[packitem(charcount)].ser3;
     items[itemcount].cont4=items[packitem(charcount)].ser4;
     items[itemcount].layer=0x01;
     items[itemcount].x=50+(rand()%80);
     items[itemcount].y=50+(rand()%80);
     items[itemcount].z=9;
     items[itemcount].priv=items[itemcount].priv|0x02;
     storeval=str2num(script2);
     pos=ftell(scpfile);
     closescript();
     openscript("items.scp");
     sprintf(sect, "ITEM %i", storeval);
     if (!items_script.find(sect))
     {
      closescript();
      return;
     }
     do
     {
      read4();
      if (script3[0]!='}')
      {
       if (!(strcmp("NAME",script3)))
       {
        sprintf(items[itemcount].name, "%s", script4);
       }
       if (!(strcmp("ITEMLIST", script3)))
       {
        storeval=str2num(script4);        
        pos2=ftell(scpfile);
        closescript();
        addfromitemlist(storeval);
        openscript("items.scp");
        fseek(scpfile, pos2, SEEK_SET);
        sprintf(script3, "DUMMY");
       }
       if (!(strcmp("ID",script3)))
       {
        tmp=hstr2num(script4);
        items[itemcount].id1=tmp/256;
        items[itemcount].id2=tmp%256;
       }
       if (!(strcmp("AMOUNT",script3)))
       {
        items[itemcount].amount=str2num(script4);
       }
       if (!(strcmp("COLOR",script3)))
       {
        tmp=hstr2num(script4);
        items[itemcount].color1=tmp/256;
        items[itemcount].color2=tmp%256;
       }
       if (!(strcmp("TYPE",script3)))
       {
        items[itemcount].type=str2num(script4);
       }
       if ((!(strcmp("DAMAGE",script1)))||(!(strcmp("ATT",script3))))
       {
        items[itemcount].att = getstatskillvalue(script4);
       }
       if (!(strcmp("DEF",script3)))
       {
        items[itemcount].def=str2num(script4);
       }
       if (!(strcmp("HP", script3)))
       {
        items[itemcount].hp=str2num(script4);
       }
       if (!(strcmp("STR", script3)))
       {
        items[itemcount].st=str2num(script4);
       }
       if (!(strcmp("LODAMAGE", script3)))
       {
        items[itemcount].lodamage=str2num(script4);
       }
       if (!(strcmp("HIDAMAGE", script3)))
       {
        items[itemcount].hidamage=str2num(script4);
       }
       if (!(strcmp("MOVABLE",script3)))
       {
        items[itemcount].magic=str2num(script4);
       }
       if (!(strcmp("VISIBLE",script3)))
       {
        items[itemcount].visible=str2num(script4);
       }
       if (!(strcmp("DYE",script3)))
       {
        items[itemcount].dye=str2num(script4);
       }
       if (!(strcmp("MORE", script3)))
       {
        tmp=str2num(script4);
        items[itemcount].more1=tmp/16777216;
        items[itemcount].more2=tmp/65536;
        items[itemcount].more3=tmp/256;
        items[itemcount].more4=tmp%256;
       }
       if (!(strcmp("MORE2", script3)))
       {
        tmp=str2num(script4);
        items[itemcount].moreb1=tmp/16777216;
        items[itemcount].moreb2=tmp/65536;
        items[itemcount].moreb3=tmp/256;
        items[itemcount].moreb4=tmp%256;
       }
       if (!(strcmp("MOREX",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morex=tmp;
       }
       if (!(strcmp("MOREY",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morey=tmp;
       }
       if (!(strcmp("MOREZ",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morez=tmp;
       }
       if (!(strcmp("DIR",script3)))
       {
        items[itemcount].dir=str2num(script4);
       }
       if (!(strcmp("DECAY",script3)))
       {
        items[itemcount].priv=items[itemcount].priv|0x01;
       }
       if (!(strcmp("DISPELLABLE",script3)))
       {
        items[itemcount].priv=items[itemcount].priv|0x04;
       }
       if (!(strcmp("VALUE",script3)))
       {
        items[itemcount].value=str2num(script4);
       }
       if (!(strcmp("RESTOCK",script3)))
       {
        items[itemcount].restock=str2num(script4);
       }
       if (!(strcmp("SPD", script3)))
       {
        items[itemcount].spd=str2num(script4);
       }
      }
     }
     while (script3[0]!='}');
     closescript();
     itemcount++;
     itemcount2++;
     openscript("newbie.scp");
     fseek(scpfile, pos, SEEK_SET);
    } 
   }
  }
  while (script1[0]!='}');
  closescript();
  openscript("newbie.scp");
  sprintf(sect, "BESTSKILL %i", third);
  if (!newbie_script.find(sect)) 
  {
   closescript();
   return;
  }
  do
  {
   read2();
   if (script1[0]!='}')
   {
    if (!(strcmp("PACKITEM",script1)))
    {
     inititem(itemcount);
     items[itemcount].ser1=itemcount2/16777216;
     items[itemcount].ser2=itemcount2/65536;
     items[itemcount].ser3=itemcount2/256;
     items[itemcount].ser4=itemcount2;
     items[itemcount].cont1=items[packitem(charcount)].ser1;
     items[itemcount].cont2=items[packitem(charcount)].ser2;
     items[itemcount].cont3=items[packitem(charcount)].ser3;
     items[itemcount].cont4=items[packitem(charcount)].ser4;
     items[itemcount].layer=0x01;
     items[itemcount].x=50+(rand()%80);
     items[itemcount].y=50+(rand()%80);
     items[itemcount].z=9;
     items[itemcount].priv=items[itemcount].priv|0x02;
     storeval=str2num(script2);
     pos=ftell(scpfile);
     closescript();
     openscript("items.scp");
     sprintf(sect, "ITEM %i", storeval);
     if (!items_script.find(sect))
     {
      closescript();
      return;
     }
     do
     {
      read4();
      if (script3[0]!='}')
      {
       if (!(strcmp("NAME",script3)))
       {
        sprintf(items[itemcount].name, "%s", script4);
       }
       if (!(strcmp("ITEMLIST", script3)))
       {
        storeval=str2num(script4);        
        pos2=ftell(scpfile);
        closescript();
        addfromitemlist(storeval);
        openscript("items.scp");
        fseek(scpfile, pos2, SEEK_SET);
        sprintf(script3, "DUMMY");
       }
       if (!(strcmp("ID",script3)))
       {
        tmp=hstr2num(script4);
        items[itemcount].id1=tmp/256;
        items[itemcount].id2=tmp%256;
       }
       if (!(strcmp("AMOUNT",script3)))
       {
        items[itemcount].amount=str2num(script4);
       }
       if (!(strcmp("COLOR",script3)))
       {
        tmp=hstr2num(script4);
        items[itemcount].color1=tmp/256;
        items[itemcount].color2=tmp%256;
       }
       if (!(strcmp("TYPE",script3)))
       {
        items[itemcount].type=str2num(script4);
       }
       if ((!(strcmp("DAMAGE",script1)))||(!(strcmp("ATT",script3))))
       {
        items[itemcount].att = getstatskillvalue(script4);
       }
       if (!(strcmp("DEF",script3)))
       {
        items[itemcount].def=str2num(script4);
       }
       if (!(strcmp("HP", script3)))
       {
        items[itemcount].hp=str2num(script4);
       }
       if (!(strcmp("STR", script3)))
       {
        items[itemcount].st=str2num(script4);
       }
       if (!(strcmp("LODAMAGE", script3)))
       {
        items[itemcount].lodamage=str2num(script4);
       }
       if (!(strcmp("HIDAMAGE", script3)))
       {
        items[itemcount].hidamage=str2num(script4);
       }
       if (!(strcmp("MOVABLE",script3)))
       {
        items[itemcount].magic=str2num(script4);
       }
       if (!(strcmp("VISIBLE",script3)))
       {
        items[itemcount].visible=str2num(script4);
       }
       if (!(strcmp("DYE",script3)))
       {
        items[itemcount].dye=str2num(script4);
       }
       if (!(strcmp("MORE", script3)))
       {
        tmp=str2num(script4);
        items[itemcount].more1=tmp/16777216;
        items[itemcount].more2=tmp/65536;
        items[itemcount].more3=tmp/256;
        items[itemcount].more4=tmp%256;
       }
       if (!(strcmp("MORE2", script3)))
       {
        tmp=str2num(script4);
        items[itemcount].moreb1=tmp/16777216;
        items[itemcount].moreb2=tmp/65536;
        items[itemcount].moreb3=tmp/256;
        items[itemcount].moreb4=tmp%256;
       }
       if (!(strcmp("MOREX",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morex=tmp;
       }
       if (!(strcmp("MOREY",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morey=tmp;
       }
       if (!(strcmp("MOREZ",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morez=tmp;
       }
       if (!(strcmp("DIR",script3)))
       {
        items[itemcount].dir=str2num(script4);
       }
       if (!(strcmp("DECAY",script3)))
       {
        items[itemcount].priv=items[itemcount].priv|0x01;
       }
       if (!(strcmp("DISPELLABLE",script3)))
       {
        items[itemcount].priv=items[itemcount].priv|0x04;
       }
       if (!(strcmp("VALUE",script3)))
       {
        items[itemcount].value=str2num(script4);
       }
       if (!(strcmp("RESTOCK",script3)))
       {
        items[itemcount].restock=str2num(script4);
       }
       if (!(strcmp("SPD", script3)))
       {
        items[itemcount].spd=str2num(script4);
       }
      }
     }
     while (script3[0]!='}');
     closescript();
     itemcount++;
     itemcount2++;
     openscript("newbie.scp");
     fseek(scpfile, pos, SEEK_SET);
    }
   } 
  }
  while (script1[0]!='}');
  closescript();
  openscript("newbie.scp");
  sprintf(sect, "DEFAULT");
  if (!newbie_script.find(sect)) 
  {
   closescript();
   return;
  }
  do
  {
   read2();
   if (script1[0]!='}')
   {
    if (!(strcmp("PACKITEM",script1)))
    {
     inititem(itemcount);
     items[itemcount].ser1=itemcount2/16777216;
     items[itemcount].ser2=itemcount2/65536;
     items[itemcount].ser3=itemcount2/256;
     items[itemcount].ser4=itemcount2;
     items[itemcount].cont1=items[packitem(charcount)].ser1;
     items[itemcount].cont2=items[packitem(charcount)].ser2;
     items[itemcount].cont3=items[packitem(charcount)].ser3;
     items[itemcount].cont4=items[packitem(charcount)].ser4;
     items[itemcount].layer=0x01;
     items[itemcount].x=50+(rand()%80);
     items[itemcount].y=50+(rand()%80);
     items[itemcount].z=9;
     items[itemcount].priv=items[itemcount].priv|0x02;
     storeval=str2num(script2);
     pos=ftell(scpfile);
     closescript();
     openscript("items.scp");
     sprintf(sect, "ITEM %i", storeval);
     if (!items_script.find(sect))
     {
      closescript();
      return;
     }
     do
     {
      read4();
      if (script3[0]!='}')
      {
       if (!(strcmp("NAME",script3)))
       {
        sprintf(items[itemcount].name, "%s", script4);
       }
       if (!(strcmp("ITEMLIST", script3)))
       {
        storeval=str2num(script4);        
        pos2=ftell(scpfile);
        closescript();
        addfromitemlist(storeval);
        openscript("items.scp");
        fseek(scpfile, pos2, SEEK_SET);
        sprintf(script3, "DUMMY");
       }
       if (!(strcmp("ID",script3)))
       {
        tmp=hstr2num(script4);
        items[itemcount].id1=tmp/256;
        items[itemcount].id2=tmp%256;
       }
       if (!(strcmp("AMOUNT",script3)))
       {
        items[itemcount].amount=str2num(script4);
       }
       if (!(strcmp("COLOR",script3)))
       {
        tmp=hstr2num(script4);
        items[itemcount].color1=tmp/256;
        items[itemcount].color2=tmp%256;
       }
       if (!(strcmp("TYPE",script3)))
       {
        items[itemcount].type=str2num(script4);
       }
       if ((!(strcmp("DAMAGE",script1)))||(!(strcmp("ATT",script3))))
       {
        items[itemcount].att = getstatskillvalue(script4);
       }
       if (!(strcmp("DEF",script3)))
       {
        items[itemcount].def=str2num(script4);
       }
       if (!(strcmp("HP", script3)))
       {
        items[itemcount].hp=str2num(script4);
       }
       if (!(strcmp("STR", script3)))
       {
        items[itemcount].st=str2num(script4);
       }
       if (!(strcmp("LODAMAGE", script3)))
       {
        items[itemcount].lodamage=str2num(script4);
       }
       if (!(strcmp("HIDAMAGE", script3)))
       {
        items[itemcount].hidamage=str2num(script4);
       }
       if (!(strcmp("MOVABLE",script3)))
       {
        items[itemcount].magic=str2num(script4);
       }
       if (!(strcmp("VISIBLE",script3)))
       {
        items[itemcount].visible=str2num(script4);
       }
       if (!(strcmp("DYE",script3)))
       {
        items[itemcount].dye=str2num(script4);
       }
       if (!(strcmp("MORE", script3)))
       {
        tmp=str2num(script4);
        items[itemcount].more1=tmp/16777216;
        items[itemcount].more2=tmp/65536;
        items[itemcount].more3=tmp/256;
        items[itemcount].more4=tmp%256;
       }
       if (!(strcmp("MORE2", script3)))
       {
        tmp=str2num(script4);
        items[itemcount].moreb1=tmp/16777216;
        items[itemcount].moreb2=tmp/65536;
        items[itemcount].moreb3=tmp/256;
        items[itemcount].moreb4=tmp%256;
       }
       if (!(strcmp("MOREX",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morex=tmp;
       }
       if (!(strcmp("MOREY",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morey=tmp;
       }
       if (!(strcmp("MOREZ",script3)))
       {
        tmp=str2num(script4);
        items[itemcount].morez=tmp;
       }
       if (!(strcmp("DIR",script3)))
       {
        items[itemcount].dir=str2num(script4);
       }
       if (!(strcmp("DECAY",script3)))
       {
        items[itemcount].priv=items[itemcount].priv|0x01;
       }
       if (!(strcmp("DISPELLABLE",script3)))
       {
        items[itemcount].priv=items[itemcount].priv|0x04;
       }
       if (!(strcmp("VALUE",script3)))
       {
        items[itemcount].value=str2num(script4);
       }
       if (!(strcmp("RESTOCK",script3)))
       {
        items[itemcount].restock=str2num(script4);
       }
       if (!(strcmp("SPD", script3)))
       {
        items[itemcount].spd=str2num(script4);
       }
      }
     }
     while (script3[0]!='}');
     closescript();
     itemcount++;
     itemcount2++;
     openscript("newbie.scp");
     fseek(scpfile, pos, SEEK_SET);
    }
   } 
  }
  while (script1[0]!='}');
  closescript();
 }
  
void addfromitemlist(int itemlist)// needed for Newbie items
{
 char sect[512];
 int i=0,j=0,itemnum,tmp, storeval, pos;

 openscript("items.scp");
 sprintf(sect, "ITEMLIST %i", itemlist);
 if (!items_script.find(sect)) 
 {
  closescript();
  return;
 }
 do
 {
  read1();
  if (script1[0]!='}')
  {
   i++;
  }
 }
 while (script1[0]!='}');
 closescript();
 if(i>0)
 {
  i=rand()%i;
  openscript("items.scp");
  sprintf(sect, "ITEMLIST %i", itemlist);
  if(!items_script.find(sect))
  {
   closescript();
   return;
  }
  do
  {
   read1();
   if (script1[0]!='}')
   {
    j++;
    if(j==i)
    {
    itemnum=str2num(script1);
    }
   }
  }
  while (script1[0]!='}');
  closescript();
 }
 openscript("items.scp");
 sprintf(sect, "ITEM %i", itemnum);
 if (!items_script.find(sect))
 {
  closescript();
  return;
 }
 items[itemcount].ser1=itemcount2/16777216;
 items[itemcount].ser2=itemcount2/65536;
 items[itemcount].ser3=itemcount2/256;
 items[itemcount].ser4=itemcount2;
 items[itemcount].cont1=items[packitem(charcount)].ser1;
 items[itemcount].cont2=items[packitem(charcount)].ser2;
 items[itemcount].cont3=items[packitem(charcount)].ser3;
 items[itemcount].cont4=items[packitem(charcount)].ser4;
 items[itemcount].layer=0x01;
 items[itemcount].x=50+(rand()%80);
 items[itemcount].y=50+(rand()%80);
 items[itemcount].z=9;
 items[itemcount].priv=items[itemcount].priv|0x02;
 do
 {
  read2();
  if (script1[0]!='}')
  {
   if (!(strcmp("NAME",script1)))
   {
    sprintf(items[itemcount].name, "%s", script2);    
   }
   if (!(strcmp("ITEMLIST", script1)))
   {
    storeval=str2num(script2);        
    pos=ftell(scpfile);
    closescript();
    addfromitemlist(storeval);
    openscript("items.scp");
    fseek(scpfile, pos, SEEK_SET);
    sprintf(script1, "DUMMY");
   }
   if (!(strcmp("ID",script1)))
   {
    tmp=hstr2num(script2);
    items[itemcount].id1=tmp/256;
    items[itemcount].id2=tmp%256;
   }
   if (!(strcmp("AMOUNT",script1)))
   {
    items[itemcount].amount=str2num(script2);
   }
   if (!(strcmp("COLOR",script1)))
   {
    tmp=hstr2num(script2);
    items[itemcount].color1=tmp/256;
    items[itemcount].color2=tmp%256;
   }
   if (!(strcmp("TYPE",script1)))
   {
    items[itemcount].type=str2num(script2);
   }
   if ((!(strcmp("DAMAGE",script1)))||(!(strcmp("ATT",script1))))
   {
    items[itemcount].att = getstatskillvalue(script2);
   }
   if (!(strcmp("DEF",script1)))
   {
    items[itemcount].def=str2num(script2);
   }
   if (!(strcmp("HP", script1)))
   {
    items[itemcount].hp=str2num(script2);
   }
   if (!(strcmp("STR", script1)))
   {
    items[itemcount].st=str2num(script2);
   }
   if (!(strcmp("LODAMAGE", script1)))
   {
    items[itemcount].lodamage=str2num(script2);
   }
   if (!(strcmp("HIDAMAGE", script1)))
   {
    items[itemcount].hidamage=str2num(script2);
   }
   if (!(strcmp("MOVABLE",script1)))
   {
    items[itemcount].magic=str2num(script2);
   }
   if (!(strcmp("VISIBLE",script1)))
   {
    items[itemcount].visible=str2num(script2);
   }
   if (!(strcmp("DYE",script1)))
   {
    items[itemcount].dye=str2num(script2);
   }
   if (!(strcmp("MORE", script1)))
   {
    tmp=str2num(script2);
    items[itemcount].more1=tmp/16777216;
    items[itemcount].more2=tmp/65536;
    items[itemcount].more3=tmp/256;
    items[itemcount].more4=tmp%256;
   }
   if (!(strcmp("MORE2", script1)))
   {
    tmp=str2num(script2);
    items[itemcount].moreb1=tmp/16777216;
    items[itemcount].moreb2=tmp/65536;
    items[itemcount].moreb3=tmp/256;
    items[itemcount].moreb4=tmp%256;
   }
   if (!(strcmp("MOREX",script1)))
   {
    tmp=str2num(script2);
    items[itemcount].morex=tmp;
   }
   if (!(strcmp("MOREY",script1)))
   {
    tmp=str2num(script2);
    items[itemcount].morey=tmp;
   }
   if (!(strcmp("MOREZ",script1)))
   {
    tmp=str2num(script2);
    items[itemcount].morez=tmp;
   }
   if (!(strcmp("DIR",script1)))
   {
    items[itemcount].dir=str2num(script2);
   }
   if (!(strcmp("DECAY",script1)))
   {
    items[itemcount].priv=items[itemcount].priv|0x01;
   }
   if (!(strcmp("DISPELLABLE",script1)))
   {
    items[itemcount].priv=items[itemcount].priv|0x04;
   }
   if (!(strcmp("VALUE",script1)))
   {
    items[itemcount].value=str2num(script2);
   }
   if (!(strcmp("RESTOCK",script1)))
   {
    items[itemcount].restock=str2num(script2);
   }
   if (!(strcmp("SPD", script1)))
   {
    items[itemcount].spd=str2num(script2);
   }
  }
 }
 while (script1[0]!='}');
 closescript();
 script1[0]=0;
}
