Difference between revisions of "Script Function: Q4Z0"

From Ultima Online: The Second Age
Jump to: navigation, search
(Created page with " <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q4Z0(<span style="color:#0000FF">obj</span> t) { <span style="color:#0000FF">if</spa...")
 
 
Line 1: Line 1:
 
   <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q4Z0(<span style="color:#0000FF">obj</span> t)
 
   <span style="color:#0000FF">function</span> <span style="color:#0000FF">int</span> Q4Z0(<span style="color:#0000FF">obj</span> t)
 
   {
 
   {
     <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](t, <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"isLocked"</span></span>))
+
     <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](t, <span style="color:#800000">"isLocked"</span>))
 
     {
 
     {
       [[Engine Function:_barkTo|<span style="color:#FF0000;font-weight:bold">barkTo</span>]]([[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), [[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"Locked items may not be made not-for-sale."</span></span>);
+
       [[Engine Function:_barkTo|<span style="color:#FF0000;font-weight:bold">barkTo</span>]]([[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), [[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), <span style="color:#800000">"Locked items may not be made not-for-sale."</span>);
 
       <span style="color:#0000FF">return</span> (0x01);
 
       <span style="color:#0000FF">return</span> (0x01);
 
     }
 
     }
Line 25: Line 25:
 
         for(<span style="color:#0000FF">int</span> i = [[Engine Function:_numInList|<span style="color:#FF0000;font-weight:bold">numInList</span>]](Q4E4); i; i--)
 
         for(<span style="color:#0000FF">int</span> i = [[Engine Function:_numInList|<span style="color:#FF0000;font-weight:bold">numInList</span>]](Q4E4); i; i--)
 
         {
 
         {
           <span style="color:#0000FF">if</span> ((![[Engine Function:_hasScript|<span style="color:#FF0000;font-weight:bold">hasScript</span>]](Q4E4[0x00], <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"vended"</span></span>)) || ((![[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](Q4E4[0x00], <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"vendedPrice"</span></span>))))
+
           <span style="color:#0000FF">if</span> ((![[Engine Function:_hasScript|<span style="color:#FF0000;font-weight:bold">hasScript</span>]](Q4E4[0x00], <span style="color:#800000">"vended"</span>)) || ((![[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](Q4E4[0x00], <span style="color:#800000">"vendedPrice"</span>))))
 
           {
 
           {
 
             <span style="color:#0000FF">if</span> (![[Script_Function:_Q4Z0|<span style="color:#2B91AF">Q4Z0</span>]](Q4E4[0x00]))
 
             <span style="color:#0000FF">if</span> (![[Script_Function:_Q4Z0|<span style="color:#2B91AF">Q4Z0</span>]](Q4E4[0x00]))
 
             {
 
             {
               [[Engine Function:_barkTo|<span style="color:#FF0000;font-weight:bold">barkTo</span>]]([[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), [[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"To be not for sale, all contents of a container must be for sale."</span></span>);
+
               [[Engine Function:_barkTo|<span style="color:#FF0000;font-weight:bold">barkTo</span>]]([[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), [[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), <span style="color:#800000">"To be not for sale, all contents of a container must be for sale."</span>);
 
               <span style="color:#0000FF">return</span> (0x00);
 
               <span style="color:#0000FF">return</span> (0x00);
 
             }
 
             }
Line 45: Line 45:
 
     <span style="color:#0000FF">if</span> (![[Engine Function:_isValid|<span style="color:#FF0000;font-weight:bold">isValid</span>]](Q47J))
 
     <span style="color:#0000FF">if</span> (![[Engine Function:_isValid|<span style="color:#FF0000;font-weight:bold">isValid</span>]](Q47J))
 
     {
 
     {
       [[Engine Function:_bark|<span style="color:#FF0000;font-weight:bold">bark</span>]]([[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"It's not in a container."</span></span>);
+
       [[Engine Function:_bark|<span style="color:#FF0000;font-weight:bold">bark</span>]]([[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), <span style="color:#800000">"It's not in a container."</span>);
 
       <span style="color:#0000FF">return</span> (0x00);
 
       <span style="color:#0000FF">return</span> (0x00);
 
     }
 
     }
     <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](Q47J, <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"vendedPrice"</span></span>))
+
     <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](Q47J, <span style="color:#800000">"vendedPrice"</span>))
 
     {
 
     {
 
       <span style="color:#0000FF">return</span> (0x01);
 
       <span style="color:#0000FF">return</span> (0x01);
 
     }
 
     }
     [[Engine Function:_barkTo|<span style="color:#FF0000;font-weight:bold">barkTo</span>]]([[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), [[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), <span style=<span style="color:#800000">"color:#800000"</span>><span style="color:#800000">"Only the following items may be made not-for-sale: books, containers, keyrings, and items in a for-sale container."</span></span>);
+
     [[Engine Function:_barkTo|<span style="color:#FF0000;font-weight:bold">barkTo</span>]]([[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), [[Script_Function:_Q4SD|<span style="color:#2B91AF">Q4SD</span>]](), <span style="color:#800000">"Only the following items may be made not-for-sale: books, containers, keyrings, and items in a for-sale container."</span>);
 
     <span style="color:#0000FF">return</span> (0x00);
 
     <span style="color:#0000FF">return</span> (0x00);
 
   }
 
   }

Latest revision as of 02:31, 8 October 2018

 function int Q4Z0(obj t)
 {
   if (hasObjVar(t, "isLocked"))
   {
     barkTo(Q4SD(), Q4SD(), "Locked items may not be made not-for-sale.");
     return (0x01);
   }
   if (isContainer(t))
   {
     if (!isRealContainer(t))
     {
       switch (getObjType(t))
       {
       case 0x0EFA
       case 0x0E3B
         break;
       default
         return (0x01);
       }
     }
     else
     {
       list Q4E4;
       getContents(Q4E4, t);
       for(int i = numInList(Q4E4); i; i--)
       {
         if ((!hasScript(Q4E4[0x00], "vended")) || ((!hasObjVar(Q4E4[0x00], "vendedPrice"))))
         {
           if (!Q4Z0(Q4E4[0x00]))
           {
             barkTo(Q4SD(), Q4SD(), "To be not for sale, all contents of a container must be for sale.");
             return (0x00);
           }
         }
         removeItem(Q4E4, 0x00);
       }
     }
     return (0x01);
   }
   if (Q4YS(t))
   {
     return (0x01);
   }
   obj Q47J = containedBy(t);
   if (!isValid(Q47J))
   {
     bark(Q4SD(), "It's not in a container.");
     return (0x00);
   }
   if (hasObjVar(Q47J, "vendedPrice"))
   {
     return (0x01);
   }
   barkTo(Q4SD(), Q4SD(), "Only the following items may be made not-for-sale: books, containers, keyrings, and items in a for-sale container.");
   return (0x00);
 }